OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library extend_test; | 5 library extend_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'testing.dart'; | 8 import 'testing.dart'; |
9 | 9 |
10 var options = ['--warnings_as_errors', '--no-colors', 'memory']; | 10 var options = ['--warnings_as_errors', '--no-colors', 'memory']; |
11 | 11 |
12 compileAndValidate(String input, String generated) { | 12 compileAndValidate(String input, String generated) { |
13 var errors = []; | 13 var errors = []; |
14 var stylesheet = compileCss(input, errors: errors, opts: options); | 14 var stylesheet = compileCss(input, errors: errors, opts: options); |
15 expect(stylesheet != null, true); | 15 expect(stylesheet != null, true); |
16 expect(errors.isEmpty, true, reason: errors.toString()); | 16 expect(errors.isEmpty, true, reason: errors.toString()); |
17 expect(prettyPrint(stylesheet), generated); | 17 expect(prettyPrint(stylesheet), generated); |
18 } | 18 } |
19 | 19 |
20 void simpleExtend() { | 20 void simpleExtend() { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // } | 208 // } |
209 compileAndValidate(r''' | 209 compileAndValidate(r''' |
210 .btn + .btn { | 210 .btn + .btn { |
211 margin-left: 5px; | 211 margin-left: 5px; |
212 } | 212 } |
213 input.second + label { | 213 input.second + label { |
214 @extend .btn; | 214 @extend .btn; |
215 color: blue; | 215 color: blue; |
216 } | 216 } |
217 ''', '.btn + .btn, ' | 217 ''', '.btn + .btn, ' |
218 'input.second + label + .btn, ' | 218 'input.second + label + .btn, ' |
219 '.btn + input.second + label, ' | 219 '.btn + input.second + label, ' |
220 'input.second + label + input.second + label, ' | 220 'input.second + label + input.second + label, ' |
221 'input.second + label + input.second + label {\n' | 221 'input.second + label + input.second + label {\n' |
222 ' margin-left: 5px;\n}\n' | 222 ' margin-left: 5px;\n}\n' |
223 'input.second + label {\n' | 223 'input.second + label {\n' |
224 ' color: #00f;\n}'); | 224 ' color: #00f;\n}'); |
225 } | 225 } |
226 | 226 |
227 main() { | 227 main() { |
228 test("Simple Extend", simpleExtend); | 228 test("Simple Extend", simpleExtend); |
229 test("complex", complexSelectors); | 229 test("complex", complexSelectors); |
230 test("multiple", multipleExtends); | 230 test("multiple", multipleExtends); |
231 test("chaining", chaining); | 231 test("chaining", chaining); |
232 test("nested selectors", nestedSelectors); | 232 test("nested selectors", nestedSelectors); |
233 test("nested many selector sequences", nestedMulty); | 233 test("nested many selector sequences", nestedMulty); |
234 test("N-way extends", nWayExtends); | 234 test("N-way extends", nWayExtends); |
235 } | 235 } |
OLD | NEW |