sass 3.5.0.pre.rc.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +1 -1
- data/Rakefile +40 -11
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/extra/sass-spec-ref.sh +32 -0
- data/lib/sass.rb +3 -3
- data/lib/sass/css.rb +1 -1
- data/lib/sass/deprecation.rb +55 -0
- data/lib/sass/engine.rb +16 -12
- data/lib/sass/environment.rb +1 -1
- data/lib/sass/error.rb +3 -3
- data/lib/sass/exec/base.rb +1 -1
- data/lib/sass/plugin.rb +1 -1
- data/lib/sass/plugin/compiler.rb +1 -1
- data/lib/sass/plugin/configuration.rb +2 -2
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/staleness_checker.rb +3 -3
- data/lib/sass/script.rb +3 -3
- data/lib/sass/script/functions.rb +23 -22
- data/lib/sass/script/lexer.rb +17 -8
- data/lib/sass/script/parser.rb +8 -7
- data/lib/sass/script/tree/node.rb +2 -2
- data/lib/sass/script/tree/operation.rb +43 -16
- data/lib/sass/script/value/base.rb +3 -3
- data/lib/sass/script/value/color.rb +15 -10
- data/lib/sass/script/value/helpers.rb +13 -2
- data/lib/sass/script/value/list.rb +2 -2
- data/lib/sass/script/value/number.rb +4 -4
- data/lib/sass/script/value/string.rb +5 -12
- data/lib/sass/scss/parser.rb +7 -4
- data/lib/sass/scss/rx.rb +1 -1
- data/lib/sass/scss/static_parser.rb +12 -24
- data/lib/sass/selector/abstract_sequence.rb +12 -11
- data/lib/sass/selector/comma_sequence.rb +18 -3
- data/lib/sass/selector/pseudo.rb +15 -2
- data/lib/sass/selector/sequence.rb +9 -7
- data/lib/sass/selector/simple.rb +5 -4
- data/lib/sass/selector/simple_sequence.rb +7 -3
- data/lib/sass/shared.rb +5 -3
- data/lib/sass/source/map.rb +2 -2
- data/lib/sass/source/position.rb +4 -4
- data/lib/sass/tree/comment_node.rb +1 -1
- data/lib/sass/tree/node.rb +3 -3
- data/lib/sass/tree/prop_node.rb +1 -1
- data/lib/sass/tree/rule_node.rb +15 -6
- data/lib/sass/tree/visitors/cssize.rb +3 -5
- data/lib/sass/tree/visitors/deep_copy.rb +1 -1
- data/lib/sass/tree/visitors/extend.rb +2 -8
- data/lib/sass/tree/visitors/perform.rb +3 -2
- data/lib/sass/tree/visitors/to_css.rb +3 -3
- data/lib/sass/util.rb +32 -5
- data/lib/sass/version.rb +2 -4
- data/test/sass/cache_test.rb +0 -1
- data/test/sass/callbacks_test.rb +0 -1
- data/test/sass/compiler_test.rb +0 -1
- data/test/sass/conversion_test.rb +3 -4
- data/test/sass/css2sass_test.rb +1 -2
- data/test/sass/css_variable_test.rb +0 -1
- data/test/sass/encoding_test.rb +0 -1
- data/test/sass/engine_test.rb +63 -60
- data/test/sass/exec_test.rb +0 -1
- data/test/sass/extend_test.rb +40 -81
- data/test/sass/functions_test.rb +8 -6
- data/test/sass/importer_test.rb +0 -1
- data/test/sass/logger_test.rb +0 -1
- data/test/sass/more_templates/more1.sass +10 -10
- data/test/sass/more_templates/more_import.sass +2 -2
- data/test/sass/plugin_test.rb +3 -4
- data/test/sass/results/script.css +1 -1
- data/test/sass/results/units.css +2 -2
- data/test/sass/script_conversion_test.rb +1 -2
- data/test/sass/script_test.rb +55 -47
- data/test/sass/scss/css_test.rb +2 -3
- data/test/sass/scss/rx_test.rb +0 -1
- data/test/sass/scss/scss_test.rb +26 -12
- data/test/sass/source_map_test.rb +13 -14
- data/test/sass/superselector_test.rb +0 -1
- data/test/sass/templates/_partial.sass +1 -1
- data/test/sass/templates/basic.sass +10 -10
- data/test/sass/templates/bork1.sass +1 -1
- data/test/sass/templates/bork5.sass +1 -1
- data/test/sass/templates/compact.sass +10 -10
- data/test/sass/templates/complex.sass +187 -187
- data/test/sass/templates/compressed.sass +10 -10
- data/test/sass/templates/expanded.sass +10 -10
- data/test/sass/templates/import.sass +2 -2
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/mixins.sass +22 -22
- data/test/sass/templates/multiline.sass +4 -4
- data/test/sass/templates/nested.sass +13 -13
- data/test/sass/templates/parent_ref.sass +12 -12
- data/test/sass/templates/script.sass +70 -70
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
- data/test/sass/templates/subdir/subdir.sass +3 -3
- data/test/sass/templates/units.sass +10 -10
- data/test/sass/util/multibyte_string_scanner_test.rb +10 -3
- data/test/sass/util/normalized_map_test.rb +0 -1
- data/test/sass/util/subset_map_test.rb +0 -1
- data/test/sass/util_test.rb +4 -3
- data/test/sass/value_helpers_test.rb +0 -1
- metadata +15 -13
data/test/sass/engine_test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# -*- coding: utf-8 -*-
|
3
2
|
require File.dirname(__FILE__) + '/../test_helper'
|
4
3
|
require File.dirname(__FILE__) + '/test_helper'
|
@@ -98,8 +97,6 @@ MSG
|
|
98
97
|
"a\n\t\tb: c\n\tb: c" => ["Inconsistent indentation: 1 tab was used for indentation, but the rest of the document was indented using 2 tabs.", 3],
|
99
98
|
"a\n b: c\n b: c" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 3],
|
100
99
|
"a\n b: c\n a\n d: e" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 4],
|
101
|
-
"a\n b: c\na\n d: e" => ["The line was indented 2 levels deeper than the previous line.", 4],
|
102
|
-
"a\n b: c\n a\n d: e" => ["The line was indented 3 levels deeper than the previous line.", 4],
|
103
100
|
"a\n \tb: c" => ["Indentation can't use both tabs and spaces.", 2],
|
104
101
|
"=a(" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ""',
|
105
102
|
"=a(b)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "b)"',
|
@@ -139,7 +136,7 @@ MSG
|
|
139
136
|
'@for $a from "foo" to 1' => '"foo" is not an integer.',
|
140
137
|
'@for $a from 1 to "2"' => '"2" is not an integer.',
|
141
138
|
'@for $a from 1 to "foo"' => '"foo" is not an integer.',
|
142
|
-
'@for $a from 1 to 1.
|
139
|
+
'@for $a from 1 to 1.23232323232' => '1.2323232323 is not an integer.',
|
143
140
|
'@for $a from 1px to 3em' => "Incompatible units: 'em' and 'px'.",
|
144
141
|
'@if' => "Invalid if directive '@if': expected expression.",
|
145
142
|
'@while' => "Invalid while directive '@while': expected expression.",
|
@@ -288,10 +285,10 @@ ERROR
|
|
288
285
|
def test_exception_line
|
289
286
|
to_render = <<SASS
|
290
287
|
rule
|
291
|
-
:
|
288
|
+
prop: val
|
292
289
|
// comment!
|
293
290
|
|
294
|
-
:
|
291
|
+
broken:
|
295
292
|
SASS
|
296
293
|
begin
|
297
294
|
Sass::Engine.new(to_render).render
|
@@ -305,10 +302,10 @@ SASS
|
|
305
302
|
def test_exception_location
|
306
303
|
to_render = <<SASS
|
307
304
|
rule
|
308
|
-
:
|
305
|
+
prop: val
|
309
306
|
// comment!
|
310
307
|
|
311
|
-
:
|
308
|
+
broken:
|
312
309
|
SASS
|
313
310
|
begin
|
314
311
|
Sass::Engine.new(to_render, :filename => FAKE_FILE_NAME, :line => (__LINE__-7)).render
|
@@ -749,22 +746,22 @@ SASS
|
|
749
746
|
|
750
747
|
def test_basic_multiline_selector
|
751
748
|
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
752
|
-
render("#foo #bar,\n#baz #boom\n :
|
749
|
+
render("#foo #bar,\n#baz #boom\n foo: bar"))
|
753
750
|
assert_equal("#foo #bar,\n#foo #baz {\n foo: bar; }\n",
|
754
|
-
render("#foo\n #bar,\n #baz\n :
|
751
|
+
render("#foo\n #bar,\n #baz\n foo: bar"))
|
755
752
|
assert_equal("#foo,\n#bar {\n foo: bar; }\n #foo #baz,\n #bar #baz {\n foo: bar; }\n",
|
756
|
-
render("#foo,\n#bar\n :
|
753
|
+
render("#foo,\n#bar\n foo: bar\n #baz\n foo: bar"))
|
757
754
|
assert_equal("#foo #bar, #baz #boom { foo: bar; }\n",
|
758
|
-
render("#foo #bar,\n#baz #boom\n :
|
755
|
+
render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compact))
|
759
756
|
|
760
757
|
assert_equal("#foo #bar,#baz #boom{foo:bar}\n",
|
761
|
-
render("#foo #bar,\n#baz #boom\n :
|
758
|
+
render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compressed))
|
762
759
|
|
763
760
|
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
764
|
-
render("#foo #bar,,\n,#baz #boom,\n :
|
761
|
+
render("#foo #bar,,\n,#baz #boom,\n foo: bar"))
|
765
762
|
|
766
763
|
assert_equal("#bip #bop {\n foo: bar; }\n",
|
767
|
-
render("#bip #bop,, ,\n :
|
764
|
+
render("#bip #bop,, ,\n foo: bar"))
|
768
765
|
end
|
769
766
|
|
770
767
|
def test_complex_multiline_selector
|
@@ -783,7 +780,7 @@ SASS
|
|
783
780
|
end
|
784
781
|
|
785
782
|
begin
|
786
|
-
render("a\n :b c", :property_syntax => :new)
|
783
|
+
silence_warnings {render("a\n :b c", :property_syntax => :new)}
|
787
784
|
assert_equal(2, e.sass_line)
|
788
785
|
rescue Sass::SyntaxError => e
|
789
786
|
assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
|
@@ -806,53 +803,53 @@ SASS
|
|
806
803
|
def test_directive
|
807
804
|
assert_equal("@a b;\n", render("@a b"))
|
808
805
|
|
809
|
-
assert_equal("@a {\n b: c; }\n", render("@a\n :
|
810
|
-
assert_equal("@a { b: c; }\n", render("@a\n :
|
811
|
-
assert_equal("@a {\n b: c;\n}\n", render("@a\n :
|
812
|
-
assert_equal("@a{b:c}\n", render("@a\n :
|
806
|
+
assert_equal("@a {\n b: c; }\n", render("@a\n b: c"))
|
807
|
+
assert_equal("@a { b: c; }\n", render("@a\n b: c", :style => :compact))
|
808
|
+
assert_equal("@a {\n b: c;\n}\n", render("@a\n b: c", :style => :expanded))
|
809
|
+
assert_equal("@a{b:c}\n", render("@a\n b: c", :style => :compressed))
|
813
810
|
|
814
811
|
assert_equal("@a {\n b: c;\n d: e; }\n",
|
815
|
-
render("@a\n :
|
812
|
+
render("@a\n b: c\n d: e"))
|
816
813
|
assert_equal("@a { b: c; d: e; }\n",
|
817
|
-
render("@a\n :
|
814
|
+
render("@a\n b: c\n d: e", :style => :compact))
|
818
815
|
assert_equal("@a {\n b: c;\n d: e;\n}\n",
|
819
|
-
render("@a\n :
|
816
|
+
render("@a\n b: c\n d: e", :style => :expanded))
|
820
817
|
assert_equal("@a{b:c;d:e}\n",
|
821
|
-
render("@a\n :
|
818
|
+
render("@a\n b: c\n d: e", :style => :compressed))
|
822
819
|
|
823
820
|
assert_equal("@a {\n #b {\n c: d; } }\n",
|
824
|
-
render("@a\n #b\n :
|
821
|
+
render("@a\n #b\n c: d"))
|
825
822
|
assert_equal("@a { #b { c: d; } }\n",
|
826
|
-
render("@a\n #b\n :
|
823
|
+
render("@a\n #b\n c: d", :style => :compact))
|
827
824
|
assert_equal("@a {\n #b {\n c: d;\n }\n}\n",
|
828
|
-
render("@a\n #b\n :
|
825
|
+
render("@a\n #b\n c: d", :style => :expanded))
|
829
826
|
assert_equal("@a{#b{c:d}}\n",
|
830
|
-
render("@a\n #b\n :
|
827
|
+
render("@a\n #b\n c: d", :style => :compressed))
|
831
828
|
|
832
829
|
assert_equal("@a {\n #b {\n a: b; }\n #b #c {\n d: e; } }\n",
|
833
|
-
render("@a\n #b\n :
|
830
|
+
render("@a\n #b\n a: b\n #c\n d: e"))
|
834
831
|
assert_equal("@a { #b { a: b; }\n #b #c { d: e; } }\n",
|
835
|
-
render("@a\n #b\n :
|
832
|
+
render("@a\n #b\n a: b\n #c\n d: e", :style => :compact))
|
836
833
|
assert_equal("@a {\n #b {\n a: b;\n }\n #b #c {\n d: e;\n }\n}\n",
|
837
|
-
render("@a\n #b\n :
|
834
|
+
render("@a\n #b\n a: b\n #c\n d: e", :style => :expanded))
|
838
835
|
assert_equal("@a{#b{a:b}#b #c{d:e}}\n",
|
839
|
-
render("@a\n #b\n :
|
836
|
+
render("@a\n #b\n a: b\n #c\n d: e", :style => :compressed))
|
840
837
|
|
841
838
|
assert_equal("@a {\n #foo,\n #bar {\n b: c; } }\n",
|
842
|
-
render("@a\n #foo, \n #bar\n :
|
839
|
+
render("@a\n #foo, \n #bar\n b: c"))
|
843
840
|
assert_equal("@a { #foo, #bar { b: c; } }\n",
|
844
|
-
render("@a\n #foo, \n #bar\n :
|
841
|
+
render("@a\n #foo, \n #bar\n b: c", :style => :compact))
|
845
842
|
assert_equal("@a {\n #foo,\n #bar {\n b: c;\n }\n}\n",
|
846
|
-
render("@a\n #foo, \n #bar\n :
|
843
|
+
render("@a\n #foo, \n #bar\n b: c", :style => :expanded))
|
847
844
|
assert_equal("@a{#foo,#bar{b:c}}\n",
|
848
|
-
render("@a\n #foo, \n #bar\n :
|
845
|
+
render("@a\n #foo, \n #bar\n b: c", :style => :compressed))
|
849
846
|
|
850
847
|
to_render = <<END
|
851
848
|
@a
|
852
|
-
:
|
849
|
+
b: c
|
853
850
|
#d
|
854
|
-
:
|
855
|
-
:
|
851
|
+
e: f
|
852
|
+
g: h
|
856
853
|
END
|
857
854
|
rendered = <<END
|
858
855
|
@a { b: c;
|
@@ -1141,7 +1138,7 @@ black {
|
|
1141
1138
|
color: #000; }
|
1142
1139
|
CSS
|
1143
1140
|
=foo($a: #FFF)
|
1144
|
-
:
|
1141
|
+
color: $a
|
1145
1142
|
white
|
1146
1143
|
+foo
|
1147
1144
|
black
|
@@ -1165,9 +1162,9 @@ three {
|
|
1165
1162
|
CSS
|
1166
1163
|
$a: 5px
|
1167
1164
|
=foo($a, $b: 1px, $c: 3px + $b)
|
1168
|
-
:
|
1169
|
-
:
|
1170
|
-
:
|
1165
|
+
color: $a
|
1166
|
+
padding: $b
|
1167
|
+
margin: $c
|
1171
1168
|
one
|
1172
1169
|
+foo(#fff)
|
1173
1170
|
two
|
@@ -1793,7 +1790,7 @@ SASS
|
|
1793
1790
|
|
1794
1791
|
def test_loud_comment_is_evaluated
|
1795
1792
|
assert_equal <<CSS, render(<<SASS)
|
1796
|
-
/*! Hue: 327.
|
1793
|
+
/*! Hue: 327.2164948454deg */
|
1797
1794
|
CSS
|
1798
1795
|
/*! Hue: \#{hue(#f836a0)}
|
1799
1796
|
SASS
|
@@ -2598,29 +2595,29 @@ SASS
|
|
2598
2595
|
border-style: solid; }
|
2599
2596
|
RESULT
|
2600
2597
|
.box
|
2601
|
-
:
|
2602
|
-
|
2603
|
-
:
|
2598
|
+
border:
|
2599
|
+
//color: black
|
2600
|
+
style: solid
|
2604
2601
|
SOURCE
|
2605
2602
|
|
2606
2603
|
assert_equal(<<RESULT, render(<<SOURCE))
|
2607
2604
|
.box {
|
2608
|
-
/* :
|
2605
|
+
/* color: black */
|
2609
2606
|
border-style: solid; }
|
2610
2607
|
RESULT
|
2611
2608
|
.box
|
2612
|
-
:
|
2613
|
-
/* :
|
2614
|
-
:
|
2609
|
+
border:
|
2610
|
+
/* color: black
|
2611
|
+
style: solid
|
2615
2612
|
SOURCE
|
2616
2613
|
|
2617
2614
|
assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
|
2618
2615
|
.box{border-style:solid}
|
2619
2616
|
RESULT
|
2620
2617
|
.box
|
2621
|
-
:
|
2622
|
-
|
2623
|
-
:
|
2618
|
+
border:
|
2619
|
+
/*color: black
|
2620
|
+
style: solid
|
2624
2621
|
SOURCE
|
2625
2622
|
end
|
2626
2623
|
|
@@ -3315,13 +3312,13 @@ SASS
|
|
3315
3312
|
|
3316
3313
|
def test_numeric_formatting_of_integers
|
3317
3314
|
assert_equal(<<CSS, render(<<SASS, :syntax => :scss, :style => :compressed))
|
3318
|
-
a{near:3.
|
3315
|
+
a{near:3.0000000001;plus:3;minus:3;negative:-3}
|
3319
3316
|
CSS
|
3320
3317
|
a {
|
3321
|
-
near: (3 + 0.
|
3322
|
-
plus: (3 + 0.
|
3323
|
-
minus: (3 - 0.
|
3324
|
-
negative: (-3 + 0.
|
3318
|
+
near: (3 + 0.0000000001);
|
3319
|
+
plus: (3 + 0.000000000001);
|
3320
|
+
minus: (3 - 0.000000000001);
|
3321
|
+
negative: (-3 + 0.000000000001);
|
3325
3322
|
}
|
3326
3323
|
SASS
|
3327
3324
|
end
|
@@ -3449,7 +3446,13 @@ SASS
|
|
3449
3446
|
private
|
3450
3447
|
|
3451
3448
|
def assert_hash_has(hash, expected)
|
3452
|
-
expected.each
|
3449
|
+
expected.each do |k, v|
|
3450
|
+
if v.nil?
|
3451
|
+
assert_nil(hash[k])
|
3452
|
+
else
|
3453
|
+
assert_equal(v, hash[k])
|
3454
|
+
end
|
3455
|
+
end
|
3453
3456
|
end
|
3454
3457
|
|
3455
3458
|
def assert_renders_encoded(css, sass)
|
data/test/sass/exec_test.rb
CHANGED
data/test/sass/extend_test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
3
2
|
|
4
3
|
class ExtendTest < MiniTest::Test
|
@@ -152,10 +151,7 @@ SCSS
|
|
152
151
|
def test_id_unification
|
153
152
|
assert_unification '.foo.bar', '#baz {@extend .foo}', '.foo.bar, .bar#baz'
|
154
153
|
assert_unification '.foo#baz', '#baz {@extend .foo}', '#baz'
|
155
|
-
|
156
|
-
assert_extend_doesnt_match('#bar', '.foo', :failed_to_unify, 2) do
|
157
|
-
render_unification '.foo#baz', '#bar {@extend .foo}'
|
158
|
-
end
|
154
|
+
assert_unification '.foo#baz', '#bar {@extend .foo}', '.foo#baz'
|
159
155
|
end
|
160
156
|
|
161
157
|
def test_universal_unification_with_simple_target
|
@@ -167,42 +163,34 @@ SCSS
|
|
167
163
|
end
|
168
164
|
|
169
165
|
def test_universal_unification_with_namespaceless_universal_target
|
166
|
+
assert_unification '*.foo', 'ns|* {@extend .foo}', '*.foo'
|
170
167
|
assert_unification '*.foo', '* {@extend .foo}', '*'
|
171
168
|
assert_unification '*.foo', '*|* {@extend .foo}', '*'
|
172
169
|
assert_unification '*|*.foo', '* {@extend .foo}', '*|*.foo, *'
|
173
170
|
assert_unification '*|*.foo', '*|* {@extend .foo}', '*|*'
|
174
|
-
assert_unification '*.foo', 'ns|* {@extend .foo}', '*.foo, ns|*'
|
175
171
|
assert_unification '*|*.foo', 'ns|* {@extend .foo}', '*|*.foo, ns|*'
|
176
172
|
end
|
177
173
|
|
178
174
|
def test_universal_unification_with_namespaced_universal_target
|
179
|
-
assert_unification 'ns|*.foo', '* {@extend .foo}', 'ns
|
175
|
+
assert_unification 'ns|*.foo', '* {@extend .foo}', 'ns|*.foo'
|
176
|
+
assert_unification 'ns1|*.foo', 'ns2|* {@extend .foo}', 'ns1|*.foo'
|
180
177
|
assert_unification 'ns|*.foo', '*|* {@extend .foo}', 'ns|*'
|
181
|
-
|
182
|
-
assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
|
183
|
-
render_unification 'ns1|*.foo', 'ns2|* {@extend .foo}'
|
184
|
-
end
|
185
|
-
|
186
178
|
assert_unification 'ns|*.foo', 'ns|* {@extend .foo}', 'ns|*'
|
187
179
|
end
|
188
180
|
|
189
181
|
def test_universal_unification_with_namespaceless_element_target
|
182
|
+
assert_unification 'a.foo', 'ns|* {@extend .foo}', 'a.foo'
|
190
183
|
assert_unification 'a.foo', '* {@extend .foo}', 'a'
|
191
184
|
assert_unification 'a.foo', '*|* {@extend .foo}', 'a'
|
192
185
|
assert_unification '*|a.foo', '* {@extend .foo}', '*|a.foo, a'
|
193
186
|
assert_unification '*|a.foo', '*|* {@extend .foo}', '*|a'
|
194
|
-
assert_unification 'a.foo', 'ns|* {@extend .foo}', 'a.foo, ns|a'
|
195
187
|
assert_unification '*|a.foo', 'ns|* {@extend .foo}', '*|a.foo, ns|a'
|
196
188
|
end
|
197
189
|
|
198
190
|
def test_universal_unification_with_namespaced_element_target
|
199
|
-
assert_unification 'ns|a.foo', '* {@extend .foo}', 'ns|a'
|
191
|
+
assert_unification 'ns|a.foo', '* {@extend .foo}', 'ns|a.foo'
|
192
|
+
assert_unification 'ns1|a.foo', 'ns2|* {@extend .foo}', 'ns1|a.foo'
|
200
193
|
assert_unification 'ns|a.foo', '*|* {@extend .foo}', 'ns|a'
|
201
|
-
|
202
|
-
assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
|
203
|
-
render_unification 'ns1|a.foo', 'ns2|* {@extend .foo}'
|
204
|
-
end
|
205
|
-
|
206
194
|
assert_unification 'ns|a.foo', 'ns|* {@extend .foo}', 'ns|a'
|
207
195
|
end
|
208
196
|
|
@@ -214,46 +202,35 @@ SCSS
|
|
214
202
|
end
|
215
203
|
|
216
204
|
def test_element_unification_with_namespaceless_universal_target
|
205
|
+
assert_unification '*.foo', 'ns|a {@extend .foo}', '*.foo'
|
217
206
|
assert_unification '*.foo', 'a {@extend .foo}', '*.foo, a'
|
218
207
|
assert_unification '*.foo', '*|a {@extend .foo}', '*.foo, a'
|
219
208
|
assert_unification '*|*.foo', 'a {@extend .foo}', '*|*.foo, a'
|
220
209
|
assert_unification '*|*.foo', '*|a {@extend .foo}', '*|*.foo, *|a'
|
221
|
-
assert_unification '*.foo', 'ns|a {@extend .foo}', '*.foo, ns|a'
|
222
210
|
assert_unification '*|*.foo', 'ns|a {@extend .foo}', '*|*.foo, ns|a'
|
223
211
|
end
|
224
212
|
|
225
213
|
def test_element_unification_with_namespaced_universal_target
|
226
|
-
assert_unification 'ns|*.foo', 'a {@extend .foo}', 'ns|*.foo
|
214
|
+
assert_unification 'ns|*.foo', 'a {@extend .foo}', 'ns|*.foo'
|
215
|
+
assert_unification 'ns1|*.foo', 'ns2|a {@extend .foo}', 'ns1|*.foo'
|
227
216
|
assert_unification 'ns|*.foo', '*|a {@extend .foo}', 'ns|*.foo, ns|a'
|
228
|
-
|
229
|
-
assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
|
230
|
-
render_unification 'ns1|*.foo', 'ns2|a {@extend .foo}'
|
231
|
-
end
|
232
|
-
|
233
217
|
assert_unification 'ns|*.foo', 'ns|a {@extend .foo}', 'ns|*.foo, ns|a'
|
234
218
|
end
|
235
219
|
|
236
220
|
def test_element_unification_with_namespaceless_element_target
|
221
|
+
assert_unification 'a.foo', 'ns|a {@extend .foo}', 'a.foo'
|
222
|
+
assert_unification 'a.foo', 'h1 {@extend .foo}', 'a.foo'
|
237
223
|
assert_unification 'a.foo', 'a {@extend .foo}', 'a'
|
238
224
|
assert_unification 'a.foo', '*|a {@extend .foo}', 'a'
|
239
225
|
assert_unification '*|a.foo', 'a {@extend .foo}', '*|a.foo, a'
|
240
226
|
assert_unification '*|a.foo', '*|a {@extend .foo}', '*|a'
|
241
|
-
assert_unification 'a.foo', 'ns|a {@extend .foo}', 'a.foo, ns|a'
|
242
227
|
assert_unification '*|a.foo', 'ns|a {@extend .foo}', '*|a.foo, ns|a'
|
243
|
-
|
244
|
-
assert_extend_doesnt_match('h1', '.foo', :failed_to_unify, 2) do
|
245
|
-
render_unification 'a.foo', 'h1 {@extend .foo}'
|
246
|
-
end
|
247
228
|
end
|
248
229
|
|
249
230
|
def test_element_unification_with_namespaced_element_target
|
250
|
-
assert_unification 'ns|a.foo', 'a {@extend .foo}', 'ns|a'
|
231
|
+
assert_unification 'ns|a.foo', 'a {@extend .foo}', 'ns|a.foo'
|
232
|
+
assert_unification 'ns1|a.foo', 'ns2|a {@extend .foo}', 'ns1|a.foo'
|
251
233
|
assert_unification 'ns|a.foo', '*|a {@extend .foo}', 'ns|a'
|
252
|
-
|
253
|
-
assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
|
254
|
-
render_unification 'ns1|a.foo', 'ns2|a {@extend .foo}'
|
255
|
-
end
|
256
|
-
|
257
234
|
assert_unification 'ns|a.foo', 'ns|a {@extend .foo}', 'ns|a'
|
258
235
|
end
|
259
236
|
|
@@ -268,15 +245,8 @@ SCSS
|
|
268
245
|
def test_pseudo_unification
|
269
246
|
assert_unification ':foo.baz', ':foo(2n+1) {@extend .baz}', ':foo.baz, :foo:foo(2n+1)'
|
270
247
|
assert_unification ':foo.baz', '::foo {@extend .baz}', ':foo.baz, :foo::foo'
|
271
|
-
|
272
|
-
|
273
|
-
render_unification '::foo.baz', '::bar {@extend .baz}'
|
274
|
-
end
|
275
|
-
|
276
|
-
assert_extend_doesnt_match('::foo(2n+1)', '.baz', :failed_to_unify, 2) do
|
277
|
-
render_unification '::foo.baz', '::foo(2n+1) {@extend .baz}'
|
278
|
-
end
|
279
|
-
|
248
|
+
assert_unification '::foo.baz', '::bar {@extend .baz}', '::foo.baz'
|
249
|
+
assert_unification '::foo.baz', '::foo(2n+1) {@extend .baz}', '::foo.baz'
|
280
250
|
assert_unification '::foo.baz', '::foo {@extend .baz}', '::foo'
|
281
251
|
assert_unification '::foo(2n+1).baz', '::foo(2n+1) {@extend .baz}', '::foo(2n+1)'
|
282
252
|
assert_unification ':foo.baz', ':bar {@extend .baz}', ':foo.baz, :foo:bar'
|
@@ -565,21 +535,27 @@ SCSS
|
|
565
535
|
## Long Extendees
|
566
536
|
|
567
537
|
def test_long_extendee
|
568
|
-
assert_extends '.foo.bar', '.baz {@extend .foo.bar}', '.foo.bar, .baz'
|
538
|
+
assert_warning(<<WARNING) {assert_extends '.foo.bar', '.baz {@extend .foo.bar}', '.foo.bar, .baz'}
|
539
|
+
DEPRECATION WARNING on line 2 of test_long_extendee_inline.scss:
|
540
|
+
Extending a compound selector, .foo.bar, is deprecated and will not be supported in a future release.
|
541
|
+
See https://github.com/sass/sass/issues/1599 for details.
|
542
|
+
WARNING
|
569
543
|
end
|
570
544
|
|
571
545
|
def test_long_extendee_requires_all_selectors
|
572
|
-
|
573
|
-
|
546
|
+
silence_warnings do
|
547
|
+
assert_extend_doesnt_match('.baz', '.foo.bar', :not_found, 2) do
|
548
|
+
render_extends '.foo', '.baz {@extend .foo.bar}'
|
549
|
+
end
|
574
550
|
end
|
575
551
|
end
|
576
552
|
|
577
553
|
def test_long_extendee_matches_supersets
|
578
|
-
assert_extends '.foo.bar.bap', '.baz {@extend .foo.bar}', '.foo.bar.bap, .bap.baz'
|
554
|
+
silence_warnings {assert_extends '.foo.bar.bap', '.baz {@extend .foo.bar}', '.foo.bar.bap, .bap.baz'}
|
579
555
|
end
|
580
556
|
|
581
557
|
def test_long_extendee_runs_unification
|
582
|
-
assert_extends 'ns|*.foo.bar', 'a.baz {@extend .foo.bar}', 'ns|*.foo.bar, ns|a.baz'
|
558
|
+
silence_warnings {assert_extends 'ns|*.foo.bar', '*|a.baz {@extend .foo.bar}', 'ns|*.foo.bar, ns|a.baz'}
|
583
559
|
end
|
584
560
|
|
585
561
|
## Long Extenders
|
@@ -589,17 +565,12 @@ SCSS
|
|
589
565
|
end
|
590
566
|
|
591
567
|
def test_long_extender_runs_unification
|
592
|
-
assert_extends 'ns|*.foo.bar', 'a.baz {@extend .foo}', 'ns|*.foo.bar, ns|a.bar.baz'
|
568
|
+
assert_extends 'ns|*.foo.bar', '*|a.baz {@extend .foo}', 'ns|*.foo.bar, ns|a.bar.baz'
|
593
569
|
end
|
594
570
|
|
595
|
-
def
|
596
|
-
|
597
|
-
|
598
|
-
end
|
599
|
-
|
600
|
-
assert_extend_doesnt_match('.bang#baz', '.foo', :failed_to_unify, 2) do
|
601
|
-
render_extends 'a.foo#bar', '.bang#baz {@extend .foo}'
|
602
|
-
end
|
571
|
+
def test_long_extender_doesnt_unify
|
572
|
+
assert_extends 'a.foo#bar', 'h1.baz {@extend .foo}', 'a.foo#bar'
|
573
|
+
assert_extends 'a.foo#bar', '.bang#baz {@extend .foo}', 'a.foo#bar'
|
603
574
|
end
|
604
575
|
|
605
576
|
## Nested Extenders
|
@@ -612,10 +583,8 @@ SCSS
|
|
612
583
|
assert_extends '.foo.bar', 'foo bar {@extend .foo}', '.foo.bar, foo bar.bar'
|
613
584
|
end
|
614
585
|
|
615
|
-
def
|
616
|
-
|
617
|
-
render_extends 'baz.foo', 'foo bar {@extend .foo}'
|
618
|
-
end
|
586
|
+
def test_nested_extender_doesnt_unify
|
587
|
+
assert_extends 'baz.foo', 'foo bar {@extend .foo}', 'baz.foo'
|
619
588
|
end
|
620
589
|
|
621
590
|
def test_nested_extender_alternates_parents
|
@@ -675,9 +644,9 @@ SCSS
|
|
675
644
|
end
|
676
645
|
|
677
646
|
def test_nested_extender_doesnt_find_common_selectors_around_reference_selector
|
678
|
-
assert_extends 'a /for/ b c .c1', 'a c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b a c .c2, a a /for/ b c .c2'
|
679
|
-
assert_extends 'a /for/ b c .c1', 'a b .c2 {@extend .c1}', 'a /for/ b c .c1, a a /for/ b c .c2'
|
680
|
-
assert_extends 'a /for/ b c .c1', 'b c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b c .c2'
|
647
|
+
silence_warnings {assert_extends 'a /for/ b c .c1', 'a c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b a c .c2, a a /for/ b c .c2'}
|
648
|
+
silence_warnings {assert_extends 'a /for/ b c .c1', 'a b .c2 {@extend .c1}', 'a /for/ b c .c1, a a /for/ b c .c2'}
|
649
|
+
silence_warnings {assert_extends 'a /for/ b c .c1', 'b c .c2 {@extend .c1}', 'a /for/ b c .c1, a /for/ b c .c2'}
|
681
650
|
end
|
682
651
|
|
683
652
|
def test_nested_extender_with_early_child_selectors_doesnt_subseq_them
|
@@ -1043,13 +1012,14 @@ SCSS
|
|
1043
1012
|
end
|
1044
1013
|
|
1045
1014
|
def test_placeholder_selector_as_modifier
|
1046
|
-
|
1047
|
-
|
1015
|
+
assert_equal <<CSS, render(<<SCSS)
|
1016
|
+
a.baz.bar {
|
1017
|
+
color: blue; }
|
1018
|
+
CSS
|
1048
1019
|
a%foo.baz {color: blue}
|
1049
1020
|
.bar {@extend %foo}
|
1050
1021
|
div {@extend %foo}
|
1051
1022
|
SCSS
|
1052
|
-
end
|
1053
1023
|
end
|
1054
1024
|
|
1055
1025
|
def test_placeholder_interpolation
|
@@ -1317,17 +1287,6 @@ ERR
|
|
1317
1287
|
SCSS
|
1318
1288
|
end
|
1319
1289
|
|
1320
|
-
def test_extend_warns_when_extension_fails
|
1321
|
-
assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
|
1322
|
-
"b.foo" failed to @extend ".bar".
|
1323
|
-
No selectors matching ".bar" could be unified with "b.foo".
|
1324
|
-
Use "@extend .bar !optional" if the extend should be able to fail.
|
1325
|
-
ERR
|
1326
|
-
a.bar {a: b}
|
1327
|
-
b.foo {@extend .bar}
|
1328
|
-
SCSS
|
1329
|
-
end
|
1330
|
-
|
1331
1290
|
def test_extend_succeeds_when_one_extension_fails_but_others_dont
|
1332
1291
|
assert_equal(<<CSS, render(<<SCSS))
|
1333
1292
|
a.bar {
|