| 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 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 Loading... |
| 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); |
| 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 } |
| OLD | NEW |