forked from postcss/postcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.test.js
43 lines (33 loc) · 1.06 KB
/
list.test.js
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
38
39
40
41
42
43
let list = require('../lib/list')
it('space() splits list by spaces', () => {
expect(list.space('a b')).toEqual(['a', 'b'])
})
it('space() trims values', () => {
expect(list.space(' a b ')).toEqual(['a', 'b'])
})
it('space() checks quotes', () => {
expect(list.space('"a b\\"" \'\'')).toEqual(['"a b\\""', '\'\''])
})
it('space() checks functions', () => {
expect(list.space('f( )) a( () )')).toEqual(['f( ))', 'a( () )'])
})
it('space() works from variable', () => {
let space = list.space
expect(space('a b')).toEqual(['a', 'b'])
})
it('comma() splits list by spaces', () => {
expect(list.comma('a, b')).toEqual(['a', 'b'])
})
it('comma() adds last empty', () => {
expect(list.comma('a, b,')).toEqual(['a', 'b', ''])
})
it('comma() checks quotes', () => {
expect(list.comma('"a,b\\"", \'\'')).toEqual(['"a,b\\""', '\'\''])
})
it('comma() checks functions', () => {
expect(list.comma('f(,)), a(,(),)')).toEqual(['f(,))', 'a(,(),)'])
})
it('comma() works from variable', () => {
let comma = list.comma
expect(comma('a, b')).toEqual(['a', 'b'])
})