code: utils,nextjs,frontends (1 files)

This commit is contained in:
2025-12-25 20:53:11 +00:00
parent 381eda32c1
commit 66bb415342

View File

@@ -3,12 +3,13 @@ import { cn } from '@/lib/utils'
describe('utils', () => {
describe('cn', () => {
// Note: cn() uses clsx, which concatenates classes without smart Tailwind merging
it.each([
{
input: ['px-2 py-1', 'px-3'],
shouldContain: ['py-1', 'px-3'],
shouldNotContain: ['px-2'],
description: 'merge conflicting tailwind classes',
shouldContain: ['px-2', 'py-1', 'px-3'],
shouldNotContain: [] as string[],
description: 'concatenate classes (no tailwind deduplication)',
},
{
input: ['px-2', 'py-2'],
@@ -24,9 +25,9 @@ describe('utils', () => {
},
{
input: ['px-2 py-1 bg-red-500', 'px-3 bg-blue-500'],
shouldContain: ['px-3', 'py-1', 'bg-blue-500'],
shouldNotContain: ['px-2', 'bg-red-500'],
description: 'merge tailwind classes with proper precedence',
shouldContain: ['px-2', 'px-3', 'py-1', 'bg-red-500', 'bg-blue-500'],
shouldNotContain: [] as string[],
description: 'concatenate all classes (no tailwind deduplication)',
},
{
input: ['px-2', undefined, null, 'py-1'],