Files
portal/app/tests/Frontend/DealDetailDrawer.spec.ts
T
Дмитрий f94552d452 WIP чекпойнт: lead-region/supplier бэкенд + фронт-редизайн + Pint + тесты
92 файла одной пачкой. Исключены чужие зоны: CLAUDE.md, .claude/settings.json, docs/observer/.pii-counters.json.
gitleaks staged: no leaks found. Не верифицировано тестами - сохранение труда в историю.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 05:17:12 +03:00

54 lines
1.8 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import { createVuetify } from 'vuetify';
import { createPinia, setActivePinia } from 'pinia';
import DealDetailDrawer from '../../resources/js/components/deals/DealDetailDrawer.vue';
import type { MockDeal } from '../../resources/js/composables/mockDeals';
const vuetify = createVuetify();
const deal: MockDeal = {
id: 1,
name: '+7 999',
phone: '+7 999',
statusSlug: 'new',
project: 'Окна',
manager: { initials: 'AD', name: 'Admin' },
cost: 0,
receivedMinutesAgo: 5,
};
function mountDrawer(props: Record<string, unknown>) {
const pinia = createPinia();
setActivePinia(pinia);
return mount(DealDetailDrawer, {
props: { open: true, deal, ...props },
global: {
plugins: [vuetify, pinia],
stubs: {
DealDetailBody: true,
VNavigationDrawer: {
template: '<div class="drawer-stub" v-if="modelValue"><slot /></div>',
props: ['modelValue'],
},
},
},
});
}
describe('DealDetailDrawer wrapper', () => {
it('inline=true рендерит <aside> (master-detail панель)', () => {
const w = mountDrawer({ inline: true });
expect(w.find('aside.deal-detail-inline').exists()).toBe(true);
});
it('inline=false (по умолчанию) рендерит overlay v-navigation-drawer', () => {
const w = mountDrawer({});
expect(w.find('aside.deal-detail-inline').exists()).toBe(false);
});
it('inline-панель содержит DealDetailBody', () => {
const w = mountDrawer({ inline: true });
expect(w.findComponent({ name: 'DealDetailBody' }).exists()).toBe(true);
});
});