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:csslib/src/messages.dart'; | 7 import 'package:csslib/src/messages.dart'; |
8 import 'package:csslib/visitor.dart'; | 8 import 'package:csslib/visitor.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 s = parseCss(in1, errors: errors..clear(), opts: simpleOptions); | 54 s = parseCss(in1, errors: errors..clear(), opts: simpleOptions); |
55 | 55 |
56 expect(s != null, true); | 56 expect(s != null, true); |
57 expect(errors.isEmpty, true, reason: errors.toString()); | 57 expect(errors.isEmpty, true, reason: errors.toString()); |
58 | 58 |
59 clsVisits = new ClassVisitor(['foobar1', 'xyzzy', 'foo', 'hello']) | 59 clsVisits = new ClassVisitor(['foobar1', 'xyzzy', 'foo', 'hello']) |
60 ..visitTree(s); | 60 ..visitTree(s); |
61 expect(clsVisits.matches, true); | 61 expect(clsVisits.matches, true); |
62 | 62 |
63 expect( | 63 expect(prettyPrint(s), r''' |
64 prettyPrint(s), | |
65 r''' | |
66 .foobar1 { | 64 .foobar1 { |
67 } | 65 } |
68 .xyzzy .foo #my-div { | 66 .xyzzy .foo #my-div { |
69 color: #f00; | 67 color: #f00; |
70 } | 68 } |
71 div.hello { | 69 div.hello { |
72 font: arial; | 70 font: arial; |
73 }'''); | 71 }'''); |
74 } | 72 } |
75 | 73 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 expect(errors.isEmpty, true, reason: errors.toString()); | 105 expect(errors.isEmpty, true, reason: errors.toString()); |
108 | 106 |
109 final emitted = polyfillPrint('myComponent', s); | 107 final emitted = polyfillPrint('myComponent', s); |
110 expect(emitted, generated); | 108 expect(emitted, generated); |
111 } | 109 } |
112 | 110 |
113 main() { | 111 main() { |
114 test('Class Visitors', testClassVisitors); | 112 test('Class Visitors', testClassVisitors); |
115 test('Polyfill', testPolyFill); | 113 test('Polyfill', testPolyFill); |
116 } | 114 } |
OLD | NEW |