| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 declaration_test; | 5 library declaration_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:test/test.dart'; |
| 8 |
| 8 import 'testing.dart'; | 9 import 'testing.dart'; |
| 9 | 10 |
| 10 void testSimpleTerms() { | 11 void testSimpleTerms() { |
| 11 var errors = []; | 12 var errors = []; |
| 12 final String input = r''' | 13 final String input = r''' |
| 13 @ import url("test.css"); | 14 @ import url("test.css"); |
| 14 .foo { | 15 .foo { |
| 15 background-color: #191919; | 16 background-color: #191919; |
| 16 width: 10PX; | 17 width: 10PX; |
| 17 height: 22mM !important; | 18 height: 22mM !important; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 height: 40px; | 336 height: 40px; |
| 336 } | 337 } |
| 337 }'''; | 338 }'''; |
| 338 | 339 |
| 339 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions); | 340 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions); |
| 340 expect(stylesheet != null, true); | 341 expect(stylesheet != null, true); |
| 341 expect(errors.isEmpty, true, reason: errors.toString()); | 342 expect(errors.isEmpty, true, reason: errors.toString()); |
| 342 expect(prettyPrint(stylesheet), generated); | 343 expect(prettyPrint(stylesheet), generated); |
| 343 | 344 |
| 344 input = ''' | 345 input = ''' |
| 345 @media handheld and (min-width: 20em), | 346 @media handheld and (min-width: 20em), |
| 346 screen and (min-width: 20em) { | 347 screen and (min-width: 20em) { |
| 347 #id { color: red; } | 348 #id { color: red; } |
| 348 .myclass { height: 20px; } | 349 .myclass { height: 20px; } |
| 349 } | 350 } |
| 350 @media print and (min-resolution: 300dpi) { | 351 @media print and (min-resolution: 300dpi) { |
| 351 #anotherId { | 352 #anotherId { |
| 352 color: #fff; | 353 color: #fff; |
| 353 } | 354 } |
| 354 } | 355 } |
| 355 @media print and (min-resolution: 280dpcm) { | 356 @media print and (min-resolution: 280dpcm) { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 | 745 |
| 745 final String input3 = ''' | 746 final String input3 = ''' |
| 746 div { | 747 div { |
| 747 filter: alpha(opacity=80); /* IE7 and under */ | 748 filter: alpha(opacity=80); /* IE7 and under */ |
| 748 -ms-filter: "Alpha(Opacity=40)"; /* IE8 and newer */ | 749 -ms-filter: "Alpha(Opacity=40)"; /* IE8 and newer */ |
| 749 | 750 |
| 750 Filter: Blur(Add = 0, Direction = 225, Strength = 10); | 751 Filter: Blur(Add = 0, Direction = 225, Strength = 10); |
| 751 Filter: FlipV; | 752 Filter: FlipV; |
| 752 Filter: Gray; | 753 Filter: Gray; |
| 753 FILTER: Chroma(Color = #000000) Mask(Color=#00FF00); | 754 FILTER: Chroma(Color = #000000) Mask(Color=#00FF00); |
| 754 Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, | 755 Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, |
| 755 FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20, | 756 FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20, |
| 756 Phase=220, Strength=10); | 757 Phase=220, Strength=10); |
| 757 } | 758 } |
| 758 '''; | 759 '''; |
| 759 final String generated3 = 'div {\n filter: alpha(opacity=80);\n' | 760 final String generated3 = 'div {\n filter: alpha(opacity=80);\n' |
| 760 ' -ms-filter: "Alpha(Opacity=40)";\n' | 761 ' -ms-filter: "Alpha(Opacity=40)";\n' |
| 761 ' Filter: Blur(Add = 0, Direction = 225, Strength = 10);\n' | 762 ' Filter: Blur(Add = 0, Direction = 225, Strength = 10);\n' |
| 762 ' Filter: FlipV;\n Filter: Gray;\n' | 763 ' Filter: FlipV;\n Filter: Gray;\n' |
| 763 ' FILTER: Chroma(Color = #000000) Mask(Color=#00FF00);\n' | 764 ' FILTER: Chroma(Color = #000000) Mask(Color=#00FF00);\n' |
| 764 ' Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, ' | 765 ' Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, ' |
| 765 'StartX=20, StartY=40, \n' | 766 'StartX=20, StartY=40,\n' |
| 766 ' FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20, \n' | 767 ' FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20,\n' |
| 767 ' Phase=220, Strength=10);\n}'; | 768 ' Phase=220, Strength=10);\n}'; |
| 768 | 769 |
| 769 stylesheet = parseCss(input3, errors: errors..clear(), opts: simpleOptions); | 770 stylesheet = parseCss(input3, errors: errors..clear(), opts: simpleOptions); |
| 770 | 771 |
| 771 expect(stylesheet != null, true); | 772 expect(stylesheet != null, true); |
| 772 expect(errors.isEmpty, true, reason: errors.toString()); | 773 expect(errors.isEmpty, true, reason: errors.toString()); |
| 773 expect(prettyPrint(stylesheet), generated3); | 774 expect(prettyPrint(stylesheet), generated3); |
| 774 } | 775 } |
| 775 | 776 |
| 776 /** | 777 /** |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 test('Newer CSS', testNewerCss); | 1015 test('Newer CSS', testNewerCss); |
| 1015 test('Media Queries', testMediaQueries); | 1016 test('Media Queries', testMediaQueries); |
| 1016 test('Font-Face', testFontFace); | 1017 test('Font-Face', testFontFace); |
| 1017 test('CSS file', testCssFile); | 1018 test('CSS file', testCssFile); |
| 1018 test('Compact Emitter', testCompactEmitter); | 1019 test('Compact Emitter', testCompactEmitter); |
| 1019 test('Selector Negation', testNotSelectors); | 1020 test('Selector Negation', testNotSelectors); |
| 1020 test('IE stuff', testIE); | 1021 test('IE stuff', testIE); |
| 1021 test('IE declaration syntax', testIEDeclaration); | 1022 test('IE declaration syntax', testIEDeclaration); |
| 1022 test('Hanging bugs', testHangs); | 1023 test('Hanging bugs', testHangs); |
| 1023 } | 1024 } |
| OLD | NEW |