Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: utils/tests/css/src/DeclarationTest.dart

Issue 9695048: Template parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Siggi's comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/template/world.dart ('k') | utils/tests/css/src/ExpressionTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #import("../../../css/css.dart"); 5 #import("../../../css/css.dart");
6 #import('../../../../frog/lang.dart', prefix:'lang');
7 6
8 class DeclarationTest { 7 class DeclarationTest {
9 8
10 static testMain() { 9 static testMain() {
11 initCssWorld(); 10 initCssWorld();
12 11
13 testSimpleTerms(); 12 testSimpleTerms();
14 testMoreDecls(); 13 testMoreDecls();
15 testIdentifiers(); 14 testIdentifiers();
16 testComposites(); 15 testComposites();
(...skipping 22 matching lines...) Expand all
39 " height: 22mm !important;\n" + 38 " height: 22mm !important;\n" +
40 " border-width: 20cm;\n" + 39 " border-width: 20cm;\n" +
41 " margin-width: 33%;\n" + 40 " margin-width: 33%;\n" +
42 " border-height: 30em;\n" + 41 " border-height: 30em;\n" +
43 " width: .6in;\n" + // Check double values. 42 " width: .6in;\n" + // Check double values.
44 " length: 1.2in;\n" + 43 " length: 1.2in;\n" +
45 " -web-stuff: -10px;\n" + 44 " -web-stuff: -10px;\n" +
46 "}\n"; 45 "}\n";
47 46
48 Parser parser = 47 Parser parser =
49 new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE, input)); 48 new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE, input));
50 49
51 Stylesheet stylesheet = parser.parse(); 50 Stylesheet stylesheet = parser.parse();
52 Expect.isNotNull(stylesheet); 51 Expect.isNotNull(stylesheet);
53 52
54 Expect.equals(generated, stylesheet.toString()); 53 Expect.equals(generated, stylesheet.toString());
55 } 54 }
56 55
57 static void testMoreDecls() { 56 static void testMoreDecls() {
58 final String input = 57 final String input =
59 ".more {\n" + 58 ".more {\n" +
(...skipping 13 matching lines...) Expand all
73 " color: #aabbcc;\n" + 72 " color: #aabbcc;\n" +
74 " color: #ff;\n" + 73 " color: #ff;\n" +
75 " background-image: url(http://test.jpeg);\n" + 74 " background-image: url(http://test.jpeg);\n" +
76 " background-image: url(http://double_quote.html);\n" + 75 " background-image: url(http://double_quote.html);\n" +
77 " background-image: url(http://single_quote.html);\n" + 76 " background-image: url(http://single_quote.html);\n" +
78 " color: rgba(10, 20, 255);\n" + 77 " color: rgba(10, 20, 255);\n" +
79 " color: #123aef;\n" + 78 " color: #123aef;\n" +
80 "}\n"; 79 "}\n";
81 80
82 Parser parser = 81 Parser parser =
83 new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE, input)); 82 new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE, input));
84 83
85 Stylesheet stylesheet = parser.parse(); 84 Stylesheet stylesheet = parser.parse();
86 Expect.isNotNull(stylesheet); 85 Expect.isNotNull(stylesheet);
87 86
88 Expect.equals(generated, stylesheet.toString()); 87 Expect.equals(generated, stylesheet.toString());
89 } 88 }
90 89
91 static void testIdentifiers() { 90 static void testIdentifiers() {
92 final String input = 91 final String input =
93 // Make sure identifiers that could look like hex are handled. 92 // Make sure identifiers that could look like hex are handled.
(...skipping 10 matching lines...) Expand all
104 "#da {\n" + 103 "#da {\n" +
105 " height: 100px;\n" + 104 " height: 100px;\n" +
106 "}\n" + 105 "}\n" +
107 "\n" + 106 "\n" +
108 "#-foo {\n" + 107 "#-foo {\n" +
109 " width: 10px;\n" + 108 " width: 10px;\n" +
110 " color: #ff00cc;\n" + 109 " color: #ff00cc;\n" +
111 "}\n"; 110 "}\n";
112 111
113 Parser parser = 112 Parser parser =
114 new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE, input)); 113 new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE, input));
115 114
116 Stylesheet stylesheet = parser.parse(); 115 Stylesheet stylesheet = parser.parse();
117 Expect.isNotNull(stylesheet); 116 Expect.isNotNull(stylesheet);
118 117
119 Expect.equals(generated, stylesheet.toString()); 118 Expect.equals(generated, stylesheet.toString());
120 } 119 }
121 120
122 static void testComposites() { 121 static void testComposites() {
123 final String input = 122 final String input =
124 // Composites 123 // Composites
(...skipping 11 matching lines...) Expand all
136 ".xyzzy {\n" + 135 ".xyzzy {\n" +
137 " border: 10px 80px 90px 100px;\n" + 136 " border: 10px 80px 90px 100px;\n" +
138 " width: 99%;\n" + 137 " width: 99%;\n" +
139 "}\n" + 138 "}\n" +
140 "@-webkit-keyframes pulsate {\n" + 139 "@-webkit-keyframes pulsate {\n" +
141 " 0% {\n" + 140 " 0% {\n" +
142 " -webkit-transform: translate3d(0, 0, 0) scale(1.0);\n" + 141 " -webkit-transform: translate3d(0, 0, 0) scale(1.0);\n" +
143 " }\n" + 142 " }\n" +
144 "}\n"; 143 "}\n";
145 Parser parser = 144 Parser parser =
146 new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE, input)); 145 new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE, input));
147 146
148 Stylesheet stylesheet = parser.parse(); 147 Stylesheet stylesheet = parser.parse();
149 Expect.isNotNull(stylesheet); 148 Expect.isNotNull(stylesheet);
150 149
151 Expect.equals(generated, stylesheet.toString()); 150 Expect.equals(generated, stylesheet.toString());
152 } 151 }
153 152
154 static void testNewerCss() { 153 static void testNewerCss() {
155 final String input = 154 final String input =
156 // Newer things in CSS 155 // Newer things in CSS
(...skipping 19 matching lines...) Expand all
176 "@page : test {\n" + 175 "@page : test {\n" +
177 " width: 10px;\n" + 176 " width: 10px;\n" +
178 "\n" + 177 "\n" +
179 "}\n" + 178 "}\n" +
180 "@page {\n" + 179 "@page {\n" +
181 " height: 22px;\n" + 180 " height: 22px;\n" +
182 "\n" + 181 "\n" +
183 "}\n"; 182 "}\n";
184 183
185 Parser parser = 184 Parser parser =
186 new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE, input)); 185 new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE, input));
187 186
188 Stylesheet stylesheet = parser.parse(); 187 Stylesheet stylesheet = parser.parse();
189 Expect.isNotNull(stylesheet); 188 Expect.isNotNull(stylesheet);
190 189
191 Expect.equals(generated, stylesheet.toString()); 190 Expect.equals(generated, stylesheet.toString());
192 } 191 }
193 192
194 static void testCssFile() { 193 static void testCssFile() {
195 final String scss = 194 final String scss =
196 "@import 'simple.css'\n" + 195 "@import 'simple.css'\n" +
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 " 30% {\n" + 234 " 30% {\n" +
236 " -webkit-transform: translate3d(0, 2, 0) scale(1.0);\n" + 235 " -webkit-transform: translate3d(0, 2, 0) scale(1.0);\n" +
237 " }\n" + 236 " }\n" +
238 "}\n" + 237 "}\n" +
239 "\n" + 238 "\n" +
240 ".foobar {\n" + 239 ".foobar {\n" +
241 " grid-columns: 10px (\"content\" 1fr 10px) [4];\n" + 240 " grid-columns: 10px (\"content\" 1fr 10px) [4];\n" +
242 "}\n"; 241 "}\n";
243 242
244 Parser parser = 243 Parser parser =
245 new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE, scss)); 244 new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE, scss));
246 245
247 Stylesheet stylesheet = parser.parse(); 246 Stylesheet stylesheet = parser.parse();
248 Expect.isNotNull(stylesheet); 247 Expect.isNotNull(stylesheet);
249 248
250 Expect.equals(generated, stylesheet.toString()); 249 Expect.equals(generated, stylesheet.toString());
251 } 250 }
252 } 251 }
253 252
254 main() { 253 main() {
255 DeclarationTest.testMain(); 254 DeclarationTest.testMain();
256 } 255 }
OLDNEW
« no previous file with comments | « utils/template/world.dart ('k') | utils/tests/css/src/ExpressionTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698