Skip to content

Commit b2bcc82

Browse files
authored
Merge pull request #45529 from github/repo-sync
Repo sync
2 parents 3eb0158 + 4032e8e commit b2bcc82

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/fixtures/tests/playwright-rendering.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,30 @@ test.describe('test nav at different viewports', () => {
638638
await expect(page.locator('#main-content')).toBeVisible()
639639
})
640640

641+
test('resizing from mobile to desktop closes the inline nav', async ({ page }) => {
642+
// Start below the xxl (1400px) breakpoint where the inline mobile nav lives.
643+
page.setViewportSize({
644+
width: 1013,
645+
height: 700,
646+
})
647+
await page.goto('/get-started/foo/bar')
648+
649+
// Open the inline doc-tree nav from the secondary bar.
650+
await page.getByTestId('sidebar-mobile-toggle').click()
651+
const nav = page.locator('[data-container="nav"]')
652+
await expect(nav).toHaveAttribute('data-mobile-open', 'true')
653+
654+
// Resize up to the desktop breakpoint -- the inline nav should close and the
655+
// fixed desktop rail (326px) should take over rather than the full-width
656+
// mobile markup persisting over the page.
657+
await page.setViewportSize({
658+
width: 1400,
659+
height: 700,
660+
})
661+
await expect(nav).toHaveAttribute('data-mobile-open', 'false')
662+
await expect(nav).toHaveCSS('width', '326px')
663+
})
664+
641665
test('large -> x-large viewports - 1012+', async ({ page }) => {
642666
page.setViewportSize({
643667
width: 1013,

0 commit comments

Comments
 (0)