corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | /* |
2 | The MIT License (MIT) |
||
3 | |||
4 | Copyright (c) 2007-2017 Einar Lielmanis, Liam Newman, and contributors. |
||
5 | |||
6 | Permission is hereby granted, free of charge, to any person |
||
7 | obtaining a copy of this software and associated documentation files |
||
8 | (the "Software"), to deal in the Software without restriction, |
||
9 | including without limitation the rights to use, copy, modify, merge, |
||
10 | publish, distribute, sublicense, and/or sell copies of the Software, |
||
11 | and to permit persons to whom the Software is furnished to do so, |
||
12 | subject to the following conditions: |
||
13 | |||
14 | The above copyright notice and this permission notice shall be |
||
15 | included in all copies or substantial portions of the Software. |
||
16 | |||
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||
20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
||
21 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
||
22 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||
23 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||
24 | SOFTWARE. |
||
25 | */ |
||
26 | |||
27 | exports.test_data = { |
||
28 | default_options: [ |
||
29 | { name: "indent_size", value: "1" }, |
||
30 | { name: "indent_char", value: "'\\t'" }, |
||
31 | { name: "selector_separator_newline", value: "true" }, |
||
32 | { name: "end_with_newline", value: "false" }, |
||
33 | { name: "newline_between_rules", value: "false" }, |
||
34 | { name: "space_around_combinator", value: "false" }, |
||
35 | { name: "preserve_newlines", value: "false" }, |
||
36 | // deprecated |
||
37 | { name: "space_around_selector_separator", value: "false" } |
||
38 | ], |
||
39 | groups: [{ |
||
40 | name: "End With Newline", |
||
41 | description: "", |
||
42 | matrix: [{ |
||
43 | options: [ |
||
44 | { name: "end_with_newline", value: "true" } |
||
45 | ], |
||
46 | eof: '\\n' |
||
47 | }, { |
||
48 | options: [ |
||
49 | { name: "end_with_newline", value: "false" } |
||
50 | ], |
||
51 | eof: '' |
||
52 | }], |
||
53 | tests: [ |
||
54 | { fragment: true, input: '', output: '{{eof}}' }, |
||
55 | { fragment: true, input: ' .tabs{}', output: ' .tabs {}{{eof}}' }, |
||
56 | { fragment: true, input: ' \n\n.tabs{}\n\n\n\n', output: ' .tabs {}{{eof}}' }, |
||
57 | { fragment: true, input: '\n', output: '{{eof}}' } |
||
58 | ], |
||
59 | }, { |
||
60 | name: "Empty braces", |
||
61 | description: "", |
||
62 | tests: [ |
||
63 | { input: '.tabs{}', output: '.tabs {}' }, |
||
64 | { input: '.tabs { }', output: '.tabs {}' }, |
||
65 | { input: '.tabs { }', output: '.tabs {}' }, |
||
66 | // When we support preserving newlines this will need to change |
||
67 | { input: '.tabs \n{\n \n }', output: '.tabs {}' } |
||
68 | ], |
||
69 | }, { |
||
70 | name: "", |
||
71 | description: "", |
||
72 | tests: [{ |
||
73 | input: '#cboxOverlay {\n\tbackground: url(images/overlay.png) repeat 0 0;\n\topacity: 0.9;\n\tfilter: alpha(opacity = 90);\n}', |
||
74 | output: '#cboxOverlay {\n\tbackground: url(images/overlay.png) repeat 0 0;\n\topacity: 0.9;\n\tfilter: alpha(opacity=90);\n}' |
||
75 | }, ], |
||
76 | }, { |
||
77 | name: "Support simple language specific option inheritance/overriding", |
||
78 | description: "Support simple language specific option inheritance/overriding", |
||
79 | matrix: [{ |
||
80 | options: [ |
||
81 | { name: "indent_char", value: "' '" }, |
||
82 | { name: "indent_size", value: "4" }, |
||
83 | { name: "js", value: "{ 'indent_size': 3 }" }, |
||
84 | { name: "css", value: "{ 'indent_size': 5 }" } |
||
85 | ], |
||
86 | c: ' ', |
||
87 | }, |
||
88 | { |
||
89 | options: [ |
||
90 | { name: "indent_char", value: "' '" }, |
||
91 | { name: "indent_size", value: "4" }, |
||
92 | { name: "html", value: "{ 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 5 } }" } |
||
93 | ], |
||
94 | c: ' ' |
||
95 | }, |
||
96 | { |
||
97 | options: [ |
||
98 | { name: "indent_char", value: "' '" }, |
||
99 | { name: "indent_size", value: "9" }, |
||
100 | { name: "html", value: "{ 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 8 }, 'indent_size': 2}" }, |
||
101 | { name: "js", value: "{ 'indent_size': 5 }" }, |
||
102 | { name: "css", value: "{ 'indent_size': 3 }" } |
||
103 | ], |
||
104 | c: ' ' |
||
105 | } |
||
106 | ], |
||
107 | tests: [{ |
||
108 | unchanged: [ |
||
109 | '.selector {', |
||
110 | '{{c}}font-size: 12px;', |
||
111 | '}' |
||
112 | ] |
||
113 | }] |
||
114 | }, { |
||
115 | name: "Space Around Combinator", |
||
116 | description: "", |
||
117 | matrix: [{ |
||
118 | options: [{ name: "space_around_combinator", value: "true" }], |
||
119 | space: ' ' |
||
120 | }, { |
||
121 | options: [{ name: "space_around_combinator", value: "false" }], |
||
122 | space: '' |
||
123 | }, { |
||
124 | // space_around_selector_separator is deprecated, but needs to keep working for now. |
||
125 | options: [{ name: "space_around_selector_separator", value: "true" }], |
||
126 | space: ' ' |
||
127 | }], |
||
128 | tests: [ |
||
129 | { input: 'a>b{}', output: 'a{{space}}>{{space}}b {}' }, |
||
130 | { input: 'a~b{}', output: 'a{{space}}~{{space}}b {}' }, |
||
131 | { input: 'a+b{}', output: 'a{{space}}+{{space}}b {}' }, |
||
132 | { input: 'a+b>c{}', output: 'a{{space}}+{{space}}b{{space}}>{{space}}c {}' }, |
||
133 | { input: 'a > b{}', output: 'a{{space}}>{{space}}b {}' }, |
||
134 | { input: 'a ~ b{}', output: 'a{{space}}~{{space}}b {}' }, |
||
135 | { input: 'a + b{}', output: 'a{{space}}+{{space}}b {}' }, |
||
136 | { input: 'a + b > c{}', output: 'a{{space}}+{{space}}b{{space}}>{{space}}c {}' }, |
||
137 | { |
||
138 | input: 'a > b{width: calc(100% + 45px);}', |
||
139 | output: [ |
||
140 | 'a{{space}}>{{space}}b {', |
||
141 | '\twidth: calc(100% + 45px);', |
||
142 | '}' |
||
143 | ] |
||
144 | }, |
||
145 | { |
||
146 | input: 'a ~ b{width: calc(100% + 45px);}', |
||
147 | output: [ |
||
148 | 'a{{space}}~{{space}}b {', |
||
149 | '\twidth: calc(100% + 45px);', |
||
150 | '}' |
||
151 | ] |
||
152 | }, |
||
153 | { |
||
154 | input: 'a + b{width: calc(100% + 45px);}', |
||
155 | output: [ |
||
156 | 'a{{space}}+{{space}}b {', |
||
157 | '\twidth: calc(100% + 45px);', |
||
158 | '}' |
||
159 | ] |
||
160 | }, |
||
161 | { |
||
162 | input: 'a + b > c{width: calc(100% + 45px);}', |
||
163 | output: [ |
||
164 | 'a{{space}}+{{space}}b{{space}}>{{space}}c {', |
||
165 | '\twidth: calc(100% + 45px);', |
||
166 | '}' |
||
167 | ] |
||
168 | } |
||
169 | ] |
||
170 | }, { |
||
171 | name: 'Selector Separator', |
||
172 | description: '', |
||
173 | matrix: [{ |
||
174 | options: [ |
||
175 | { name: 'selector_separator_newline', value: 'false' }, |
||
176 | { name: 'selector_separator', value: '" "' } |
||
177 | ], |
||
178 | separator: ' ', |
||
179 | separator1: ' ' |
||
180 | }, { |
||
181 | options: [ |
||
182 | { name: 'selector_separator_newline', value: 'false' }, |
||
183 | { name: 'selector_separator', value: '" "' } |
||
184 | ], |
||
185 | // BUG: #713 |
||
186 | separator: ' ', |
||
187 | separator1: ' ' |
||
188 | }, { |
||
189 | options: [ |
||
190 | { name: 'selector_separator_newline', value: 'true' }, |
||
191 | { name: 'selector_separator', value: '" "' } |
||
192 | ], |
||
193 | separator: '\\n', |
||
194 | separator1: '\\n\\t' |
||
195 | }, { |
||
196 | options: [ |
||
197 | { name: 'selector_separator_newline', value: 'true' }, |
||
198 | { name: 'selector_separator', value: '" "' } |
||
199 | ], |
||
200 | separator: '\\n', |
||
201 | separator1: '\\n\\t' |
||
202 | }], |
||
203 | tests: [ |
||
204 | { input: '#bla, #foo{color:green}', output: '#bla,{{separator}}#foo {\n\tcolor: green\n}' }, |
||
205 | { input: '@media print {.tab{}}', output: '@media print {\n\t.tab {}\n}' }, |
||
206 | { input: '@media print {.tab,.bat{}}', output: '@media print {\n\t.tab,{{separator1}}.bat {}\n}' }, |
||
207 | { input: '#bla, #foo{color:black}', output: '#bla,{{separator}}#foo {\n\tcolor: black\n}' }, { |
||
208 | input: 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}', |
||
209 | output: 'a:first-child,{{separator}}a:first-child {\n\tcolor: red;\n\tdiv:first-child,{{separator1}}div:hover {\n\t\tcolor: black;\n\t}\n}' |
||
210 | } |
||
211 | ] |
||
212 | }, { |
||
213 | name: "Preserve Newlines", |
||
214 | description: "", |
||
215 | matrix: [{ |
||
216 | options: [ |
||
217 | { name: "preserve_newlines", value: "true" } |
||
218 | ], |
||
219 | separator_input: '\\n\\n', |
||
220 | separator_output: '\\n\\n', |
||
221 | }, { |
||
222 | options: [ |
||
223 | { name: "preserve_newlines", value: "false" } |
||
224 | ], |
||
225 | separator_input: '\\n\\n', |
||
226 | separator_output: '\\n', |
||
227 | }], |
||
228 | tests: [ |
||
229 | { input: '.div {}{{separator_input}}.span {}', output: '.div {}{{separator_output}}.span {}' }, |
||
230 | { input: '#bla, #foo{\n\tcolor:black;{{separator_input}}\tfont-size: 12px;\n}', output: '#bla,\n#foo {\n\tcolor: black;{{separator_output}}\tfont-size: 12px;\n}' } |
||
231 | ], |
||
232 | }, |
||
233 | { |
||
234 | name: "Preserve Newlines and newline_between_rules", |
||
235 | description: "", |
||
236 | options: [ |
||
237 | { name: "preserve_newlines", value: "true" }, |
||
238 | { name: "newline_between_rules", value: "true" } |
||
239 | ], |
||
240 | tests: [ |
||
241 | { input: '.div {}.span {}', output: '.div {}\n\n.span {}' }, |
||
242 | { input: '#bla, #foo{\n\tcolor:black;\n\tfont-size: 12px;\n}', output: '#bla,\n#foo {\n\tcolor: black;\n\tfont-size: 12px;\n}' }, |
||
243 | { input: '#bla, #foo{\n\tcolor:black;\n\n\n\tfont-size: 12px;\n}', output: '#bla,\n#foo {\n\tcolor: black;\n\n\n\tfont-size: 12px;\n}' }, |
||
244 | { unchanged: '#bla,\n\n#foo {\n\tcolor: black;\n\tfont-size: 12px;\n}' }, |
||
245 | { unchanged: 'a {\n\tb: c;\n\n\n\td: {\n\t\te: f;\n\t}\n}' }, |
||
246 | { unchanged: '.div {}\n\n.span {}' }, |
||
247 | { unchanged: '.div {\n\ta: 1;\n\n\n\tb: 2;\n}\n\n\n\n.span {\n\ta: 1;\n}' }, |
||
248 | { unchanged: '.div {\n\n\n\ta: 1;\n\n\n\tb: 2;\n}\n\n\n\n.span {\n\ta: 1;\n}' }, |
||
249 | { unchanged: '@media screen {\n\t.div {\n\t\ta: 1;\n\n\n\t\tb: 2;\n\t}\n\n\n\n\t.span {\n\t\ta: 1;\n\t}\n}\n\n.div {}\n\n.span {}' }, |
||
250 | ], |
||
251 | }, { |
||
252 | name: "Preserve Newlines and add tabs", |
||
253 | options: [{ name: "preserve_newlines", value: "true" }], |
||
254 | description: "", |
||
255 | tests: [{ |
||
256 | input: '.tool-tip {\n\tposition: relative;\n\n\t\t\n\t.tool-tip-content {\n\t\t&>* {\n\t\t\tmargin-top: 0;\n\t\t}\n\t\t\n\n\t\t.mixin-box-shadow(.2rem .2rem .5rem rgba(0, 0, 0, .15));\n\t\tpadding: 1rem;\n\t\tposition: absolute;\n\t\tz-index: 10;\n\t}\n}', |
||
257 | output: '.tool-tip {\n\tposition: relative;\n\n\n\t.tool-tip-content {\n\t\t&>* {\n\t\t\tmargin-top: 0;\n\t\t}\n\\n\\n\t\t.mixin-box-shadow(.2rem .2rem .5rem rgba(0, 0, 0, .15));\n\t\tpadding: 1rem;\n\t\tposition: absolute;\n\t\tz-index: 10;\n\t}\n}' |
||
258 | }], |
||
259 | }, { |
||
260 | name: "Newline Between Rules", |
||
261 | description: "", |
||
262 | matrix: [{ |
||
263 | options: [ |
||
264 | { name: "newline_between_rules", value: "true" } |
||
265 | ], |
||
266 | separator: '\\n' |
||
267 | }, { |
||
268 | options: [ |
||
269 | { name: "newline_between_rules", value: "false" } |
||
270 | ], |
||
271 | separator: '' |
||
272 | }], |
||
273 | tests: [ |
||
274 | { input: '.div {}\n.span {}', output: '.div {}\n{{separator}}.span {}' }, |
||
275 | { input: '.div{}\n \n.span{}', output: '.div {}\n{{separator}}.span {}' }, |
||
276 | { input: '.div {} \n \n.span { } \n', output: '.div {}\n{{separator}}.span {}' }, |
||
277 | { input: '.div {\n \n} \n .span {\n } ', output: '.div {}\n{{separator}}.span {}' }, |
||
278 | { input: '.selector1 {\n\tmargin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n}\n.div{height:15px;}', output: '.selector1 {\n\tmargin: 0;\n\t/* This is a comment including an url http://domain.com/path/to/file.ext */\n}\n{{separator}}.div {\n\theight: 15px;\n}' }, |
||
279 | { input: '.tabs{width:10px;//end of line comment\nheight:10px;//another\n}\n.div{height:15px;}', output: '.tabs {\n\twidth: 10px; //end of line comment\n\theight: 10px; //another\n}\n{{separator}}.div {\n\theight: 15px;\n}' }, |
||
280 | { input: '#foo {\n\tbackground-image: url(foo@2x.png);\n\t@font-face {\n\t\tfont-family: "Bitstream Vera Serif Bold";\n\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n\t}\n}\n.div{height:15px;}', output: '#foo {\n\tbackground-image: url(foo@2x.png);\n\t@font-face {\n\t\tfont-family: "Bitstream Vera Serif Bold";\n\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n\t}\n}\n{{separator}}.div {\n\theight: 15px;\n}' }, |
||
281 | { input: '@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo@2x.png);\n\t}\n\t@font-face {\n\t\tfont-family: "Bitstream Vera Serif Bold";\n\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n\t}\n}\n.div{height:15px;}', output: '@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo@2x.png);\n\t}\n\t@font-face {\n\t\tfont-family: "Bitstream Vera Serif Bold";\n\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n\t}\n}\n{{separator}}.div {\n\theight: 15px;\n}' }, |
||
282 | { input: '@font-face {\n\tfont-family: "Bitstream Vera Serif Bold";\n\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n}\n@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo.png);\n\t}\n\t@media screen and (min-device-pixel-ratio: 2) {\n\t\t@font-face {\n\t\t\tfont-family: "Helvetica Neue"\n\t\t}\n\t\t#foo:hover {\n\t\t\tbackground-image: url(foo@2x.png);\n\t\t}\n\t}\n}', output: '@font-face {\n\tfont-family: "Bitstream Vera Serif Bold";\n\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n}\n{{separator}}@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo.png);\n\t}\n\t@media screen and (min-device-pixel-ratio: 2) {\n\t\t@font-face {\n\t\t\tfont-family: "Helvetica Neue"\n\t\t}\n\t\t#foo:hover {\n\t\t\tbackground-image: url(foo@2x.png);\n\t\t}\n\t}\n}' }, |
||
283 | { input: 'a:first-child{color:red;div:first-child{color:black;}}\n.div{height:15px;}', output: 'a:first-child {\n\tcolor: red;\n\tdiv:first-child {\n\t\tcolor: black;\n\t}\n}\n{{separator}}.div {\n\theight: 15px;\n}' }, |
||
284 | { input: 'a:first-child{color:red;div:not(.peq){color:black;}}\n.div{height:15px;}', output: 'a:first-child {\n\tcolor: red;\n\tdiv:not(.peq) {\n\t\tcolor: black;\n\t}\n}\n{{separator}}.div {\n\theight: 15px;\n}' }, |
||
285 | ], |
||
286 | }, { |
||
287 | name: "Functions braces", |
||
288 | description: "", |
||
289 | tests: [ |
||
290 | { input: '.tabs(){}', output: '.tabs() {}' }, |
||
291 | { input: '.tabs (){}', output: '.tabs () {}' }, |
||
292 | { input: '.tabs (pa, pa(1,2)), .cols { }', output: '.tabs (pa, pa(1, 2)),\n.cols {}' }, |
||
293 | { input: '.tabs(pa, pa(1,2)), .cols { }', output: '.tabs(pa, pa(1, 2)),\n.cols {}' }, |
||
294 | { input: '.tabs ( ) { }', output: '.tabs () {}' }, |
||
295 | { input: '.tabs( ) { }', output: '.tabs() {}' }, |
||
296 | { input: '.tabs (t, t2) \n{\n key: val(p1 ,p2); \n }', output: '.tabs (t, t2) {\n\tkey: val(p1, p2);\n}' }, |
||
297 | { unchanged: '.box-shadow(@shadow: 0 1px 3px rgba(0, 0, 0, .25)) {\n\t-webkit-box-shadow: @shadow;\n\t-moz-box-shadow: @shadow;\n\tbox-shadow: @shadow;\n}' } |
||
298 | ], |
||
299 | }, { |
||
300 | name: "Comments", |
||
301 | description: "", |
||
302 | tests: [ |
||
303 | { unchanged: '/* test */' }, |
||
304 | { input: '.tabs{/* test */}', output: '.tabs {\n\t/* test */\n}' }, |
||
305 | { input: '.tabs{/* test */}', output: '.tabs {\n\t/* test */\n}' }, |
||
306 | { input: '/* header */.tabs {}', output: '/* header */\n\n.tabs {}' }, |
||
307 | { input: '.tabs {\n/* non-header */\nwidth:10px;}', output: '.tabs {\n\t/* non-header */\n\twidth: 10px;\n}' }, |
||
308 | { unchanged: '/* header' }, |
||
309 | { unchanged: '// comment' }, { |
||
310 | input: '.selector1 {\n\tmargin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n}', |
||
311 | output: '.selector1 {\n\tmargin: 0;\n\t/* This is a comment including an url http://domain.com/path/to/file.ext */\n}' |
||
312 | }, |
||
313 | |||
314 | { |
||
315 | comment: "single line comment support (less/sass)", |
||
316 | input: '.tabs{\n// comment\nwidth:10px;\n}', |
||
317 | output: '.tabs {\n\t// comment\n\twidth: 10px;\n}' |
||
318 | }, |
||
319 | { input: '.tabs{// comment\nwidth:10px;\n}', output: '.tabs {\n\t// comment\n\twidth: 10px;\n}' }, |
||
320 | { input: '//comment\n.tabs{width:10px;}', output: '//comment\n.tabs {\n\twidth: 10px;\n}' }, |
||
321 | { input: '.tabs{//comment\n//2nd single line comment\nwidth:10px;}', output: '.tabs {\n\t//comment\n\t//2nd single line comment\n\twidth: 10px;\n}' }, |
||
322 | { input: '.tabs{width:10px;//end of line comment\n}', output: '.tabs {\n\twidth: 10px; //end of line comment\n}' }, |
||
323 | { input: '.tabs{width:10px;//end of line comment\nheight:10px;}', output: '.tabs {\n\twidth: 10px; //end of line comment\n\theight: 10px;\n}' }, |
||
324 | { input: '.tabs{width:10px;//end of line comment\nheight:10px;//another\n}', output: '.tabs {\n\twidth: 10px; //end of line comment\n\theight: 10px; //another\n}' } |
||
325 | ], |
||
326 | }, { |
||
327 | name: "Handle LESS property name interpolation", |
||
328 | description: "", |
||
329 | tests: [ |
||
330 | { unchanged: 'tag {\n\t@{prop}: none;\n}' }, |
||
331 | { input: 'tag{@{prop}:none;}', output: 'tag {\n\t@{prop}: none;\n}' }, |
||
332 | { input: 'tag{ @{prop}: none;}', output: 'tag {\n\t@{prop}: none;\n}' }, |
||
333 | { |
||
334 | comment: "can also be part of property name", |
||
335 | unchanged: 'tag {\n\tdynamic-@{prop}: none;\n}' |
||
336 | }, |
||
337 | { input: 'tag{dynamic-@{prop}:none;}', output: 'tag {\n\tdynamic-@{prop}: none;\n}' }, |
||
338 | { input: 'tag{ dynamic-@{prop}: none;}', output: 'tag {\n\tdynamic-@{prop}: none;\n}' }, |
||
339 | ], |
||
340 | }, { |
||
341 | name: "Handle LESS property name interpolation, test #631", |
||
342 | description: "", |
||
343 | tests: [ |
||
344 | { unchanged: '.generate-columns(@n, @i: 1) when (@i =< @n) {\n\t.column-@{i} {\n\t\twidth: (@i * 100% / @n);\n\t}\n\t.generate-columns(@n, (@i + 1));\n}' }, |
||
345 | { |
||
346 | input: '.generate-columns(@n,@i:1) when (@i =< @n){.column-@{i}{width:(@i * 100% / @n);}.generate-columns(@n,(@i + 1));}', |
||
347 | output: '.generate-columns(@n, @i: 1) when (@i =< @n) {\n\t.column-@{i} {\n\t\twidth: (@i * 100% / @n);\n\t}\n\t.generate-columns(@n, (@i + 1));\n}' |
||
348 | } |
||
349 | ], |
||
350 | }, { |
||
351 | name: "Psuedo-classes vs Variables", |
||
352 | description: "", |
||
353 | tests: [ |
||
354 | { unchanged: '@page :first {}' }, { |
||
355 | comment: "Assume the colon goes with the @name. If we're in LESS, this is required regardless of the at-string.", |
||
356 | input: '@page:first {}', |
||
357 | output: '@page: first {}' |
||
358 | }, |
||
359 | { unchanged: '@page: first {}' } |
||
360 | ], |
||
361 | }, { |
||
362 | name: "SASS/SCSS", |
||
363 | description: "", |
||
364 | tests: [{ |
||
365 | comment: "Basic Interpolation", |
||
366 | unchanged: 'p {\n\t$font-size: 12px;\n\t$line-height: 30px;\n\tfont: #{$font-size}/#{$line-height};\n}' |
||
367 | }, |
||
368 | { unchanged: 'p.#{$name} {}' }, { |
||
369 | unchanged: [ |
||
370 | '@mixin itemPropertiesCoverItem($items, $margin) {', |
||
371 | '\twidth: calc((100% - ((#{$items} - 1) * #{$margin}rem)) / #{$items});', |
||
372 | '\tmargin: 1.6rem #{$margin}rem 1.6rem 0;', |
||
373 | '}' |
||
374 | ] |
||
375 | }, |
||
376 | { |
||
377 | comment: "Multiple filed issues in LESS due to not(:blah)", |
||
378 | unchanged: '&:first-of-type:not(:last-child) {}' |
||
379 | }, |
||
380 | { |
||
381 | unchanged: [ |
||
382 | 'div {', |
||
383 | '\t&:not(:first-of-type) {', |
||
384 | '\t\tbackground: red;', |
||
385 | '\t}', |
||
386 | '}', |
||
387 | ] |
||
388 | } |
||
389 | |||
390 | ], |
||
391 | }, { |
||
392 | name: "Proper handling of colon in selectors", |
||
393 | description: "Space before a colon in a selector must be preserved, as it means pseudoclass/pseudoelement on any child", |
||
394 | options: [{ name: "selector_separator_newline", value: "false" }], |
||
395 | tests: [ |
||
396 | { unchanged: 'a :b {}' }, |
||
397 | { unchanged: 'a ::b {}' }, |
||
398 | { unchanged: 'a:b {}' }, |
||
399 | { unchanged: 'a::b {}' }, |
||
400 | { |
||
401 | input: 'a {}, a::b {}, a ::b {}, a:b {}, a :b {}', |
||
402 | output: 'a {}\n, a::b {}\n, a ::b {}\n, a:b {}\n, a :b {}' |
||
403 | }, |
||
404 | { |
||
405 | unchanged: [ |
||
406 | '.card-blue ::-webkit-input-placeholder {', |
||
407 | '\tcolor: #87D1FF;', |
||
408 | '}' |
||
409 | ] |
||
410 | }, |
||
411 | { |
||
412 | unchanged: [ |
||
413 | 'div [attr] :not(.class) {', |
||
414 | '\tcolor: red;', |
||
415 | '}' |
||
416 | ] |
||
417 | } |
||
418 | ] |
||
419 | }, { |
||
420 | name: "Regresssion Tests", |
||
421 | description: "General Regression tests for known issues", |
||
422 | options: [{ name: "selector_separator_newline", value: "false" }], |
||
423 | tests: [{ |
||
424 | unchanged: [ |
||
425 | '@media(min-width:768px) {', |
||
426 | '\t.selector::after {', |
||
427 | '\t\t/* property: value */', |
||
428 | '\t}', |
||
429 | '\t.other-selector {', |
||
430 | '\t\t/* property: value */', |
||
431 | '\t}', |
||
432 | '}' |
||
433 | ] |
||
434 | }, { |
||
435 | unchanged: [ |
||
436 | '.fa-rotate-270 {', |
||
437 | '\tfilter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);', |
||
438 | '}' |
||
439 | ] |
||
440 | }] |
||
441 | }, { |
||
442 | |||
443 | } |
||
444 | ] |
||
445 | }; |