Skip to content

Commit 1178fc0

Browse files
committed
test: fix AppHeader test to check z-1 removal instead of nav list class
1 parent 10f1deb commit 1178fc0

File tree

1 file changed

+9
-33
lines changed

1 file changed

+9
-33
lines changed

test/nuxt/components/AppHeader.spec.ts

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,24 @@ import { mountSuspended } from '@nuxt/test-utils/runtime'
33
import AppHeader from '~/components/AppHeader.vue'
44

55
describe('AppHeader', () => {
6-
it('renders a search input area', async () => {
7-
const wrapper = await mountSuspended(AppHeader, {
8-
route: '/',
9-
})
10-
11-
// The search container with ref="searchContainerRef" should be rendered
12-
// and contain an input element for the search functionality
13-
const html = wrapper.html()
14-
// The header renders a search form/input
15-
expect(html).toContain('search')
16-
})
17-
18-
it('nav links use invisible instead of hidden to prevent layout shift', async () => {
19-
const wrapper = await mountSuspended(AppHeader, {
20-
route: '/',
21-
})
22-
23-
const html = wrapper.html()
24-
// The nav list should use 'invisible pointer-events-none' (not 'hidden')
25-
// when the search is expanded, to prevent layout shifts
26-
// Verify the nav list element exists at all
27-
const navList = wrapper.find('nav ul, ul[class*="list-none"]')
28-
// When not on a search page and search is not expanded,
29-
// the nav list should be visible (not invisible)
30-
expect(navList.exists() || html.includes('list-none')).toBe(true)
31-
})
32-
336
it('renders the header element', async () => {
34-
const wrapper = await mountSuspended(AppHeader, {
35-
route: '/',
36-
})
37-
7+
const wrapper = await mountSuspended(AppHeader, { route: '/' })
388
expect(wrapper.find('header').exists()).toBe(true)
399
})
4010

11+
it('does not apply z-1 to the nav container (fixes Connect dropdown clipping)', async () => {
12+
const wrapper = await mountSuspended(AppHeader, { route: '/' })
13+
// Regression: z-1 on the nav container caused the package sub-header to render
14+
// above the Connect dropdown. The container must not have z-1.
15+
const nav = wrapper.find('nav')
16+
expect(nav.attributes('class') ?? '').not.toContain('z-1')
17+
})
18+
4119
it('renders logo link when showLogo is true', async () => {
4220
const wrapper = await mountSuspended(AppHeader, {
4321
route: '/package/react',
4422
props: { showLogo: true },
4523
})
46-
47-
// There should be a link to the home page (logo)
4824
const homeLink = wrapper.find('a[href="/"]')
4925
expect(homeLink.exists()).toBe(true)
5026
})

0 commit comments

Comments
 (0)