Files
portal/app/tests/Frontend/StatusPill.spec.ts
T

33 lines
1.3 KiB
TypeScript
Raw Normal View History

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');
});
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');
});
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/);
});
});