-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2168 from system-ui/docs-header-scroll-shadow
fix(docs): make layout more consistent
- Loading branch information
Showing
2 changed files
with
149 additions
and
20 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,73 @@ | ||
describe('docs navigation', () => { | ||
it('works without 404', () => { | ||
cy.visit('/') | ||
cy.findByText('Documentation').click() | ||
cy.location().should('have.property', 'pathname', '/getting-started') | ||
cy.findByText('Theming').click() | ||
cy.get('h1').should('have.text', 'Theming') | ||
cy.findAllByRole('link').then(($links) => { | ||
const links = $links.get() | ||
const texts = links.map((link) => link.textContent) | ||
|
||
const expectedLinkTexts = [ | ||
'Hooks', | ||
'API', | ||
'Theme Specification', | ||
'Demo', | ||
'Resources', | ||
'Components', | ||
'Packages', | ||
'Guides', | ||
'Recipes', | ||
'Migrating', | ||
'Edit the page on GitHub', | ||
'Previous:Getting Started with Gatsby', | ||
] | ||
|
||
for (const s of expectedLinkTexts) { | ||
expect(texts).to.include(s) | ||
} | ||
|
||
const nextChapterLink = links.find( | ||
(link) => link.textContent === 'Next:The sx Prop' | ||
)! | ||
|
||
nextChapterLink.click() | ||
|
||
const packagesLink = links.find( | ||
(link) => link.textContent === 'Packages' | ||
)! | ||
|
||
packagesLink.click() | ||
}) | ||
|
||
for (const packageName of [ | ||
'css', | ||
'core', | ||
'components', | ||
'presets', | ||
'color', | ||
]) { | ||
cy.findAllByText('@theme-ui/' + packageName, { selector: 'li > a' }) | ||
.first() | ||
.click() | ||
cy.location().should( | ||
'have.property', | ||
'pathname', | ||
`/packages/${packageName}` | ||
) | ||
} | ||
|
||
cy.window().then((win) => win.scrollTo(0, 200)) | ||
|
||
cy.percySnapshot('@theme-ui/color docs') | ||
}) | ||
|
||
it('displays 404 page', () => { | ||
cy.visit(`/not-found-${Math.random()}`, { failOnStatusCode: false }) | ||
cy.findByRole('heading').should('have.text', '404') | ||
cy.findByText('Page not found') | ||
}) | ||
}) | ||
|
||
export {} |