This repository was archived by the owner on Aug 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
146 lines (138 loc) · 3.38 KB
/
index.test.js
File metadata and controls
146 lines (138 loc) · 3.38 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
var postcss = require('postcss');
var plugin = require('./');
const expectEqual = (input, output, opts) => {
return postcss([ plugin(opts) ]).process(input)
.then(result => {
expect(result.decl_order).toEqual(output)
})
}
/* Test cases */
it('Nomral style', () => {
const expected = {
'.normal_style': [
'position',
'z-index',
'top',
'left',
'display',
'overflow',
'width',
'height',
'border-radius',
'margin-bottom',
'background'
]
};
return expectEqual(
`.normal_style {
border-radius: 100%;
display: block;
background: #000;
position: absolute;
margin-bottom: 0;
z-index: 9999;
top: 0;
left: 0;
overflow: scroll;
width: 100%;
height: 100%;
}`,
expected,
{ throwValidateErrors: false }
);
});
it('Prefixed style', () => {
const expected = {
'.prefixed': [
'display',
'justify-content',
'align-items',
'background',
'color',
'text-align',
'text-decoration',
'text-transform'
]
};
return expectEqual(
`.prefixed {
color: #333;
background: #fff;
text-align: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
text-decoration: unerline;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-transform: uppercase;
}`,
expected,
{ throwValidateErrors: false }
);
});
it('Style with @media', () => {
const expected = {
'.responsive_style_768px': [
'display',
'width',
'height',
'background',
'text-decoration'
]
};
return expectEqual(
`@media (min-width: 768px) {
.responsive_style_768px {
background: #000;
width: 200px;
-webkit-apperance: none;
display: block;
text-decoration: none;
height: 40px;
}
}`,
expected,
{ throwValidateErrors: false }
);
});
it('Nested style', () => {
const expected = {
'.nested_children': [
'display',
'width',
'padding',
'color'
],
'.nested_children_child': [
'position',
'border-radius',
'margin',
'background'
]
};
return expectEqual(
`.nested_style {
display: flex;
align-items: center;
background: #fff;
color: #333;
.nested_children {
padding: 0 15px;
color: #000;
display: block;
width: 50%;
.nested_children_child {
margin: 0 -15px;
position: absolute;
background: #000;
border-radius: 100%;
}
}
}`,
expected,
{ throwValidateErrors: false }
);
});