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

Unified Diff: pkg/csslib/test/compiler_test.dart

Issue 23576012: Added .scss transform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: cleanup Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: pkg/csslib/test/compiler_test.dart
diff --git a/pkg/csslib/test/compiler_test.dart b/pkg/csslib/test/compiler_test.dart
index f545a6d308bfaee26e444c8ca080c72544100aed..1ad32e7b355ef2779eced5ddf8ea4cc000b14c8f 100644
--- a/pkg/csslib/test/compiler_test.dart
+++ b/pkg/csslib/test/compiler_test.dart
@@ -10,6 +10,35 @@ import 'package:csslib/parser.dart';
import 'package:csslib/visitor.dart';
import 'testing.dart';
+/** Test List<int> as input to parser. */
+void testArrayOfChars() {
+ var errors = [];
+ var input = '<![CDATA[.foo { '
+ 'color: red; left: 20px; top: 20px; width: 100px; height:200px'
+ '}'
+ '#div {'
+ 'color : #00F578; border-color: #878787;'
+ '}]]>';
+
+ var stylesheet = parse(UTF8.encode(input), errors: errors);
+
+ expect(stylesheet != null, true);
+ expect(errors.isEmpty, true, reason: errors.toString());
+
+ expect(prettyPrint(stylesheet), r'''
+.foo {
+ color: #f00;
+ left: 20px;
+ top: 20px;
+ width: 100px;
+ height: 200px;
+}
+#div {
+ color: #00F578;
+ border-color: #878787;
+}''');
+}
+
void testClass() {
var errors = [];
var input = ".foobar {}";
@@ -511,204 +540,6 @@ void testWildcard() {
expect("foobar", simpleSelector1.name);
}
-/** Test List<int> as input to parser. */
-void testArrayOfChars() {
- var errors = [];
- var input = '<![CDATA[.foo { '
- 'color: red; left: 20px; top: 20px; width: 100px; height:200px'
- '}'
- '#div {'
- 'color : #00F578; border-color: #878787;'
- '}]]>';
-
- var stylesheet = parse(UTF8.encode(input), errors: errors);
-
- expect(stylesheet != null, true);
- expect(errors.isEmpty, true, reason: errors.toString());
-
- expect(prettyPrint(stylesheet), r'''
-.foo {
- color: #f00;
- left: 20px;
- top: 20px;
- width: 100px;
- height: 200px;
-}
-#div {
- color: #00F578;
- border-color: #878787;
-}''');
-}
-
-void testPseudo() {
- var errors = [];
-
- final input = r'''
-html:lang(fr-ca) { quotes: '" ' ' "' }
-zoom: { }
-
-a:link { color: red }
-:link { color: blue }
-
-a:focus { background: yellow }
-a:focus:hover { background: white }
-
-p.special:first-letter {color: #ffd800}
-
-p:not(#example){
- background-color: yellow;
-}
-
-input:not([DISABLED]){
- background-color: yellow;
-}
-
-html|*:not(:link):not(:visited) {
- border: 1px solid black;
-}
-
-*:not(FOO) {
- height: 20px;
-}
-
-*|*:not(*) {
- color: orange;
-}
-
-*|*:not(:hover) {
- color: magenta;
-}
-
-p:nth-child(3n-3) { }
-
-div:nth-child(2n) { color : red; }
-''';
-
- var stylesheet = parseCss(input, errors: errors,
- opts: ['--no-colors', 'memory']);
-
- expect(stylesheet != null, true);
- expect(errors.isEmpty, true, reason: errors.toString());
- expect(prettyPrint(stylesheet), r'''
-html:lang(fr-ca) {
- quotes: "\" " " \"";
-}
-zoom {
-}
-a:link {
- color: #f00;
-}
-:link {
- color: #00f;
-}
-a:focus {
- background: #ff0;
-}
-a:focus:hover {
- background: #fff;
-}
-p.special:first-letter {
- color: #ffd800;
-}
-p:not(#example) {
- background-color: #ff0;
-}
-input:not([DISABLED]) {
- background-color: #ff0;
-}
-html|*:not(:link):not(:visited) {
- border: 1px solid #000;
-}
-*:not(FOO) {
- height: 20px;
-}
-*|*:not(*) {
- color: #ffa500;
-}
-*|*:not(:hover) {
- color: #f0f;
-}
-p:nth-child(3n-3) {
-}
-div:nth-child(2n) {
- color: #f00;
-}''');
-}
-
-void testAttribute() {
- // TODO(terry): Implement
-}
-
-void testNegation() {
- // TODO(terry): Implement
-}
-
-void testHost() {
- var errors = [];
- var input = '@host { '
- ':scope {'
- 'white-space: nowrap;'
- 'overflow-style: marquee-line;'
- 'overflow-x: marquee;'
- '}'
- '* { color: red; }'
- '*:hover { font-weight: bold; }'
- ':nth-child(odd) { color: blue; }'
- '}';
- var stylesheet = parseCss(input, errors: errors,
- opts: ['--no-colors', 'memory']);
-
- expect(stylesheet != null, true);
- expect(errors.isEmpty, true, reason: errors.toString());
- expect(prettyPrint(stylesheet), r'''
-@host {
-:scope {
- white-space: nowrap;
- overflow-style: marquee-line;
- overflow-x: marquee;
-}
-* {
- color: #f00;
-}
-*:hover {
- font-weight: bold;
-}
-:nth-child(odd) {
- color: #00f;
-}
-}''');
-}
-
-// TODO(terry): Move to emitter_test.dart when real emitter exist.
-void testEmitter() {
- var errors = [];
- var input = '.foo { '
- 'color: red; left: 20px; top: 20px; width: 100px; height:200px'
- '}'
- '#div {'
- 'color : #00F578; border-color: #878787;'
- '}';
- var stylesheet = parseCss(input, errors: errors);
-
- expect(stylesheet != null, true);
- expect(errors.isEmpty, true, reason: errors.toString());
-
- walkTree(stylesheet);
-
- expect(prettyPrint(stylesheet), r'''
-.foo {
- color: #f00;
- left: 20px;
- top: 20px;
- width: 100px;
- height: 200px;
-}
-#div {
- color: #00F578;
- border-color: #878787;
-}''');
-}
-
main() {
test('Classes', testClass);
test('Classes 2', testClass2);
@@ -719,10 +550,5 @@ main() {
test('Selector Groups', testSelectorGroups);
test('Combinator', testCombinator);
test('Wildcards', testWildcard);
- test('Pseudo', testPseudo);
- test('Attributes', testAttribute);
- test('Negation', testNegation);
- test('@host', testHost);
test('Parse List<int> as input', testArrayOfChars);
- test('Simple Emitter', testEmitter);
}

Powered by Google App Engine
This is Rietveld 408576698