forked from cypress-io/cypress-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add contentful based top banner (cypress-io#1911)
* data fetch && swig && styles * banners actualization script * finish (?) * finish (?) * remove "extends" from eslint settings * remove sensitive info * update hexo index file * banner padding fix * remove Promise.protoype.finally() from hexo index script * Contentful driven banners, parsed dynamically: Hexo index.js && data fetch && swig && styles && banners_actualization script * add cypress test for banners * docs update v1 * Fix toc width so that it doesn't create a horizontal scrollbar on smaller heights screen. * package-lock * just a few tweaks to the README instructions * fixed conflict issue from package.json merge
- Loading branch information
1 parent
c419788
commit c336823
Showing
19 changed files
with
442 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const YAML = require('yamljs') | ||
const emojiStrip = require('emoji-strip') | ||
|
||
const allBannersYaml = 'source/_data/banners.yml' | ||
|
||
describe('Contentful driven banners', () => { | ||
it('displays all current banners with proper info', function () { | ||
cy.readFile(allBannersYaml) | ||
.then((yamlString) => YAML.parse(yamlString.replace(/\\u[\dA-F]{8}/gi, ''))) | ||
.then((banners) => { | ||
if (typeof banners === 'undefined' || !banners || !banners.length) return this.skip() | ||
|
||
cy.visit('/') | ||
|
||
cy.get('#header .top-banners_item') | ||
.each((banner, i) => { | ||
const text = banner.children('.top-banners_item--body').html().trim() | ||
const { startDate, endDate } = banner.data() | ||
const btn = banner.children('.call-to-action') | ||
const btnText = btn.text().trim() | ||
const btnLink = btn.attr('href') | ||
|
||
expect(emojiStrip(text), `Banner #${i + 1} text is proper`).to.eq(banners[i].text.replace(/\r?\n|\r/g, ' ')) | ||
expect(startDate, `Banner #${i + 1} startDate is proper`).to.eq(banners[i].startDate) | ||
expect(endDate, `Banner #${i + 1} endDate is proper`).to.eq(banners[i].endDate) | ||
expect(btnText, `Banner #${i + 1} call-to-action text is proper`).to.eq(banners[i].buttonText.trim()) | ||
expect(btnLink, `Banner #${i + 1} call-to-action link is proper`).to.eq(banners[i].buttonLink) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- startDate: '2019-07-17T14:00-05:00' | ||
endDate: '2019-07-31T23:59-05:00' | ||
text: "<p>\U0001F6A9Learn how to get complete code coverage with Cypress <a href=\"https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA\">on July 31st at 11AM PDT/2PM EDT</a> with Gleb Bahmutov and Amir Rustamzadeh <a href=\"https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA\"></a></p>" | ||
buttonText: 'Register Now ' | ||
buttonLink: 'https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="top-banners"> | ||
{% for banner in site.data.banners %} | ||
<div class="top-banners_item" data-start-date="{{ banner.startDate }}" data-end-date="{{ banner.endDate }}"> | ||
<div class="top-banners_item--body"> | ||
{{ banner.text }} | ||
</div> | ||
|
||
<a class="top-banners_item--btn top-banners_item--btn-blue call-to-action" href="{{ banner.buttonLink }}"> | ||
{{ banner.buttonText || 'Get Started' }} | ||
</a> | ||
</div> | ||
{% endfor %} | ||
</div> |
Oops, something went wrong.