sass 3.1.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING +1 -1
- data/MIT-LICENSE +2 -2
- data/README.md +29 -17
- data/Rakefile +43 -9
- data/VERSION +1 -1
- data/VERSION_DATE +1 -0
- data/VERSION_NAME +1 -1
- data/bin/sass +6 -1
- data/bin/sass-convert +6 -1
- data/bin/scss +6 -1
- data/ext/mkrf_conf.rb +27 -0
- data/lib/sass/cache_stores/base.rb +7 -3
- data/lib/sass/cache_stores/chain.rb +3 -2
- data/lib/sass/cache_stores/filesystem.rb +5 -7
- data/lib/sass/cache_stores/memory.rb +1 -1
- data/lib/sass/cache_stores/null.rb +2 -2
- data/lib/sass/callbacks.rb +2 -1
- data/lib/sass/css.rb +168 -53
- data/lib/sass/engine.rb +502 -174
- data/lib/sass/environment.rb +151 -111
- data/lib/sass/error.rb +7 -7
- data/lib/sass/exec.rb +176 -60
- data/lib/sass/features.rb +40 -0
- data/lib/sass/importers/base.rb +46 -7
- data/lib/sass/importers/deprecated_path.rb +51 -0
- data/lib/sass/importers/filesystem.rb +113 -30
- data/lib/sass/importers.rb +1 -0
- data/lib/sass/logger/base.rb +30 -0
- data/lib/sass/logger/log_level.rb +45 -0
- data/lib/sass/logger.rb +12 -0
- data/lib/sass/media.rb +213 -0
- data/lib/sass/plugin/compiler.rb +194 -104
- data/lib/sass/plugin/configuration.rb +18 -25
- data/lib/sass/plugin/merb.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +37 -11
- data/lib/sass/plugin.rb +10 -13
- data/lib/sass/railtie.rb +2 -1
- data/lib/sass/repl.rb +5 -6
- data/lib/sass/script/css_lexer.rb +8 -4
- data/lib/sass/script/css_parser.rb +5 -2
- data/lib/sass/script/functions.rb +1547 -618
- data/lib/sass/script/lexer.rb +122 -72
- data/lib/sass/script/parser.rb +304 -135
- data/lib/sass/script/tree/funcall.rb +306 -0
- data/lib/sass/script/{interpolation.rb → tree/interpolation.rb} +43 -13
- data/lib/sass/script/tree/list_literal.rb +77 -0
- data/lib/sass/script/tree/literal.rb +45 -0
- data/lib/sass/script/tree/map_literal.rb +64 -0
- data/lib/sass/script/{node.rb → tree/node.rb} +30 -12
- data/lib/sass/script/{operation.rb → tree/operation.rb} +33 -21
- data/lib/sass/script/{string_interpolation.rb → tree/string_interpolation.rb} +14 -4
- data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +21 -9
- data/lib/sass/script/tree/variable.rb +57 -0
- data/lib/sass/script/tree.rb +15 -0
- data/lib/sass/script/value/arg_list.rb +36 -0
- data/lib/sass/script/value/base.rb +238 -0
- data/lib/sass/script/value/bool.rb +40 -0
- data/lib/sass/script/{color.rb → value/color.rb} +256 -74
- data/lib/sass/script/value/deprecated_false.rb +55 -0
- data/lib/sass/script/value/helpers.rb +155 -0
- data/lib/sass/script/value/list.rb +128 -0
- data/lib/sass/script/value/map.rb +70 -0
- data/lib/sass/script/value/null.rb +49 -0
- data/lib/sass/script/{number.rb → value/number.rb} +115 -62
- data/lib/sass/script/{string.rb → value/string.rb} +9 -11
- data/lib/sass/script/value.rb +12 -0
- data/lib/sass/script.rb +35 -9
- data/lib/sass/scss/css_parser.rb +2 -12
- data/lib/sass/scss/parser.rb +657 -230
- data/lib/sass/scss/rx.rb +17 -12
- data/lib/sass/scss/static_parser.rb +37 -6
- data/lib/sass/scss.rb +0 -1
- data/lib/sass/selector/abstract_sequence.rb +35 -3
- data/lib/sass/selector/comma_sequence.rb +29 -14
- data/lib/sass/selector/sequence.rb +371 -74
- data/lib/sass/selector/simple.rb +28 -13
- data/lib/sass/selector/simple_sequence.rb +163 -36
- data/lib/sass/selector.rb +138 -36
- data/lib/sass/shared.rb +3 -5
- data/lib/sass/source/map.rb +196 -0
- data/lib/sass/source/position.rb +39 -0
- data/lib/sass/source/range.rb +41 -0
- data/lib/sass/stack.rb +126 -0
- data/lib/sass/supports.rb +228 -0
- data/lib/sass/tree/at_root_node.rb +82 -0
- data/lib/sass/tree/comment_node.rb +34 -29
- data/lib/sass/tree/content_node.rb +9 -0
- data/lib/sass/tree/css_import_node.rb +60 -0
- data/lib/sass/tree/debug_node.rb +3 -3
- data/lib/sass/tree/directive_node.rb +33 -3
- data/lib/sass/tree/each_node.rb +9 -9
- data/lib/sass/tree/extend_node.rb +20 -6
- data/lib/sass/tree/for_node.rb +6 -6
- data/lib/sass/tree/function_node.rb +12 -4
- data/lib/sass/tree/if_node.rb +2 -15
- data/lib/sass/tree/import_node.rb +11 -5
- data/lib/sass/tree/media_node.rb +27 -11
- data/lib/sass/tree/mixin_def_node.rb +15 -4
- data/lib/sass/tree/mixin_node.rb +27 -7
- data/lib/sass/tree/node.rb +69 -35
- data/lib/sass/tree/prop_node.rb +47 -31
- data/lib/sass/tree/return_node.rb +4 -3
- data/lib/sass/tree/root_node.rb +20 -4
- data/lib/sass/tree/rule_node.rb +37 -26
- data/lib/sass/tree/supports_node.rb +38 -0
- data/lib/sass/tree/trace_node.rb +33 -0
- data/lib/sass/tree/variable_node.rb +10 -4
- data/lib/sass/tree/visitors/base.rb +5 -8
- data/lib/sass/tree/visitors/check_nesting.rb +67 -52
- data/lib/sass/tree/visitors/convert.rb +134 -53
- data/lib/sass/tree/visitors/cssize.rb +245 -51
- data/lib/sass/tree/visitors/deep_copy.rb +102 -0
- data/lib/sass/tree/visitors/extend.rb +68 -0
- data/lib/sass/tree/visitors/perform.rb +331 -105
- data/lib/sass/tree/visitors/set_options.rb +125 -0
- data/lib/sass/tree/visitors/to_css.rb +259 -95
- data/lib/sass/tree/warn_node.rb +3 -3
- data/lib/sass/tree/while_node.rb +3 -3
- data/lib/sass/util/cross_platform_random.rb +19 -0
- data/lib/sass/util/multibyte_string_scanner.rb +157 -0
- data/lib/sass/util/normalized_map.rb +130 -0
- data/lib/sass/util/ordered_hash.rb +192 -0
- data/lib/sass/util/subset_map.rb +11 -2
- data/lib/sass/util/test.rb +9 -0
- data/lib/sass/util.rb +565 -39
- data/lib/sass/version.rb +27 -15
- data/lib/sass.rb +39 -4
- data/test/sass/cache_test.rb +15 -0
- data/test/sass/compiler_test.rb +223 -0
- data/test/sass/conversion_test.rb +901 -107
- data/test/sass/css2sass_test.rb +94 -0
- data/test/sass/engine_test.rb +1059 -164
- data/test/sass/exec_test.rb +86 -0
- data/test/sass/extend_test.rb +933 -837
- data/test/sass/fixtures/test_staleness_check_across_importers.css +1 -0
- data/test/sass/fixtures/test_staleness_check_across_importers.scss +1 -0
- data/test/sass/functions_test.rb +995 -136
- data/test/sass/importer_test.rb +338 -18
- data/test/sass/logger_test.rb +58 -0
- data/test/sass/more_results/more_import.css +2 -2
- data/test/sass/plugin_test.rb +114 -30
- data/test/sass/results/cached_import_option.css +3 -0
- data/test/sass/results/filename_fn.css +3 -0
- data/test/sass/results/import.css +2 -2
- data/test/sass/results/import_charset.css +1 -0
- data/test/sass/results/import_charset_1_8.css +1 -0
- data/test/sass/results/import_charset_ibm866.css +1 -0
- data/test/sass/results/import_content.css +1 -0
- data/test/sass/results/script.css +1 -1
- data/test/sass/results/scss_import.css +2 -2
- data/test/sass/results/units.css +2 -2
- data/test/sass/script_conversion_test.rb +43 -1
- data/test/sass/script_test.rb +380 -36
- data/test/sass/scss/css_test.rb +257 -75
- data/test/sass/scss/scss_test.rb +2322 -110
- data/test/sass/source_map_test.rb +887 -0
- data/test/sass/templates/_cached_import_option_partial.scss +1 -0
- data/test/sass/templates/_double_import_loop2.sass +1 -0
- data/test/sass/templates/_filename_fn_import.scss +11 -0
- data/test/sass/templates/_imported_content.sass +3 -0
- data/test/sass/templates/_same_name_different_partiality.scss +1 -0
- data/test/sass/templates/bork5.sass +3 -0
- data/test/sass/templates/cached_import_option.scss +3 -0
- data/test/sass/templates/double_import_loop1.sass +1 -0
- data/test/sass/templates/filename_fn.scss +18 -0
- data/test/sass/templates/import_charset.sass +2 -0
- data/test/sass/templates/import_charset_1_8.sass +2 -0
- data/test/sass/templates/import_charset_ibm866.sass +2 -0
- data/test/sass/templates/import_content.sass +4 -0
- data/test/sass/templates/same_name_different_ext.sass +2 -0
- data/test/sass/templates/same_name_different_ext.scss +1 -0
- data/test/sass/templates/same_name_different_partiality.scss +1 -0
- data/test/sass/templates/single_import_loop.sass +1 -0
- data/test/sass/templates/subdir/import_up1.scss +1 -0
- data/test/sass/templates/subdir/import_up2.scss +1 -0
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +147 -0
- data/test/sass/util/normalized_map_test.rb +51 -0
- data/test/sass/util_test.rb +183 -0
- data/test/sass/value_helpers_test.rb +181 -0
- data/test/test_helper.rb +45 -5
- data/vendor/listen/CHANGELOG.md +228 -0
- data/vendor/listen/CONTRIBUTING.md +38 -0
- data/vendor/listen/Gemfile +30 -0
- data/vendor/listen/Guardfile +8 -0
- data/vendor/{fssm → listen}/LICENSE +1 -1
- data/vendor/listen/README.md +315 -0
- data/vendor/listen/Rakefile +47 -0
- data/vendor/listen/Vagrantfile +96 -0
- data/vendor/listen/lib/listen/adapter.rb +214 -0
- data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
- data/vendor/listen/lib/listen/adapters/darwin.rb +85 -0
- data/vendor/listen/lib/listen/adapters/linux.rb +113 -0
- data/vendor/listen/lib/listen/adapters/polling.rb +67 -0
- data/vendor/listen/lib/listen/adapters/windows.rb +87 -0
- data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
- data/vendor/listen/lib/listen/directory_record.rb +371 -0
- data/vendor/listen/lib/listen/listener.rb +225 -0
- data/vendor/listen/lib/listen/multi_listener.rb +143 -0
- data/vendor/listen/lib/listen/turnstile.rb +28 -0
- data/vendor/listen/lib/listen/version.rb +3 -0
- data/vendor/listen/lib/listen.rb +40 -0
- data/vendor/listen/listen.gemspec +22 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +183 -0
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +37 -0
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +47 -0
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +30 -0
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
- data/vendor/listen/spec/listen/directory_record_spec.rb +1225 -0
- data/vendor/listen/spec/listen/listener_spec.rb +169 -0
- data/vendor/listen/spec/listen/multi_listener_spec.rb +174 -0
- data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
- data/vendor/listen/spec/listen_spec.rb +73 -0
- data/vendor/listen/spec/spec_helper.rb +21 -0
- data/vendor/listen/spec/support/adapter_helper.rb +629 -0
- data/vendor/listen/spec/support/directory_record_helper.rb +55 -0
- data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
- data/vendor/listen/spec/support/listeners_helper.rb +156 -0
- data/vendor/listen/spec/support/platform_helper.rb +15 -0
- metadata +344 -271
- data/lib/sass/less.rb +0 -382
- data/lib/sass/script/bool.rb +0 -18
- data/lib/sass/script/funcall.rb +0 -162
- data/lib/sass/script/list.rb +0 -76
- data/lib/sass/script/literal.rb +0 -245
- data/lib/sass/script/variable.rb +0 -54
- data/lib/sass/scss/sass_parser.rb +0 -11
- data/test/sass/less_conversion_test.rb +0 -653
- data/vendor/fssm/README.markdown +0 -55
- data/vendor/fssm/Rakefile +0 -59
- data/vendor/fssm/VERSION.yml +0 -5
- data/vendor/fssm/example.rb +0 -9
- data/vendor/fssm/fssm.gemspec +0 -77
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/fssm/lib/fssm/monitor.rb +0 -26
- data/vendor/fssm/lib/fssm/path.rb +0 -91
- data/vendor/fssm/lib/fssm/pathname.rb +0 -502
- data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
- data/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/fssm/lib/fssm/support.rb +0 -63
- data/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/fssm/lib/fssm.rb +0 -33
- data/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/fssm/spec/path_spec.rb +0 -75
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +0 -14
data/test/sass/scss/css_test.rb
CHANGED
@@ -412,11 +412,20 @@ foo {
|
|
412
412
|
SCSS
|
413
413
|
end
|
414
414
|
|
415
|
+
def test_element_function
|
416
|
+
assert_parses <<SCSS
|
417
|
+
foo {
|
418
|
+
a: -moz-element(#foo);
|
419
|
+
b: -webkit-element(#foo);
|
420
|
+
b: -foobar-element(#foo); }
|
421
|
+
SCSS
|
422
|
+
end
|
423
|
+
|
415
424
|
def test_unary_ops
|
416
425
|
assert_equal <<CSS, render(<<SCSS)
|
417
426
|
foo {
|
418
427
|
a: -0.5em;
|
419
|
-
b: 0.5em;
|
428
|
+
b: +0.5em;
|
420
429
|
c: -foo(12px);
|
421
430
|
d: +foo(12px); }
|
422
431
|
CSS
|
@@ -479,7 +488,7 @@ SCSS
|
|
479
488
|
|
480
489
|
def test_media_directive_with_keywords
|
481
490
|
assert_parses <<SCSS
|
482
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
491
|
+
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
483
492
|
a: b; }
|
484
493
|
SCSS
|
485
494
|
assert_parses <<SCSS
|
@@ -496,13 +505,20 @@ SCSS
|
|
496
505
|
assert_parses '@import url(foo.css);'
|
497
506
|
end
|
498
507
|
|
499
|
-
def
|
508
|
+
def test_string_import_directive_with_media
|
500
509
|
assert_parses '@import "foo.css" screen;'
|
501
510
|
assert_parses '@import "foo.css" screen, print;'
|
502
511
|
assert_parses '@import "foo.css" screen, print and (foo: 0);'
|
503
512
|
assert_parses '@import "foo.css" screen, only print, screen and (foo: 0);'
|
504
513
|
end
|
505
514
|
|
515
|
+
def test_url_import_directive_with_media
|
516
|
+
assert_parses '@import url("foo.css") screen;'
|
517
|
+
assert_parses '@import url("foo.css") screen, print;'
|
518
|
+
assert_parses '@import url("foo.css") screen, print and (foo: 0);'
|
519
|
+
assert_parses '@import url("foo.css") screen, only print, screen and (foo: 0);'
|
520
|
+
end
|
521
|
+
|
506
522
|
def test_page_directive
|
507
523
|
assert_parses <<SCSS
|
508
524
|
@page {
|
@@ -557,7 +573,6 @@ SCSS
|
|
557
573
|
assert_parses <<SCSS
|
558
574
|
@foo bar {
|
559
575
|
a: b; }
|
560
|
-
|
561
576
|
@bar baz {
|
562
577
|
c: d; }
|
563
578
|
SCSS
|
@@ -577,7 +592,6 @@ SCSS
|
|
577
592
|
assert_equal <<CSS, render(<<SCSS)
|
578
593
|
@foo {
|
579
594
|
a: b; }
|
580
|
-
|
581
595
|
@bar {
|
582
596
|
a: b; }
|
583
597
|
CSS
|
@@ -586,93 +600,195 @@ CSS
|
|
586
600
|
SCSS
|
587
601
|
end
|
588
602
|
|
603
|
+
def test_moz_document_directive
|
604
|
+
assert_equal <<CSS, render(<<SCSS)
|
605
|
+
@-moz-document url(http://www.w3.org/),
|
606
|
+
url-prefix(http://www.w3.org/Style/),
|
607
|
+
domain(mozilla.org),
|
608
|
+
regexp("^https:.*") {
|
609
|
+
.foo {
|
610
|
+
a: b; } }
|
611
|
+
CSS
|
612
|
+
@-moz-document url(http://www.w3.org/),
|
613
|
+
url-prefix(http://www.w3.org/Style/),
|
614
|
+
domain(mozilla.org),
|
615
|
+
regexp("^https:.*") {
|
616
|
+
.foo {a: b}
|
617
|
+
}
|
618
|
+
SCSS
|
619
|
+
end
|
620
|
+
|
621
|
+
def test_supports
|
622
|
+
assert_equal <<CSS, render(<<SCSS)
|
623
|
+
@supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
624
|
+
.foo {
|
625
|
+
a: b; } }
|
626
|
+
@supports (a: b) {
|
627
|
+
.foo {
|
628
|
+
a: b; } }
|
629
|
+
CSS
|
630
|
+
@supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
631
|
+
.foo {
|
632
|
+
a: b;
|
633
|
+
}
|
634
|
+
}
|
635
|
+
|
636
|
+
@supports (a: b) {
|
637
|
+
.foo {
|
638
|
+
a: b;
|
639
|
+
}
|
640
|
+
}
|
641
|
+
SCSS
|
642
|
+
|
643
|
+
assert_equal <<CSS, render(<<SCSS)
|
644
|
+
@-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
645
|
+
.foo {
|
646
|
+
a: b; } }
|
647
|
+
CSS
|
648
|
+
@-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
649
|
+
.foo {
|
650
|
+
a: b;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
SCSS
|
654
|
+
end
|
655
|
+
|
589
656
|
## Selectors
|
590
657
|
|
591
|
-
# Taken from http://
|
592
|
-
def
|
658
|
+
# Taken from http://dev.w3.org/csswg/selectors4/#overview
|
659
|
+
def test_summarized_selectors_with_element
|
593
660
|
assert_selector_parses('*')
|
594
661
|
assert_selector_parses('E')
|
662
|
+
assert_selector_parses('E:not(s)')
|
663
|
+
assert_selector_parses('E:not(s1, s2)')
|
664
|
+
assert_selector_parses('E:matches(s1, s2)')
|
665
|
+
assert_selector_parses('E.warning')
|
666
|
+
assert_selector_parses('E#myid')
|
595
667
|
assert_selector_parses('E[foo]')
|
596
668
|
assert_selector_parses('E[foo="bar"]')
|
669
|
+
assert_selector_parses('E[foo="bar" i]')
|
597
670
|
assert_selector_parses('E[foo~="bar"]')
|
598
671
|
assert_selector_parses('E[foo^="bar"]')
|
599
672
|
assert_selector_parses('E[foo$="bar"]')
|
600
673
|
assert_selector_parses('E[foo*="bar"]')
|
601
674
|
assert_selector_parses('E[foo|="en"]')
|
602
|
-
assert_selector_parses('E:
|
603
|
-
assert_selector_parses('E:
|
604
|
-
assert_selector_parses('E:
|
605
|
-
assert_selector_parses('E:
|
606
|
-
assert_selector_parses('E:nth-last-of-type(n)')
|
607
|
-
assert_selector_parses('E:first-child')
|
608
|
-
assert_selector_parses('E:last-child')
|
609
|
-
assert_selector_parses('E:first-of-type')
|
610
|
-
assert_selector_parses('E:last-of-type')
|
611
|
-
assert_selector_parses('E:only-child')
|
612
|
-
assert_selector_parses('E:only-of-type')
|
613
|
-
assert_selector_parses('E:empty')
|
675
|
+
assert_selector_parses('E:dir(ltr)')
|
676
|
+
assert_selector_parses('E:lang(fr)')
|
677
|
+
assert_selector_parses('E:lang(zh, *-hant)')
|
678
|
+
assert_selector_parses('E:any-link')
|
614
679
|
assert_selector_parses('E:link')
|
615
680
|
assert_selector_parses('E:visited')
|
681
|
+
assert_selector_parses('E:local-link')
|
682
|
+
assert_selector_parses('E:local-link(0)')
|
683
|
+
assert_selector_parses('E:target')
|
684
|
+
assert_selector_parses('E:scope')
|
685
|
+
assert_selector_parses('E:current')
|
686
|
+
assert_selector_parses('E:current(s)')
|
687
|
+
assert_selector_parses('E:past')
|
688
|
+
assert_selector_parses('E:future')
|
616
689
|
assert_selector_parses('E:active')
|
617
690
|
assert_selector_parses('E:hover')
|
618
691
|
assert_selector_parses('E:focus')
|
619
|
-
assert_selector_parses('E:target')
|
620
|
-
assert_selector_parses('E:lang(fr)')
|
621
692
|
assert_selector_parses('E:enabled')
|
622
693
|
assert_selector_parses('E:disabled')
|
623
694
|
assert_selector_parses('E:checked')
|
624
|
-
assert_selector_parses('E
|
625
|
-
assert_selector_parses('E
|
626
|
-
assert_selector_parses('E
|
627
|
-
assert_selector_parses('E
|
628
|
-
assert_selector_parses('E
|
629
|
-
assert_selector_parses('E
|
630
|
-
assert_selector_parses('E:
|
695
|
+
assert_selector_parses('E:indeterminate')
|
696
|
+
assert_selector_parses('E:default')
|
697
|
+
assert_selector_parses('E:in-range')
|
698
|
+
assert_selector_parses('E:out-of-range')
|
699
|
+
assert_selector_parses('E:required')
|
700
|
+
assert_selector_parses('E:optional')
|
701
|
+
assert_selector_parses('E:read-only')
|
702
|
+
assert_selector_parses('E:read-write')
|
703
|
+
assert_selector_parses('E:root')
|
704
|
+
assert_selector_parses('E:empty')
|
705
|
+
assert_selector_parses('E:first-child')
|
706
|
+
assert_selector_parses('E:nth-child(n)')
|
707
|
+
assert_selector_parses('E:last-child')
|
708
|
+
assert_selector_parses('E:nth-last-child(n)')
|
709
|
+
assert_selector_parses('E:only-child')
|
710
|
+
assert_selector_parses('E:first-of-type')
|
711
|
+
assert_selector_parses('E:nth-of-type(n)')
|
712
|
+
assert_selector_parses('E:last-of-type')
|
713
|
+
assert_selector_parses('E:nth-last-of-type(n)')
|
714
|
+
assert_selector_parses('E:only-of-type')
|
715
|
+
assert_selector_parses('E:nth-match(n of selector)')
|
716
|
+
assert_selector_parses('E:nth-last-match(n of selector)')
|
717
|
+
assert_selector_parses('E:column(selector)')
|
718
|
+
assert_selector_parses('E:nth-column(n)')
|
719
|
+
assert_selector_parses('E:nth-last-column(n)')
|
631
720
|
assert_selector_parses('E F')
|
632
721
|
assert_selector_parses('E > F')
|
633
722
|
assert_selector_parses('E + F')
|
634
723
|
assert_selector_parses('E ~ F')
|
724
|
+
assert_selector_parses('E /foo/ F')
|
725
|
+
assert_selector_parses('E! > F')
|
726
|
+
|
727
|
+
assert_selector_parses('E /ns|foo/ F')
|
728
|
+
assert_selector_parses('E /*|foo/ F')
|
635
729
|
end
|
636
730
|
|
637
|
-
# Taken from http://
|
638
|
-
#
|
639
|
-
def
|
731
|
+
# Taken from http://dev.w3.org/csswg/selectors4/#overview, but without element
|
732
|
+
# names.
|
733
|
+
def test_more_summarized_selectors
|
734
|
+
assert_selector_parses(':not(s)')
|
735
|
+
assert_selector_parses(':not(s1, s2)')
|
736
|
+
assert_selector_parses(':matches(s1, s2)')
|
737
|
+
assert_selector_parses('.warning')
|
738
|
+
assert_selector_parses('#myid')
|
640
739
|
assert_selector_parses('[foo]')
|
641
740
|
assert_selector_parses('[foo="bar"]')
|
741
|
+
assert_selector_parses('[foo="bar" i]')
|
642
742
|
assert_selector_parses('[foo~="bar"]')
|
643
743
|
assert_selector_parses('[foo^="bar"]')
|
644
744
|
assert_selector_parses('[foo$="bar"]')
|
645
745
|
assert_selector_parses('[foo*="bar"]')
|
646
746
|
assert_selector_parses('[foo|="en"]')
|
647
|
-
assert_selector_parses(':
|
648
|
-
assert_selector_parses(':
|
649
|
-
assert_selector_parses(':
|
650
|
-
assert_selector_parses(':
|
651
|
-
assert_selector_parses(':nth-last-of-type(n)')
|
652
|
-
assert_selector_parses(':first-child')
|
653
|
-
assert_selector_parses(':last-child')
|
654
|
-
assert_selector_parses(':first-of-type')
|
655
|
-
assert_selector_parses(':last-of-type')
|
656
|
-
assert_selector_parses(':only-child')
|
657
|
-
assert_selector_parses(':only-of-type')
|
658
|
-
assert_selector_parses(':empty')
|
747
|
+
assert_selector_parses(':dir(ltr)')
|
748
|
+
assert_selector_parses(':lang(fr)')
|
749
|
+
assert_selector_parses(':lang(zh, *-hant)')
|
750
|
+
assert_selector_parses(':any-link')
|
659
751
|
assert_selector_parses(':link')
|
660
752
|
assert_selector_parses(':visited')
|
753
|
+
assert_selector_parses(':local-link')
|
754
|
+
assert_selector_parses(':local-link(0)')
|
755
|
+
assert_selector_parses(':target')
|
756
|
+
assert_selector_parses(':scope')
|
757
|
+
assert_selector_parses(':current')
|
758
|
+
assert_selector_parses(':current(s)')
|
759
|
+
assert_selector_parses(':past')
|
760
|
+
assert_selector_parses(':future')
|
661
761
|
assert_selector_parses(':active')
|
662
762
|
assert_selector_parses(':hover')
|
663
763
|
assert_selector_parses(':focus')
|
664
|
-
assert_selector_parses(':target')
|
665
|
-
assert_selector_parses(':lang(fr)')
|
666
764
|
assert_selector_parses(':enabled')
|
667
765
|
assert_selector_parses(':disabled')
|
668
766
|
assert_selector_parses(':checked')
|
669
|
-
assert_selector_parses('
|
670
|
-
assert_selector_parses('
|
671
|
-
assert_selector_parses('
|
672
|
-
assert_selector_parses('
|
673
|
-
assert_selector_parses('
|
674
|
-
assert_selector_parses('
|
675
|
-
assert_selector_parses(':
|
767
|
+
assert_selector_parses(':indeterminate')
|
768
|
+
assert_selector_parses(':default')
|
769
|
+
assert_selector_parses(':in-range')
|
770
|
+
assert_selector_parses(':out-of-range')
|
771
|
+
assert_selector_parses(':required')
|
772
|
+
assert_selector_parses(':optional')
|
773
|
+
assert_selector_parses(':read-only')
|
774
|
+
assert_selector_parses(':read-write')
|
775
|
+
assert_selector_parses(':root')
|
776
|
+
assert_selector_parses(':empty')
|
777
|
+
assert_selector_parses(':first-child')
|
778
|
+
assert_selector_parses(':nth-child(n)')
|
779
|
+
assert_selector_parses(':last-child')
|
780
|
+
assert_selector_parses(':nth-last-child(n)')
|
781
|
+
assert_selector_parses(':only-child')
|
782
|
+
assert_selector_parses(':first-of-type')
|
783
|
+
assert_selector_parses(':nth-of-type(n)')
|
784
|
+
assert_selector_parses(':last-of-type')
|
785
|
+
assert_selector_parses(':nth-last-of-type(n)')
|
786
|
+
assert_selector_parses(':only-of-type')
|
787
|
+
assert_selector_parses(':nth-match(n of selector)')
|
788
|
+
assert_selector_parses(':nth-last-match(n of selector)')
|
789
|
+
assert_selector_parses(':column(selector)')
|
790
|
+
assert_selector_parses(':nth-column(n)')
|
791
|
+
assert_selector_parses(':nth-last-column(n)')
|
676
792
|
end
|
677
793
|
|
678
794
|
def test_attribute_selectors_with_identifiers
|
@@ -709,34 +825,41 @@ CSS
|
|
709
825
|
SCSS
|
710
826
|
end
|
711
827
|
|
712
|
-
def
|
713
|
-
|
714
|
-
|
828
|
+
def test_selectors_containing_selectors
|
829
|
+
assert_selector_can_contain_selectors(':not(<sel>)')
|
830
|
+
assert_selector_can_contain_selectors(':current(<sel>)')
|
831
|
+
assert_selector_can_contain_selectors(':nth-match(n of <sel>)')
|
832
|
+
assert_selector_can_contain_selectors(':nth-last-match(n of <sel>)')
|
833
|
+
assert_selector_can_contain_selectors(':column(<sel>)')
|
834
|
+
assert_selector_can_contain_selectors(':-moz-any(<sel>)')
|
835
|
+
end
|
715
836
|
|
716
|
-
|
717
|
-
assert_selector_parses(
|
837
|
+
def assert_selector_can_contain_selectors(sel)
|
838
|
+
try = lambda {|subsel| assert_selector_parses(sel.gsub('<sel>', subsel))}
|
839
|
+
|
840
|
+
try['foo|bar']
|
841
|
+
try['*|bar']
|
718
842
|
|
719
|
-
|
720
|
-
|
843
|
+
try['foo|*']
|
844
|
+
try['*|*']
|
721
845
|
|
722
|
-
|
723
|
-
|
724
|
-
assert_selector_parses(':not([baz|foo~="bar"])')
|
846
|
+
try['#blah']
|
847
|
+
try['.blah']
|
725
848
|
|
726
|
-
|
727
|
-
|
849
|
+
try['[foo]']
|
850
|
+
try['[foo^="bar"]']
|
851
|
+
try['[baz|foo~="bar"]']
|
728
852
|
|
729
|
-
|
730
|
-
|
731
|
-
assert_selector_parses(':not(a#foo.bar)')
|
732
|
-
assert_selector_parses(':not(#foo .bar > baz)')
|
733
|
-
assert_selector_parses(':not(h1, h2, h3)')
|
734
|
-
end
|
853
|
+
try[':hover']
|
854
|
+
try[':nth-child(2n + 3)']
|
735
855
|
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
856
|
+
try['h1, h2, h3']
|
857
|
+
try['#foo, bar, [baz]']
|
858
|
+
|
859
|
+
# Not technically allowed for most selectors, but what the heck
|
860
|
+
try[':not(#foo)']
|
861
|
+
try['a#foo.bar']
|
862
|
+
try['#foo .bar > baz']
|
740
863
|
end
|
741
864
|
|
742
865
|
def test_namespaced_selectors
|
@@ -800,6 +923,12 @@ SCSS
|
|
800
923
|
assert_selector_parses('E*:hover')
|
801
924
|
end
|
802
925
|
|
926
|
+
def test_spaceless_combo_selectors
|
927
|
+
assert_equal "E > F {\n a: b; }\n", render("E>F { a: b;} ")
|
928
|
+
assert_equal "E ~ F {\n a: b; }\n", render("E~F { a: b;} ")
|
929
|
+
assert_equal "E + F {\n a: b; }\n", render("E+F { a: b;} ")
|
930
|
+
end
|
931
|
+
|
803
932
|
## Errors
|
804
933
|
|
805
934
|
def test_invalid_directives
|
@@ -887,6 +1016,32 @@ SCSS
|
|
887
1016
|
|
888
1017
|
## Regressions
|
889
1018
|
|
1019
|
+
def test_double_space_string
|
1020
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1021
|
+
.a {
|
1022
|
+
content: " a"; }
|
1023
|
+
CSS
|
1024
|
+
.a {
|
1025
|
+
content: " a";
|
1026
|
+
}
|
1027
|
+
SCSS
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
def test_very_long_number_with_important_doesnt_take_forever
|
1031
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1032
|
+
.foo {
|
1033
|
+
width: 97.916666666666666666666666666667% !important; }
|
1034
|
+
CSS
|
1035
|
+
.foo {
|
1036
|
+
width: 97.916666666666666666666666666667% !important;
|
1037
|
+
}
|
1038
|
+
SCSS
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
def test_selector_without_closing_bracket
|
1042
|
+
assert_not_parses('"]"', "foo[bar <err>{a: b}")
|
1043
|
+
end
|
1044
|
+
|
890
1045
|
def test_closing_line_comment_end_with_compact_output
|
891
1046
|
assert_equal(<<CSS, render(<<SCSS, :style => :compact))
|
892
1047
|
/* foo */
|
@@ -899,6 +1054,33 @@ bar {baz: bang}
|
|
899
1054
|
SCSS
|
900
1055
|
end
|
901
1056
|
|
1057
|
+
def test_single_line_comment_within_multiline_comment
|
1058
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1059
|
+
body {
|
1060
|
+
/*
|
1061
|
+
//comment here
|
1062
|
+
*/ }
|
1063
|
+
CSS
|
1064
|
+
body {
|
1065
|
+
/*
|
1066
|
+
//comment here
|
1067
|
+
*/
|
1068
|
+
}
|
1069
|
+
SCSS
|
1070
|
+
end
|
1071
|
+
|
1072
|
+
def test_malformed_media
|
1073
|
+
render <<SCSS
|
1074
|
+
@media {
|
1075
|
+
margin: 0;
|
1076
|
+
}
|
1077
|
+
SCSS
|
1078
|
+
assert(false, "Expected syntax error")
|
1079
|
+
rescue Sass::SyntaxError => e
|
1080
|
+
assert_equal 'Invalid CSS after "@media ": expected media query (e.g. print, screen, print and screen), was "{"', e.message
|
1081
|
+
assert_equal 1, e.sass_line
|
1082
|
+
end
|
1083
|
+
|
902
1084
|
private
|
903
1085
|
|
904
1086
|
def assert_selector_parses(selector)
|
@@ -909,7 +1091,7 @@ SCSS
|
|
909
1091
|
end
|
910
1092
|
|
911
1093
|
def render(scss, options = {})
|
912
|
-
tree = Sass::SCSS::CssParser.new(scss).parse
|
1094
|
+
tree = Sass::SCSS::CssParser.new(scss, options[:filename], nil).parse
|
913
1095
|
tree.options = Sass::Engine::DEFAULT_OPTIONS.merge(options)
|
914
1096
|
tree.render
|
915
1097
|
end
|