kin/web/frontend/src/__tests__/app-layout.test.ts

56 lines
1.8 KiB
TypeScript
Raw Normal View History

/**
* KIN-075: Тест полной ширины экрана
* Проверяет что App.vue не ограничивает ширину контента нет max-w-* на <main>
*/
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { mount, flushPromises } from '@vue/test-utils'
import { createRouter, createMemoryHistory } from 'vue-router'
import App from '../App.vue'
vi.mock('../components/EscalationBanner.vue', () => ({
default: { template: '<div />' },
}))
function makeRouter() {
return createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/', component: { template: '<div>home</div>' } },
{ path: '/settings', component: { template: '<div>settings</div>' } },
],
})
}
beforeEach(() => {
vi.clearAllMocks()
})
describe('KIN-075: App.vue — полная ширина экрана', () => {
it('<main> не содержит класс max-w-* — контент не ограничен по ширине', async () => {
const router = makeRouter()
await router.push('/')
const wrapper = mount(App, { global: { plugins: [router] } })
await flushPromises()
const main = wrapper.find('main')
expect(main.exists(), '<main> должен существовать в App.vue').toBe(true)
expect(
main.classes().some(c => c.startsWith('max-w-')),
'<main> не должен иметь ограничивающий класс max-w-*',
).toBe(false)
})
it('<main> не содержит класс max-w-6xl (регрессия KIN-075)', async () => {
const router = makeRouter()
await router.push('/')
const wrapper = mount(App, { global: { plugins: [router] } })
await flushPromises()
const main = wrapper.find('main')
expect(main.classes()).not.toContain('max-w-6xl')
})
})