forked from dcastil/tailwind-merge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
separators.test.ts
37 lines (26 loc) · 1.1 KB
/
separators.test.ts
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
29
30
31
32
33
34
35
36
37
import { expect, test } from 'vitest'
import { extendTailwindMerge } from '../src'
test('single character separator working correctly', () => {
const twMerge = extendTailwindMerge({
separator: '_',
})
expect(twMerge('block hidden')).toBe('hidden')
expect(twMerge('p-3 p-2')).toBe('p-2')
expect(twMerge('!right-0 !inset-0')).toBe('!inset-0')
expect(twMerge('hover_focus_!right-0 focus_hover_!inset-0')).toBe('focus_hover_!inset-0')
expect(twMerge('hover:focus:!right-0 focus:hover:!inset-0')).toBe(
'hover:focus:!right-0 focus:hover:!inset-0',
)
})
test('multiple character separator working correctly', () => {
const twMerge = extendTailwindMerge({
separator: '__',
})
expect(twMerge('block hidden')).toBe('hidden')
expect(twMerge('p-3 p-2')).toBe('p-2')
expect(twMerge('!right-0 !inset-0')).toBe('!inset-0')
expect(twMerge('hover__focus__!right-0 focus__hover__!inset-0')).toBe('focus__hover__!inset-0')
expect(twMerge('hover:focus:!right-0 focus:hover:!inset-0')).toBe(
'hover:focus:!right-0 focus:hover:!inset-0',
)
})