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

Side by Side Diff: test/declaration_test.dart

Issue 1022963002: pkg/csslib: fixes for args (Closed) Base URL: https://github.com/dart-lang/csslib@master
Patch Set: nits Created 5 years, 8 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
« no previous file with comments | « test/compiler_test.dart ('k') | test/extend_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:unittest/unittest.dart';
8 import 'testing.dart'; 8 import 'testing.dart';
9 9
10 /** CSS compiler options no checks in in memory style sheet. */
11 List options = ['--no-colors', 'memory'];
12
13 void testSimpleTerms() { 10 void testSimpleTerms() {
14 var errors = []; 11 var errors = [];
15 final String input = r''' 12 final String input = r'''
16 @ import url("test.css"); 13 @ import url("test.css");
17 .foo { 14 .foo {
18 background-color: #191919; 15 background-color: #191919;
19 width: 10PX; 16 width: 10PX;
20 height: 22mM !important; 17 height: 22mM !important;
21 border-width: 20cm; 18 border-width: 20cm;
22 margin-width: 33%; 19 margin-width: 33%;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 226 }
230 #id-3 { 227 #id-3 {
231 -web-kit-resolution: 3dpcm; 228 -web-kit-resolution: 3dpcm;
232 transform: rotatey(20grad); 229 transform: rotatey(20grad);
233 } 230 }
234 #id-4 { 231 #id-4 {
235 -web-kit-resolution: 4dppx; 232 -web-kit-resolution: 4dppx;
236 transform: rotatez(20turn); 233 transform: rotatez(20turn);
237 }'''; 234 }''';
238 235
239 var stylesheet = parseCss(input, errors: errors, opts: options); 236 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
240 237
241 expect(stylesheet != null, true); 238 expect(stylesheet != null, true);
242 expect(errors.isEmpty, true, reason: errors.toString()); 239 expect(errors.isEmpty, true, reason: errors.toString());
243 expect(prettyPrint(stylesheet), generated); 240 expect(prettyPrint(stylesheet), generated);
244 } 241 }
245 242
246 void testUnicode() { 243 void testUnicode() {
247 var errors = []; 244 var errors = [];
248 final String input = r''' 245 final String input = r'''
249 .toggle:after { 246 .toggle:after {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 String generated = ''' 329 String generated = '''
333 @media screen AND (-webkit-min-device-pixel-ratio:0) { 330 @media screen AND (-webkit-min-device-pixel-ratio:0) {
334 .todo-item .toggle { 331 .todo-item .toggle {
335 background: none; 332 background: none;
336 } 333 }
337 #todo-item .toggle { 334 #todo-item .toggle {
338 height: 40px; 335 height: 40px;
339 } 336 }
340 }'''; 337 }''';
341 338
342 var stylesheet = parseCss(input, errors: errors, opts: options); 339 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
343 expect(stylesheet != null, true); 340 expect(stylesheet != null, true);
344 expect(errors.isEmpty, true, reason: errors.toString()); 341 expect(errors.isEmpty, true, reason: errors.toString());
345 expect(prettyPrint(stylesheet), generated); 342 expect(prettyPrint(stylesheet), generated);
346 343
347 input = ''' 344 input = '''
348 @media handheld and (min-width: 20em), 345 @media handheld and (min-width: 20em),
349 screen and (min-width: 20em) { 346 screen and (min-width: 20em) {
350 #id { color: red; } 347 #id { color: red; }
351 .myclass { height: 20px; } 348 .myclass { height: 20px; }
352 } 349 }
(...skipping 24 matching lines...) Expand all
377 } 374 }
378 } @media print AND (min-resolution:280dpcm) { 375 } @media print AND (min-resolution:280dpcm) {
379 #finalId { 376 #finalId {
380 color: #aaa; 377 color: #aaa;
381 } 378 }
382 .class2 { 379 .class2 {
383 border: 20px; 380 border: 20px;
384 } 381 }
385 }'''; 382 }''';
386 383
387 stylesheet = parseCss(input, errors: errors..clear(), opts: options); 384 stylesheet = parseCss(input, errors: errors..clear(), opts: simpleOptions);
388 385
389 expect(stylesheet != null, true); 386 expect(stylesheet != null, true);
390 expect(errors.isEmpty, true, reason: errors.toString()); 387 expect(errors.isEmpty, true, reason: errors.toString());
391 expect(prettyPrint(stylesheet), generated); 388 expect(prettyPrint(stylesheet), generated);
392 389
393 input = ''' 390 input = '''
394 @media only screen and (min-device-width: 4000px) and 391 @media only screen and (min-device-width: 4000px) and
395 (min-device-height: 2000px), screen (another: 100px) { 392 (min-device-height: 2000px), screen (another: 100px) {
396 html { 393 html {
397 font-size: 10em; 394 font-size: 10em;
398 } 395 }
399 }'''; 396 }''';
400 generated = '@media ONLY screen AND (min-device-width:4000px) ' 397 generated = '@media ONLY screen AND (min-device-width:4000px) '
401 'AND (min-device-height:2000px), screen (another:100px) {\n' 398 'AND (min-device-height:2000px), screen (another:100px) {\n'
402 'html {\n font-size: 10em;\n}\n}'; 399 'html {\n font-size: 10em;\n}\n}';
403 400
404 stylesheet = parseCss(input, errors: errors..clear(), opts: options); 401 stylesheet = parseCss(input, errors: errors..clear(), opts: simpleOptions);
405 402
406 expect(stylesheet != null, true); 403 expect(stylesheet != null, true);
407 expect(errors.isEmpty, true, reason: errors.toString()); 404 expect(errors.isEmpty, true, reason: errors.toString());
408 expect(prettyPrint(stylesheet), generated); 405 expect(prettyPrint(stylesheet), generated);
409 406
410 input = ''' 407 input = '''
411 @media screen,print (min-device-width: 4000px) and 408 @media screen,print (min-device-width: 4000px) and
412 (min-device-height: 2000px), screen (another: 100px) { 409 (min-device-height: 2000px), screen (another: 100px) {
413 html { 410 html {
414 font-size: 10em; 411 font-size: 10em;
415 } 412 }
416 }'''; 413 }''';
417 generated = '@media screen, print (min-device-width:4000px) AND ' 414 generated = '@media screen, print (min-device-width:4000px) AND '
418 '(min-device-height:2000px), screen (another:100px) {\n' 415 '(min-device-height:2000px), screen (another:100px) {\n'
419 'html {\n font-size: 10em;\n}\n}'; 416 'html {\n font-size: 10em;\n}\n}';
420 417
421 stylesheet = parseCss(input, errors: errors..clear(), opts: options); 418 stylesheet = parseCss(input, errors: errors..clear(), opts: simpleOptions);
422 419
423 expect(stylesheet != null, true); 420 expect(stylesheet != null, true);
424 expect(errors.isEmpty, true, reason: errors.toString()); 421 expect(errors.isEmpty, true, reason: errors.toString());
425 expect(prettyPrint(stylesheet), generated); 422 expect(prettyPrint(stylesheet), generated);
426 423
427 input = ''' 424 input = '''
428 @import "test.css" ONLY screen, NOT print (min-device-width: 4000px);'''; 425 @import "test.css" ONLY screen, NOT print (min-device-width: 4000px);''';
429 generated = 426 generated =
430 '@import "test.css" ONLY screen, NOT print (min-device-width:4000px);'; 427 '@import "test.css" ONLY screen, NOT print (min-device-width:4000px);';
431 428
432 stylesheet = parseCss(input, errors: errors..clear(), opts: options); 429 stylesheet = parseCss(input, errors: errors..clear(), opts: simpleOptions);
433 430
434 expect(stylesheet != null, true); 431 expect(stylesheet != null, true);
435 expect(errors.isEmpty, true, reason: errors.toString()); 432 expect(errors.isEmpty, true, reason: errors.toString());
436 expect(prettyPrint(stylesheet), generated); 433 expect(prettyPrint(stylesheet), generated);
437 } 434 }
438 435
439 void testFontFace() { 436 void testFontFace() {
440 var errors = []; 437 var errors = [];
441 438
442 final String input = ''' 439 final String input = '''
443 @font-face { 440 @font-face {
444 font-family: BBCBengali; 441 font-family: BBCBengali;
445 src: url(fonts/BBCBengali.ttf) format("opentype"); 442 src: url(fonts/BBCBengali.ttf) format("opentype");
446 unicode-range: U+0A-FF, U+980-9FF, U+????, U+3???; 443 unicode-range: U+0A-FF, U+980-9FF, U+????, U+3???;
447 }'''; 444 }''';
448 final String generated = '''@font-face { 445 final String generated = '''@font-face {
449 font-family: BBCBengali; 446 font-family: BBCBengali;
450 src: url("fonts/BBCBengali.ttf") format("opentype"); 447 src: url("fonts/BBCBengali.ttf") format("opentype");
451 unicode-range: U+0A-FF, U+980-9FF, U+????, U+3???; 448 unicode-range: U+0A-FF, U+980-9FF, U+????, U+3???;
452 }'''; 449 }''';
453 var stylesheet = parseCss(input, errors: errors, opts: options); 450 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
454 451
455 expect(stylesheet != null, true); 452 expect(stylesheet != null, true);
456 expect(errors.isEmpty, true, reason: errors.toString()); 453 expect(errors.isEmpty, true, reason: errors.toString());
457 expect(prettyPrint(stylesheet), generated); 454 expect(prettyPrint(stylesheet), generated);
458 455
459 final String input1 = ''' 456 final String input1 = '''
460 @font-face { 457 @font-face {
461 font-family: Gentium; 458 font-family: Gentium;
462 src: url(http://example.com/fonts/Gentium.ttf); 459 src: url(http://example.com/fonts/Gentium.ttf);
463 src: url(http://example.com/fonts/Gentium.ttf); 460 src: url(http://example.com/fonts/Gentium.ttf);
464 }'''; 461 }''';
465 final String generated1 = '''@font-face { 462 final String generated1 = '''@font-face {
466 font-family: Gentium; 463 font-family: Gentium;
467 src: url("http://example.com/fonts/Gentium.ttf"); 464 src: url("http://example.com/fonts/Gentium.ttf");
468 src: url("http://example.com/fonts/Gentium.ttf"); 465 src: url("http://example.com/fonts/Gentium.ttf");
469 }'''; 466 }''';
470 467
471 stylesheet = parseCss(input1, errors: errors..clear(), opts: options); 468 stylesheet = parseCss(input1, errors: errors..clear(), opts: simpleOptions);
472 469
473 expect(stylesheet != null, true); 470 expect(stylesheet != null, true);
474 expect(errors.isEmpty, true, reason: errors.toString()); 471 expect(errors.isEmpty, true, reason: errors.toString());
475 expect(prettyPrint(stylesheet), generated1); 472 expect(prettyPrint(stylesheet), generated1);
476 473
477 final String input2 = ''' 474 final String input2 = '''
478 @font-face { 475 @font-face {
479 src: url(ideal-sans-serif.woff) format("woff"), 476 src: url(ideal-sans-serif.woff) format("woff"),
480 url(basic-sans-serif.ttf) format("opentype"), 477 url(basic-sans-serif.ttf) format("opentype"),
481 local(Gentium Bold); 478 local(Gentium Bold);
482 }'''; 479 }''';
483 final String generated2 = '@font-face {\n' 480 final String generated2 = '@font-face {\n'
484 ' src: url("ideal-sans-serif.woff") ' 481 ' src: url("ideal-sans-serif.woff") '
485 'format("woff"), url("basic-sans-serif.ttf") ' 482 'format("woff"), url("basic-sans-serif.ttf") '
486 'format("opentype"), local(Gentium Bold);\n}'; 483 'format("opentype"), local(Gentium Bold);\n}';
487 484
488 stylesheet = parseCss(input2, errors: errors..clear(), opts: options); 485 stylesheet = parseCss(input2, errors: errors..clear(), opts: simpleOptions);
489 486
490 expect(stylesheet != null, true); 487 expect(stylesheet != null, true);
491 expect(errors.isEmpty, true, reason: errors.toString()); 488 expect(errors.isEmpty, true, reason: errors.toString());
492 expect(prettyPrint(stylesheet), generated2); 489 expect(prettyPrint(stylesheet), generated2);
493 490
494 final String input3 = '''@font-face { 491 final String input3 = '''@font-face {
495 font-family: MyGentium Text Ornaments; 492 font-family: MyGentium Text Ornaments;
496 src: local(Gentium Bold), /* full font name */ 493 src: local(Gentium Bold), /* full font name */
497 local(Gentium-Bold), /* Postscript name */ 494 local(Gentium-Bold), /* Postscript name */
498 url(GentiumBold.ttf); /* otherwise, download it */ 495 url(GentiumBold.ttf); /* otherwise, download it */
499 font-weight: bold; 496 font-weight: bold;
500 }'''; 497 }''';
501 final String generated3 = '''@font-face { 498 final String generated3 = '''@font-face {
502 font-family: MyGentium Text Ornaments; 499 font-family: MyGentium Text Ornaments;
503 src: local(Gentium Bold), local(Gentium-Bold), url("GentiumBold.ttf"); 500 src: local(Gentium Bold), local(Gentium-Bold), url("GentiumBold.ttf");
504 font-weight: bold; 501 font-weight: bold;
505 }'''; 502 }''';
506 503
507 stylesheet = parseCss(input3, errors: errors..clear(), opts: options); 504 stylesheet = parseCss(input3, errors: errors..clear(), opts: simpleOptions);
508 505
509 expect(stylesheet != null, true); 506 expect(stylesheet != null, true);
510 expect(errors.isEmpty, true, reason: errors.toString()); 507 expect(errors.isEmpty, true, reason: errors.toString());
511 expect(prettyPrint(stylesheet), generated3); 508 expect(prettyPrint(stylesheet), generated3);
512 509
513 final String input4 = ''' 510 final String input4 = '''
514 @font-face { 511 @font-face {
515 font-family: STIXGeneral; 512 font-family: STIXGeneral;
516 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf); 513 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf);
517 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF; 514 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF;
518 }'''; 515 }''';
519 final String generated4 = '''@font-face { 516 final String generated4 = '''@font-face {
520 font-family: STIXGeneral; 517 font-family: STIXGeneral;
521 src: local(STIXGeneral), url("/stixfonts/STIXGeneral.otf"); 518 src: local(STIXGeneral), url("/stixfonts/STIXGeneral.otf");
522 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF; 519 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF;
523 }'''; 520 }''';
524 stylesheet = parseCss(input4, errors: errors..clear(), opts: options); 521 stylesheet = parseCss(input4, errors: errors..clear(), opts: simpleOptions);
525 522
526 expect(stylesheet != null, true); 523 expect(stylesheet != null, true);
527 expect(errors.isEmpty, true, reason: errors.toString()); 524 expect(errors.isEmpty, true, reason: errors.toString());
528 expect(prettyPrint(stylesheet), generated4); 525 expect(prettyPrint(stylesheet), generated4);
529 } 526 }
530 527
531 void testCssFile() { 528 void testCssFile() {
532 var errors = []; 529 var errors = [];
533 final String input = r''' 530 final String input = r'''
534 @import 'simple.css' 531 @import 'simple.css'
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 html|*:not(:link):not(:visited) { 693 html|*:not(:link):not(:visited) {
697 width: 92%; 694 width: 92%;
698 } 695 }
699 *|*:not(*) { 696 *|*:not(*) {
700 font-weight: bold; 697 font-weight: bold;
701 } 698 }
702 *:not(:not([disabled])) { 699 *:not(:not([disabled])) {
703 color: #00f; 700 color: #00f;
704 }'''; 701 }''';
705 702
706 var stylesheet = parseCss(input, errors: errors, opts: options); 703 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
707 704
708 expect(stylesheet != null, true); 705 expect(stylesheet != null, true);
709 expect(errors.isEmpty, true, reason: errors.toString()); 706 expect(errors.isEmpty, true, reason: errors.toString());
710 expect(prettyPrint(stylesheet), generated); 707 expect(prettyPrint(stylesheet), generated);
711 } 708 }
712 709
713 void testIE() { 710 void testIE() {
714 var errors = []; 711 var errors = [];
715 final String input = ".test {\n" 712 final String input = ".test {\n"
716 " filter: progid:DXImageTransform.Microsoft.gradient" 713 " filter: progid:DXImageTransform.Microsoft.gradient"
717 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');\n" 714 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');\n"
718 "}"; 715 "}";
719 final String generated = ".test {\n" 716 final String generated = ".test {\n"
720 " filter: progid:DXImageTransform.Microsoft.gradient" 717 " filter: progid:DXImageTransform.Microsoft.gradient"
721 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');\n" 718 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');\n"
722 "}"; 719 "}";
723 720
724 var stylesheet = parseCss(input, errors: errors, opts: options); 721 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
725 722
726 expect(stylesheet != null, true); 723 expect(stylesheet != null, true);
727 expect(errors.isEmpty, true, reason: errors.toString()); 724 expect(errors.isEmpty, true, reason: errors.toString());
728 expect(prettyPrint(stylesheet), generated); 725 expect(prettyPrint(stylesheet), generated);
729 726
730 final String input2 = ".test {\n" 727 final String input2 = ".test {\n"
731 " filter: progid:DXImageTransform.Microsoft.gradient" 728 " filter: progid:DXImageTransform.Microsoft.gradient"
732 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670')\n" 729 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670')\n"
733 " progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1 );\n" 730 " progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1 );\n"
734 "}"; 731 "}";
735 732
736 final String generated2 = ".test {\n" 733 final String generated2 = ".test {\n"
737 " filter: progid:DXImageTransform.Microsoft.gradient" 734 " filter: progid:DXImageTransform.Microsoft.gradient"
738 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670')\n" 735 "(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670')\n"
739 " progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror= 1);\n" 736 " progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror= 1);\n"
740 "}"; 737 "}";
741 738
742 stylesheet = parseCss(input2, errors: errors..clear(), opts: options); 739 stylesheet = parseCss(input2, errors: errors..clear(), opts: simpleOptions);
743 740
744 expect(stylesheet != null, true); 741 expect(stylesheet != null, true);
745 expect(errors.isEmpty, true, reason: errors.toString()); 742 expect(errors.isEmpty, true, reason: errors.toString());
746 expect(prettyPrint(stylesheet), generated2); 743 expect(prettyPrint(stylesheet), generated2);
747 744
748 final String input3 = ''' 745 final String input3 = '''
749 div { 746 div {
750 filter: alpha(opacity=80); /* IE7 and under */ 747 filter: alpha(opacity=80); /* IE7 and under */
751 -ms-filter: "Alpha(Opacity=40)"; /* IE8 and newer */ 748 -ms-filter: "Alpha(Opacity=40)"; /* IE8 and newer */
752 749
753 Filter: Blur(Add = 0, Direction = 225, Strength = 10); 750 Filter: Blur(Add = 0, Direction = 225, Strength = 10);
754 Filter: FlipV; 751 Filter: FlipV;
755 Filter: Gray; 752 Filter: Gray;
756 FILTER: Chroma(Color = #000000) Mask(Color=#00FF00); 753 FILTER: Chroma(Color = #000000) Mask(Color=#00FF00);
757 Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, 754 Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40,
758 FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20, 755 FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20,
759 Phase=220, Strength=10); 756 Phase=220, Strength=10);
760 } 757 }
761 '''; 758 ''';
762 final String generated3 = 'div {\n filter: alpha(opacity=80);\n' 759 final String generated3 = 'div {\n filter: alpha(opacity=80);\n'
763 ' -ms-filter: "Alpha(Opacity=40)";\n' 760 ' -ms-filter: "Alpha(Opacity=40)";\n'
764 ' Filter: Blur(Add = 0, Direction = 225, Strength = 10);\n' 761 ' Filter: Blur(Add = 0, Direction = 225, Strength = 10);\n'
765 ' Filter: FlipV;\n Filter: Gray;\n' 762 ' Filter: FlipV;\n Filter: Gray;\n'
766 ' FILTER: Chroma(Color = #000000) Mask(Color=#00FF00);\n' 763 ' FILTER: Chroma(Color = #000000) Mask(Color=#00FF00);\n'
767 ' Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, ' 764 ' Filter: Alpha(Opacity=100, FinishOpacity=0, Style=2, '
768 'StartX=20, StartY=40, \n' 765 'StartX=20, StartY=40, \n'
769 ' FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20, \n' 766 ' FinishX=0, FinishY=0) Wave(Add=0, Freq=5, LightStrength=20, \n'
770 ' Phase=220, Strength=10);\n}'; 767 ' Phase=220, Strength=10);\n}';
771 768
772 stylesheet = parseCss(input3, errors: errors..clear(), opts: options); 769 stylesheet = parseCss(input3, errors: errors..clear(), opts: simpleOptions);
773 770
774 expect(stylesheet != null, true); 771 expect(stylesheet != null, true);
775 expect(errors.isEmpty, true, reason: errors.toString()); 772 expect(errors.isEmpty, true, reason: errors.toString());
776 expect(prettyPrint(stylesheet), generated3); 773 expect(prettyPrint(stylesheet), generated3);
777 } 774 }
778 775
779 /** 776 /**
780 * Test IE specific declaration syntax: 777 * Test IE specific declaration syntax:
781 * IE6 property name prefixed with _ (normal CSS property name can start 778 * IE6 property name prefixed with _ (normal CSS property name can start
782 * with an underscore). 779 * with an underscore).
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 } 936 }
940 @keyframes progress-bar-stripes { 937 @keyframes progress-bar-stripes {
941 from { 938 from {
942 background-position: 40px 0; 939 background-position: 40px 0;
943 } 940 }
944 to { 941 to {
945 background-position: 0 0; 942 background-position: 0 0;
946 } 943 }
947 }'''; 944 }''';
948 945
949 var stylesheet = parseCss(input, errors: errors, opts: options); 946 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
950 expect(stylesheet != null, true); 947 expect(stylesheet != null, true);
951 expect(errors.isEmpty, true, reason: errors.toString()); 948 expect(errors.isEmpty, true, reason: errors.toString());
952 expect(prettyPrint(stylesheet), generated); 949 expect(prettyPrint(stylesheet), generated);
953 } 950 }
954 951
955 void testHangs() { 952 void testHangs() {
956 final optionErrors = ['--no-colors', '--warnings_as_errors', 'memory'];
957 var errors = []; 953 var errors = [];
958 954
959 // Bad hexvalue had caused a hang in processTerm. 955 // Bad hexvalue had caused a hang in processTerm.
960 final input = r'''#a { color: #ebebeburl(0/IE8+9+); }'''; 956 final input = r'''#a { color: #ebebeburl(0/IE8+9+); }''';
961 var stylesheet = parseCss(input, errors: errors, opts: optionErrors); 957 var stylesheet = parseCss(input, errors: errors, opts: options);
962 958
963 expect(stylesheet != null, true); 959 expect(stylesheet != null, true);
964 expect(errors.length, 3, reason: errors.toString()); 960 expect(errors.length, 3, reason: errors.toString());
965 961
966 var errorMessage = errors[0]; 962 var errorMessage = errors[0];
967 expect(errorMessage.message, contains('Bad hex number')); 963 expect(errorMessage.message, contains('Bad hex number'));
968 expect(errorMessage.span, isNotNull); 964 expect(errorMessage.span, isNotNull);
969 expect(errorMessage.span.start.line, 0); 965 expect(errorMessage.span.start.line, 0);
970 expect(errorMessage.span.start.column, 12); 966 expect(errorMessage.span.start.column, 12);
971 expect(errorMessage.span.text, '#ebebeburl'); 967 expect(errorMessage.span.text, '#ebebeburl');
(...skipping 15 matching lines...) Expand all
987 // Missing closing parenthesis for keyframes. 983 // Missing closing parenthesis for keyframes.
988 final input2 = r'''@-ms-keyframes progress-bar-stripes { 984 final input2 = r'''@-ms-keyframes progress-bar-stripes {
989 from { 985 from {
990 background-position: 40px 0; 986 background-position: 40px 0;
991 } 987 }
992 to { 988 to {
993 background-position: 0 0; 989 background-position: 0 0;
994 } 990 }
995 '''; 991 ''';
996 992
997 stylesheet = parseCss(input2, errors: errors..clear(), opts: optionErrors); 993 stylesheet = parseCss(input2, errors: errors..clear(), opts: options);
998 994
999 expect(stylesheet != null, true); 995 expect(stylesheet != null, true);
1000 996
1001 expect(errors.length, 1, reason: errors.toString()); 997 expect(errors.length, 1, reason: errors.toString());
1002 998
1003 errorMessage = errors[0]; 999 errorMessage = errors[0];
1004 expect(errorMessage.message, contains('unexpected end of file')); 1000 expect(errorMessage.message, contains('unexpected end of file'));
1005 expect(errorMessage.span, isNotNull); 1001 expect(errorMessage.span, isNotNull);
1006 expect(errorMessage.span.start.line, 7); 1002 expect(errorMessage.span.start.line, 7);
1007 expect(errorMessage.span.start.column, 0); 1003 expect(errorMessage.span.start.column, 0);
(...skipping 10 matching lines...) Expand all
1018 test('Newer CSS', testNewerCss); 1014 test('Newer CSS', testNewerCss);
1019 test('Media Queries', testMediaQueries); 1015 test('Media Queries', testMediaQueries);
1020 test('Font-Face', testFontFace); 1016 test('Font-Face', testFontFace);
1021 test('CSS file', testCssFile); 1017 test('CSS file', testCssFile);
1022 test('Compact Emitter', testCompactEmitter); 1018 test('Compact Emitter', testCompactEmitter);
1023 test('Selector Negation', testNotSelectors); 1019 test('Selector Negation', testNotSelectors);
1024 test('IE stuff', testIE); 1020 test('IE stuff', testIE);
1025 test('IE declaration syntax', testIEDeclaration); 1021 test('IE declaration syntax', testIEDeclaration);
1026 test('Hanging bugs', testHangs); 1022 test('Hanging bugs', testHangs);
1027 } 1023 }
OLDNEW
« no previous file with comments | « test/compiler_test.dart ('k') | test/extend_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698