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

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

Issue 23819036: Support for @mixin, @include and @extend (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: All changes ready to commit Created 7 years, 2 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
« no previous file with comments | « pkg/csslib/test/mixin_test.dart ('k') | pkg/csslib/test/run_all.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) 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 nested_test; 5 library nested_test;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'package:csslib/parser.dart';
9 import 'package:csslib/visitor.dart';
10 import 'testing.dart'; 8 import 'testing.dart';
11 9
12 List optionsCss = ['--no-colors', 'memory']; 10 List optionsCss = ['--no-colors', 'memory'];
13 11
14 compileAndValidate(String input, String generated) { 12 compileAndValidate(String input, String generated) {
15 var errors = []; 13 var errors = [];
16 var stylesheet = compileCss(input, errors: errors, opts: optionsCss); 14 var stylesheet = compileCss(input, errors: errors, opts: optionsCss);
17 expect(stylesheet != null, true); 15 expect(stylesheet != null, true);
18 expect(errors.isEmpty, true, reason: errors.toString()); 16 expect(errors.isEmpty, true, reason: errors.toString());
19 expect(prettyPrint(stylesheet), generated); 17 expect(prettyPrint(stylesheet), generated);
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 593
596 final input10 = r'''.textLink { a { & & { color: red; } } }'''; 594 final input10 = r'''.textLink { a { & & { color: red; } } }''';
597 final generated10 = r'''.textLink { 595 final generated10 = r'''.textLink {
598 } 596 }
599 .textLink a .textLink a { 597 .textLink a .textLink a {
600 color: #f00; 598 color: #f00;
601 }'''; 599 }''';
602 compileAndValidate(input10, generated10); 600 compileAndValidate(input10, generated10);
603 } 601 }
604 602
603 thisCombinator() {
604 var errors = [];
605 var input = r'''
606 .btn {
607 color: red;
608 }
609 .btn + .btn {
610 margin-left: 5px;
611 }
612 input.second {
613 & + label {
614 color: blue;
615 }
616 }
617 ''';
618
619 var generated = r'''.btn {
620 color: #f00;
621 }
622 .btn + .btn {
623 margin-left: 5px;
624 }
625 input.second {
626 }
627 input.second + label {
628 color: #00f;
629 }''';
630
631 compileAndValidate(input, generated);
632 }
633
605 main() { 634 main() {
606 test('Selector and Nested Variations', selectorVariations); 635 test('Selector and Nested Variations', selectorVariations);
607 test('Simple nesting', simpleNest); 636 test('Simple nesting', simpleNest);
608 test('Complex nesting', complexNest); 637 test('Complex nesting', complexNest);
609 test('@media nesting', mediaNesting); 638 test('@media nesting', mediaNesting);
610 test('Simple &', simpleThis); 639 test('Simple &', simpleThis);
611 test("Variations &", variationsThis); 640 test("Variations &", variationsThis);
612 test('Complex &', complexThis); 641 test('Complex &', complexThis);
642 test('& with + selector', thisCombinator);
613 } 643 }
OLDNEW
« no previous file with comments | « pkg/csslib/test/mixin_test.dart ('k') | pkg/csslib/test/run_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698