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

Side by Side Diff: pkg/csslib/test/var_test.dart

Issue 23868008: Added polyfill for var (moved from web_ui) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 var_test; 5 library var_test;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'package:csslib/parser.dart'; 8 import 'package:csslib/parser.dart';
9 import 'package:csslib/visitor.dart'; 9 import 'package:csslib/visitor.dart';
10 import 'testing.dart'; 10 import 'testing.dart';
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 expect(prettyPrint(stylesheet), generated2); 616 expect(prettyPrint(stylesheet), generated2);
617 617
618 stylesheet = compileCss(input2, errors: errors..clear(), 618 stylesheet = compileCss(input2, errors: errors..clear(),
619 opts: ['--no-colors', 'memory', '--no-less']); 619 opts: ['--no-colors', 'memory', '--no-less']);
620 620
621 expect(stylesheet != null, true); 621 expect(stylesheet != null, true);
622 expect(errors.isEmpty, true, reason: errors.toString()); 622 expect(errors.isEmpty, true, reason: errors.toString());
623 expect(prettyPrint(stylesheet), generated2); 623 expect(prettyPrint(stylesheet), generated2);
624 } 624 }
625 625
626 void polyfill() {
627 var errors = [];
628 var input = r'''
629 @color-background: red;
630 @color-foreground: blue;
631 .test {
632 background-color: @color-background;
633 color: @color-foreground;
634 }''';
635
636 var generated = r'''.test {
637 background-color: #f00;
638 color: #00f;
639 }''';
640
641 var stylesheet = compileCss(input, errors: errors,
642 opts: ['--no-colors', 'memory'], polyfill: true);
Siggi Cherem (dart-lang) 2013/09/09 19:53:38 should we also test the other features like var(a)
terry 2013/09/09 20:04:50 Yes, I will however "@foo: red;" and "var-foo; red
643
644 expect(stylesheet != null, true);
645 expect(errors.isEmpty, true, reason: errors.toString());
646 expect(prettyPrint(stylesheet), generated);
647 }
648
649
650
626 main() { 651 main() {
627 test('Simple var', simpleVar); 652 test('Simple var', simpleVar);
628 test('Expressions var', expressionsVar); 653 test('Expressions var', expressionsVar);
629 test('Default value in var()', defaultVar); 654 test('Default value in var()', defaultVar);
630 test('CSS Parser only var', parserVar); 655 test('CSS Parser only var', parserVar);
631 test('Var syntax', testVar); 656 test('Var syntax', testVar);
632 test('Cycles var', cyclesVar); 657 test('Cycles var', cyclesVar);
633 test('Less syntax', testLess); 658 test('Less syntax', testLess);
659 test('Polyfill', polyfill);
634 } 660 }
OLDNEW
« pkg/csslib/lib/src/polyfill.dart ('K') | « pkg/csslib/test/testing.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698