summaryrefslogtreecommitdiff
path: root/src/components/ui/button-variants.test.ts
blob: 5090703978c4e222da54da366cb750abf5e54e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { describe, expect, test } from 'vitest';
import { buttonVariants } from './button';

describe('buttonVariants', () => {
  test('returns default variant and size classes when no args are provided', () => {
    const classes = buttonVariants();

    expect(classes).toContain('bg-primary');
    expect(classes).toContain('h-9');
  });

  test('returns destructive and icon classes for explicit options', () => {
    const classes = buttonVariants({
      variant: 'destructive',
      size: 'icon',
    });

    expect(classes).toContain('bg-destructive');
    expect(classes).toContain('size-9');
  });

  test('includes caller-provided className', () => {
    const classes = buttonVariants({ className: 'w-full' });

    expect(classes).toContain('w-full');
  });
});