2026-05-12 09:43:02 +03:00
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
|
import StatusPill from '../../resources/js/components/ui/StatusPill.vue';
|
|
|
|
|
|
|
|
|
|
describe('StatusPill', () => {
|
|
|
|
|
it('renders label text', () => {
|
|
|
|
|
const w = mount(StatusPill, { props: { slug: 'new', label: 'Новый' } });
|
|
|
|
|
expect(w.text()).toContain('Новый');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('falls back to slug when label not provided', () => {
|
|
|
|
|
const w = mount(StatusPill, { props: { slug: 'in_progress' } });
|
|
|
|
|
expect(w.text()).toContain('in_progress');
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-12 20:23:51 +03:00
|
|
|
it.each(['new', 'in_progress', 'won', 'archived', 'cancelled'])('applies correct background for %s', (slug) => {
|
|
|
|
|
const w = mount(StatusPill, { props: { slug } });
|
|
|
|
|
const style = w.attributes('style') ?? '';
|
|
|
|
|
expect(style).toContain('background');
|
|
|
|
|
expect(style).toContain('color');
|
|
|
|
|
});
|
2026-05-12 09:43:02 +03:00
|
|
|
|
|
|
|
|
it('cancelled slug applies line-through', () => {
|
|
|
|
|
const w = mount(StatusPill, { props: { slug: 'cancelled' } });
|
|
|
|
|
expect(w.attributes('style') ?? '').toContain('line-through');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('won slug applies font-weight: 600', () => {
|
|
|
|
|
const w = mount(StatusPill, { props: { slug: 'won' } });
|
|
|
|
|
expect(w.attributes('style') ?? '').toMatch(/font-weight:\s*600/);
|
|
|
|
|
});
|
|
|
|
|
});
|