ray-template/__test__/layout/mobile-search.spec.ts
XiaoDaiGua-Ray 403fdd589a feat!: rebuild Ray Template as a monorepo
Share workspace packages between Ray Admin and the interactive docs.

BREAKING CHANGE: v6 is a new major line. v5 stays on legacy/v5.
2026-11-04 14:01:28 +08:00

24 lines
738 B
TypeScript

import { mount } from '@vue/test-utils'
import GlobalSearch from '../../apps/admin/src/layout/components/Search/GlobalSearch'
import { router } from '../../apps/admin/src/router'
import setupMiniApp from '../utils/setupMiniApp'
it('mounts the header search on a narrow viewport and closes it immediately', async () => {
vi.stubGlobal('innerWidth', 390)
const { app } = await setupMiniApp()
try {
const wrapper = mount(GlobalSearch, {
props: { show: true },
global: { plugins: [router] },
})
expect(wrapper.emitted('update:show')).toContainEqual([false])
expect(wrapper.find('.global-search').exists()).toBe(false)
wrapper.unmount()
} finally {
app.unmount()
vi.unstubAllGlobals()
}
})