diff options
| author | Bertrand Yuan <189593334+bertyuan@users.noreply.github.com> | 2026-03-26 00:19:31 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 00:19:31 +0800 |
| commit | f247a8c4a863ec430f4a705b5c493d652c8429bd (patch) | |
| tree | 71d0985970984c105582f6e3c370b254f38e9bbe /src/lib/utils.test.ts | |
| parent | f7a02fe0e112cf108fc5f22872f1efc077e99fe8 (diff) | |
| parent | cd3c4bc89c169616b38bdb7443bb4eb7571b020c (diff) | |
Merge pull request #12 from bertyuan/fix-vitestv1.1
Fix vitest
Diffstat (limited to 'src/lib/utils.test.ts')
| -rw-r--r-- | src/lib/utils.test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/utils.test.ts b/src/lib/utils.test.ts new file mode 100644 index 0000000..9a61d41 --- /dev/null +++ b/src/lib/utils.test.ts @@ -0,0 +1,21 @@ +import { describe, expect, test } from 'vitest'; +import { cn } from './utils'; + +describe('cn', () => { + test('merges class names and resolves tailwind conflicts', () => { + expect(cn('px-2', 'px-4')).toBe('px-4'); + }); + + test('handles conditional and falsy inputs', () => { + expect(cn('text-sm', false && 'hidden', undefined, 'font-medium')).toBe( + 'text-sm font-medium', + ); + }); + + test('supports object and array style class inputs', () => { + expect( + cn(['inline-flex', ['items-center']], { 'cursor-pointer': true }), + ).toBe('inline-flex items-center cursor-pointer'); + }); +}); + |
