forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefineClass.test.js
More file actions
27 lines (23 loc) · 936 Bytes
/
defineClass.test.js
File metadata and controls
27 lines (23 loc) · 936 Bytes
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
import c from '../src/util/collapseWhitespace'
import defineClass from '../src/util/defineClass'
/**
* Tests
*/
it('creates a proper single-word class with rules', () => {
let output = defineClass('flex', { display: 'flex' })
expect(c(output.toString())).toEqual(`.flex { display: flex }`)
})
it('does not modify the case of selector names', () => {
let output = defineClass('inlineBlock', { display: 'inline-block' })
expect(c(output.toString())).toEqual(`.inlineBlock { display: inline-block }`)
})
it('does not modify the case of property names', () => {
let output = defineClass('smooth', {
'-webkit-font-smoothing': 'antialiased',
})
expect(c(output.toString())).toEqual(`.smooth { -webkit-font-smoothing: antialiased }`)
})
it('escapes non-standard characters in selectors', () => {
let output = defineClass('w-1/4', { width: '25%' })
expect(c(output.toString())).toEqual(`.w-1\\/4 { width: 25% }`)
})