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 visitor_test; | 5 library visitor_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:csslib/visitor.dart'; | 8 import 'package:csslib/visitor.dart'; |
9 import 'testing.dart'; | 9 import 'testing.dart'; |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 var clsVisits = new ClassVisitor(['foobar'])..visitTree(s); | 43 var clsVisits = new ClassVisitor(['foobar'])..visitTree(s); |
44 expect(clsVisits.matches, true); | 44 expect(clsVisits.matches, true); |
45 | 45 |
46 in1 = ''' | 46 in1 = ''' |
47 .foobar1 { } | 47 .foobar1 { } |
48 .xyzzy .foo #my-div { color: red; } | 48 .xyzzy .foo #my-div { color: red; } |
49 div.hello { font: arial; } | 49 div.hello { font: arial; } |
50 '''; | 50 '''; |
51 | 51 |
52 s = parseCss(in1, errors: errors..clear(), opts: ['--no-colors', 'memory']); | 52 s = parseCss(in1, errors: errors..clear(), opts: simpleOptions); |
53 | 53 |
54 expect(s != null, true); | 54 expect(s != null, true); |
55 expect(errors.isEmpty, true, reason: errors.toString()); | 55 expect(errors.isEmpty, true, reason: errors.toString()); |
56 | 56 |
57 clsVisits = new ClassVisitor(['foobar1', 'xyzzy', 'foo', 'hello']) | 57 clsVisits = new ClassVisitor(['foobar1', 'xyzzy', 'foo', 'hello']) |
58 ..visitTree(s); | 58 ..visitTree(s); |
59 expect(clsVisits.matches, true); | 59 expect(clsVisits.matches, true); |
60 | 60 |
61 expect(prettyPrint(s), r''' | 61 expect(prettyPrint(s), r''' |
62 .foobar1 { | 62 .foobar1 { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 expect(errors.isEmpty, true, reason: errors.toString()); | 103 expect(errors.isEmpty, true, reason: errors.toString()); |
104 | 104 |
105 final emitted = polyfillPrint('myComponent', s); | 105 final emitted = polyfillPrint('myComponent', s); |
106 expect(emitted, generated); | 106 expect(emitted, generated); |
107 } | 107 } |
108 | 108 |
109 main() { | 109 main() { |
110 test('Class Visitors', testClassVisitors); | 110 test('Class Visitors', testClassVisitors); |
111 test('Polyfill', testPolyFill); | 111 test('Polyfill', testPolyFill); |
112 } | 112 } |
OLD | NEW |