23 lines
522 B
TypeScript
23 lines
522 B
TypeScript
|
|
import { describe, it, expect } from 'vitest'
|
||
|
|
import { cn } from './utils'
|
||
|
|
|
||
|
|
describe('cn utility', () => {
|
||
|
|
it('should merge class names', () => {
|
||
|
|
expect(cn('foo', 'bar')).toBe('foo bar')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('should handle conditional classes', () => {
|
||
|
|
expect(cn('foo', false && 'bar', 'baz')).toBe('foo baz')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('should merge Tailwind classes correctly', () => {
|
||
|
|
expect(cn('p-4 p-2')).toBe('p-2')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('should handle empty inputs', () => {
|
||
|
|
expect(cn()).toBe('')
|
||
|
|
expect(cn('')).toBe('')
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|