fix: fix indentation, export ClassValue, add object-syntax test

This commit is contained in:
Ilia Mashkov
2026-04-18 15:52:05 +03:00
parent f4c95d5ea6
commit db2d7b78dd
3 changed files with 8 additions and 1 deletions
+6
View File
@@ -22,6 +22,12 @@ describe('cn', () => {
}) })
}) })
describe('object syntax', () => {
it('includes classes with truthy object values', () => {
expect(cn({ foo: true, bar: false })).toBe('foo')
})
})
describe('tailwind conflict resolution', () => { describe('tailwind conflict resolution', () => {
it('last padding wins', () => { it('last padding wins', () => {
expect(cn('px-2', 'px-4')).toBe('px-4') expect(cn('px-2', 'px-4')).toBe('px-4')
+1 -1
View File
@@ -5,5 +5,5 @@ import { twMerge } from 'tailwind-merge'
* Merges Tailwind classes, resolving conflicts in favor of the last value. * Merges Tailwind classes, resolving conflicts in favor of the last value.
*/ */
export function cn(...inputs: ClassValue[]): string { export function cn(...inputs: ClassValue[]): string {
return twMerge(clsx(inputs)) return twMerge(clsx(inputs))
} }
+1
View File
@@ -1 +1,2 @@
export { cn } from './cn' export { cn } from './cn'
export type { ClassValue } from 'clsx'