| 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:csslib/src/messages.dart'; | 7 import 'package:csslib/src/messages.dart'; |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 import 'testing.dart'; | 10 import 'testing.dart'; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 stylesheet = parseCss(input, errors: errors..clear(), opts: simpleOptions); | 741 stylesheet = parseCss(input, errors: errors..clear(), opts: simpleOptions); |
| 742 | 742 |
| 743 expect(stylesheet != null, true); | 743 expect(stylesheet != null, true); |
| 744 expect(errors.isEmpty, true, reason: errors.toString()); | 744 expect(errors.isEmpty, true, reason: errors.toString()); |
| 745 expect(prettyPrint(stylesheet), generated2); | 745 expect(prettyPrint(stylesheet), generated2); |
| 746 | 746 |
| 747 compileAndValidate(input2, generated2); | 747 compileAndValidate(input2, generated2); |
| 748 } | 748 } |
| 749 | 749 |
| 750 void polyfill() { | 750 void polyfill() { |
| 751 compilePolyfillAndValidate( | 751 compilePolyfillAndValidate(r''' |
| 752 r''' | |
| 753 @color-background: red; | 752 @color-background: red; |
| 754 @color-foreground: blue; | 753 @color-foreground: blue; |
| 755 .test { | 754 .test { |
| 756 background-color: @color-background; | 755 background-color: @color-background; |
| 757 color: @color-foreground; | 756 color: @color-foreground; |
| 758 }''', | 757 }''', r''' |
| 759 r''' | |
| 760 .test { | 758 .test { |
| 761 background-color: #f00; | 759 background-color: #f00; |
| 762 color: #00f; | 760 color: #00f; |
| 763 }'''); | 761 }'''); |
| 764 } | 762 } |
| 765 | 763 |
| 766 void testIndirects() { | 764 void testIndirects() { |
| 767 compilePolyfillAndValidate( | 765 compilePolyfillAndValidate(''' |
| 768 ''' | |
| 769 :root { | 766 :root { |
| 770 var-redef: #0f0; | 767 var-redef: #0f0; |
| 771 | 768 |
| 772 var-a1: #fff; | 769 var-a1: #fff; |
| 773 var-a2: var(a1); | 770 var-a2: var(a1); |
| 774 var-a3: var(a2); | 771 var-a3: var(a2); |
| 775 | 772 |
| 776 var-redef: #000; | 773 var-redef: #000; |
| 777 } | 774 } |
| 778 .test { | 775 .test { |
| 779 background-color: @a1; | 776 background-color: @a1; |
| 780 color: @a2; | 777 color: @a2; |
| 781 border-color: @a3; | 778 border-color: @a3; |
| 782 } | 779 } |
| 783 .test-1 { | 780 .test-1 { |
| 784 color: @redef; | 781 color: @redef; |
| 785 }''', | 782 }''', r''' |
| 786 r''' | |
| 787 :root { | 783 :root { |
| 788 } | 784 } |
| 789 .test { | 785 .test { |
| 790 background-color: #fff; | 786 background-color: #fff; |
| 791 color: #fff; | 787 color: #fff; |
| 792 border-color: #fff; | 788 border-color: #fff; |
| 793 } | 789 } |
| 794 .test-1 { | 790 .test-1 { |
| 795 color: #000; | 791 color: #000; |
| 796 }'''); | 792 }'''); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 test('Expressions var', expressionsVar); | 941 test('Expressions var', expressionsVar); |
| 946 test('Default value in var()', defaultVar); | 942 test('Default value in var()', defaultVar); |
| 947 test('CSS Parser only var', parserVar); | 943 test('CSS Parser only var', parserVar); |
| 948 test('Var syntax', testVar); | 944 test('Var syntax', testVar); |
| 949 test('Indirects', testIndirects); | 945 test('Indirects', testIndirects); |
| 950 test('Forward Refs', undefinedVars); | 946 test('Forward Refs', undefinedVars); |
| 951 test('Less syntax', testLess); | 947 test('Less syntax', testLess); |
| 952 test('Polyfill', polyfill); | 948 test('Polyfill', polyfill); |
| 953 test('Multi-file', includes); | 949 test('Multi-file', includes); |
| 954 } | 950 } |
| OLD | NEW |