oreorenasass 3.4.4 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +50 -70
- data/Rakefile +5 -26
- data/VERSION +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -1
- data/bin/scss +1 -1
- data/lib/sass.rb +12 -19
- data/lib/sass/cache_stores/base.rb +2 -2
- data/lib/sass/cache_stores/chain.rb +1 -2
- data/lib/sass/cache_stores/filesystem.rb +5 -1
- data/lib/sass/cache_stores/memory.rb +1 -1
- data/lib/sass/cache_stores/null.rb +2 -2
- data/lib/sass/callbacks.rb +0 -1
- data/lib/sass/css.rb +13 -11
- data/lib/sass/engine.rb +173 -424
- data/lib/sass/environment.rb +58 -148
- data/lib/sass/error.rb +14 -11
- data/lib/sass/exec.rb +703 -5
- data/lib/sass/importers/base.rb +6 -49
- data/lib/sass/importers/filesystem.rb +19 -44
- data/lib/sass/logger.rb +4 -1
- data/lib/sass/logger/base.rb +4 -2
- data/lib/sass/logger/log_level.rb +7 -3
- data/lib/sass/media.rb +23 -20
- data/lib/sass/plugin.rb +7 -7
- data/lib/sass/plugin/compiler.rb +145 -304
- data/lib/sass/plugin/configuration.rb +23 -18
- data/lib/sass/plugin/merb.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +3 -3
- data/lib/sass/repl.rb +3 -3
- data/lib/sass/script.rb +8 -35
- data/lib/sass/script/{value/arg_list.rb → arg_list.rb} +25 -9
- data/lib/sass/script/bool.rb +18 -0
- data/lib/sass/script/color.rb +606 -0
- data/lib/sass/script/css_lexer.rb +4 -8
- data/lib/sass/script/css_parser.rb +2 -5
- data/lib/sass/script/funcall.rb +245 -0
- data/lib/sass/script/functions.rb +408 -1491
- data/lib/sass/script/interpolation.rb +79 -0
- data/lib/sass/script/lexer.rb +68 -172
- data/lib/sass/script/list.rb +85 -0
- data/lib/sass/script/literal.rb +221 -0
- data/lib/sass/script/{tree/node.rb → node.rb} +12 -22
- data/lib/sass/script/{value/null.rb → null.rb} +7 -14
- data/lib/sass/script/{value/number.rb → number.rb} +75 -152
- data/lib/sass/script/{tree/operation.rb → operation.rb} +24 -17
- data/lib/sass/script/parser.rb +110 -245
- data/lib/sass/script/string.rb +51 -0
- data/lib/sass/script/{tree/string_interpolation.rb → string_interpolation.rb} +4 -5
- data/lib/sass/script/{tree/unary_operation.rb → unary_operation.rb} +6 -6
- data/lib/sass/script/variable.rb +58 -0
- data/lib/sass/scss/css_parser.rb +3 -9
- data/lib/sass/scss/parser.rb +421 -450
- data/lib/sass/scss/rx.rb +11 -19
- data/lib/sass/scss/static_parser.rb +7 -321
- data/lib/sass/selector.rb +194 -68
- data/lib/sass/selector/abstract_sequence.rb +14 -29
- data/lib/sass/selector/comma_sequence.rb +25 -108
- data/lib/sass/selector/sequence.rb +66 -159
- data/lib/sass/selector/simple.rb +25 -23
- data/lib/sass/selector/simple_sequence.rb +63 -173
- data/lib/sass/shared.rb +1 -1
- data/lib/sass/supports.rb +15 -13
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +3 -3
- data/lib/sass/tree/css_import_node.rb +11 -11
- data/lib/sass/tree/debug_node.rb +2 -2
- data/lib/sass/tree/directive_node.rb +4 -21
- data/lib/sass/tree/each_node.rb +8 -8
- data/lib/sass/tree/extend_node.rb +7 -14
- data/lib/sass/tree/for_node.rb +4 -4
- data/lib/sass/tree/function_node.rb +4 -9
- data/lib/sass/tree/if_node.rb +1 -1
- data/lib/sass/tree/import_node.rb +5 -4
- data/lib/sass/tree/media_node.rb +14 -4
- data/lib/sass/tree/mixin_def_node.rb +4 -4
- data/lib/sass/tree/mixin_node.rb +8 -21
- data/lib/sass/tree/node.rb +12 -54
- data/lib/sass/tree/prop_node.rb +20 -39
- data/lib/sass/tree/return_node.rb +2 -3
- data/lib/sass/tree/root_node.rb +3 -19
- data/lib/sass/tree/rule_node.rb +22 -35
- data/lib/sass/tree/supports_node.rb +13 -0
- data/lib/sass/tree/trace_node.rb +1 -2
- data/lib/sass/tree/variable_node.rb +3 -9
- data/lib/sass/tree/visitors/base.rb +8 -5
- data/lib/sass/tree/visitors/check_nesting.rb +19 -49
- data/lib/sass/tree/visitors/convert.rb +56 -74
- data/lib/sass/tree/visitors/cssize.rb +74 -202
- data/lib/sass/tree/visitors/deep_copy.rb +5 -10
- data/lib/sass/tree/visitors/extend.rb +7 -7
- data/lib/sass/tree/visitors/perform.rb +185 -278
- data/lib/sass/tree/visitors/set_options.rb +6 -20
- data/lib/sass/tree/visitors/to_css.rb +81 -234
- data/lib/sass/tree/warn_node.rb +2 -2
- data/lib/sass/tree/while_node.rb +2 -2
- data/lib/sass/util.rb +152 -522
- data/lib/sass/util/multibyte_string_scanner.rb +0 -2
- data/lib/sass/util/subset_map.rb +3 -4
- data/lib/sass/util/test.rb +1 -0
- data/lib/sass/version.rb +22 -20
- data/test/Gemfile +3 -0
- data/test/Gemfile.lock +10 -0
- data/test/sass/cache_test.rb +20 -62
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/conversion_test.rb +2 -296
- data/test/sass/css2sass_test.rb +4 -23
- data/test/sass/engine_test.rb +354 -411
- data/test/sass/exec_test.rb +2 -2
- data/test/sass/extend_test.rb +145 -324
- data/test/sass/functions_test.rb +86 -873
- data/test/sass/importer_test.rb +21 -241
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/plugin_test.rb +26 -16
- data/test/sass/results/compact.css +1 -1
- data/test/sass/results/complex.css +4 -4
- data/test/sass/results/expanded.css +1 -1
- data/test/sass/results/import.css +1 -1
- data/test/sass/results/import_charset_ibm866.css +2 -2
- data/test/sass/results/mixins.css +17 -17
- data/test/sass/results/nested.css +1 -1
- data/test/sass/results/parent_ref.css +2 -2
- data/test/sass/results/script.css +3 -3
- data/test/sass/results/scss_import.css +1 -1
- data/test/sass/script_conversion_test.rb +7 -36
- data/test/sass/script_test.rb +53 -485
- data/test/sass/scss/css_test.rb +28 -143
- data/test/sass/scss/rx_test.rb +4 -4
- data/test/sass/scss/scss_test.rb +325 -2119
- data/test/sass/templates/scss_import.scss +1 -2
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +1 -1
- data/test/sass/util/subset_map_test.rb +2 -2
- data/test/sass/util_test.rb +1 -86
- data/test/test_helper.rb +8 -37
- metadata +19 -66
- data/lib/sass/exec/base.rb +0 -187
- data/lib/sass/exec/sass_convert.rb +0 -264
- data/lib/sass/exec/sass_scss.rb +0 -424
- data/lib/sass/features.rb +0 -47
- data/lib/sass/script/tree.rb +0 -16
- data/lib/sass/script/tree/funcall.rb +0 -306
- data/lib/sass/script/tree/interpolation.rb +0 -118
- data/lib/sass/script/tree/list_literal.rb +0 -77
- data/lib/sass/script/tree/literal.rb +0 -45
- data/lib/sass/script/tree/map_literal.rb +0 -64
- data/lib/sass/script/tree/selector.rb +0 -26
- data/lib/sass/script/tree/variable.rb +0 -57
- data/lib/sass/script/value.rb +0 -11
- data/lib/sass/script/value/base.rb +0 -240
- data/lib/sass/script/value/bool.rb +0 -35
- data/lib/sass/script/value/color.rb +0 -680
- data/lib/sass/script/value/helpers.rb +0 -262
- data/lib/sass/script/value/list.rb +0 -113
- data/lib/sass/script/value/map.rb +0 -70
- data/lib/sass/script/value/string.rb +0 -97
- data/lib/sass/selector/pseudo.rb +0 -256
- data/lib/sass/source/map.rb +0 -210
- data/lib/sass/source/position.rb +0 -39
- data/lib/sass/source/range.rb +0 -41
- data/lib/sass/stack.rb +0 -120
- data/lib/sass/tree/at_root_node.rb +0 -83
- data/lib/sass/tree/error_node.rb +0 -18
- data/lib/sass/tree/keyframe_rule_node.rb +0 -15
- data/lib/sass/util/cross_platform_random.rb +0 -19
- data/lib/sass/util/normalized_map.rb +0 -130
- data/lib/sass/util/ordered_hash.rb +0 -192
- data/test/sass/compiler_test.rb +0 -232
- data/test/sass/encoding_test.rb +0 -219
- data/test/sass/source_map_test.rb +0 -977
- data/test/sass/superselector_test.rb +0 -191
- data/test/sass/util/normalized_map_test.rb +0 -51
- data/test/sass/value_helpers_test.rb +0 -179
data/test/sass/exec_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
3
3
|
require 'sass/util/test'
|
4
4
|
require 'tmpdir'
|
5
5
|
|
6
|
-
class ExecTest <
|
6
|
+
class ExecTest < Test::Unit::TestCase
|
7
7
|
include Sass::Util::Test
|
8
8
|
|
9
9
|
def setup
|
@@ -19,7 +19,7 @@ class ExecTest < MiniTest::Test
|
|
19
19
|
src = get_path("src.scss")
|
20
20
|
dest = get_path("dest.css")
|
21
21
|
write(src, ".ruleset { margin: 0 }")
|
22
|
-
assert(exec(*%w[scss
|
22
|
+
assert(exec(*%w[scss -t expanded --unix-newlines].push(src, dest)))
|
23
23
|
assert_equal(".ruleset {\n margin: 0;\n}\n", read(dest))
|
24
24
|
end
|
25
25
|
|
data/test/sass/extend_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require File.dirname(__FILE__) + '/../test_helper'
|
3
3
|
|
4
|
-
class ExtendTest <
|
4
|
+
class ExtendTest < Test::Unit::TestCase
|
5
5
|
def test_basic
|
6
6
|
assert_equal <<CSS, render(<<SCSS)
|
7
7
|
.foo, .bar {
|
@@ -145,8 +145,8 @@ SCSS
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def test_class_unification
|
148
|
-
assert_unification '.foo.bar', '.baz {@extend .foo}', '.foo.bar, .bar.baz'
|
149
|
-
assert_unification '.foo.baz', '.baz {@extend .foo}', '.baz'
|
148
|
+
assert_unification '.foo.bar', '.baz {@extend .foo}', '.foo.bar, .bar.baz'
|
149
|
+
assert_unification '.foo.baz', '.baz {@extend .foo}', '.baz'
|
150
150
|
end
|
151
151
|
|
152
152
|
def test_id_unification
|
@@ -154,7 +154,7 @@ SCSS
|
|
154
154
|
assert_unification '.foo#baz', '#baz {@extend .foo}', '#baz'
|
155
155
|
|
156
156
|
assert_extend_doesnt_match('#bar', '.foo', :failed_to_unify, 2) do
|
157
|
-
|
157
|
+
assert_unification '.foo#baz', '#bar {@extend .foo}', '.foo#baz'
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -180,7 +180,7 @@ SCSS
|
|
180
180
|
assert_unification 'ns|*.foo', '*|* {@extend .foo}', 'ns|*'
|
181
181
|
|
182
182
|
assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
|
183
|
-
|
183
|
+
assert_unification 'ns1|*.foo', 'ns2|* {@extend .foo}', 'ns1|*.foo'
|
184
184
|
end
|
185
185
|
|
186
186
|
assert_unification 'ns|*.foo', 'ns|* {@extend .foo}', 'ns|*'
|
@@ -200,7 +200,7 @@ SCSS
|
|
200
200
|
assert_unification 'ns|a.foo', '*|* {@extend .foo}', 'ns|a'
|
201
201
|
|
202
202
|
assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
|
203
|
-
|
203
|
+
assert_unification 'ns1|a.foo', 'ns2|* {@extend .foo}', 'ns1|a.foo'
|
204
204
|
end
|
205
205
|
|
206
206
|
assert_unification 'ns|a.foo', 'ns|* {@extend .foo}', 'ns|a'
|
@@ -227,7 +227,7 @@ SCSS
|
|
227
227
|
assert_unification 'ns|*.foo', '*|a {@extend .foo}', 'ns|*.foo, ns|a'
|
228
228
|
|
229
229
|
assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
|
230
|
-
|
230
|
+
assert_unification 'ns1|*.foo', 'ns2|a {@extend .foo}', 'ns1|*.foo'
|
231
231
|
end
|
232
232
|
|
233
233
|
assert_unification 'ns|*.foo', 'ns|a {@extend .foo}', 'ns|*.foo, ns|a'
|
@@ -242,7 +242,7 @@ SCSS
|
|
242
242
|
assert_unification '*|a.foo', 'ns|a {@extend .foo}', '*|a.foo, ns|a'
|
243
243
|
|
244
244
|
assert_extend_doesnt_match('h1', '.foo', :failed_to_unify, 2) do
|
245
|
-
|
245
|
+
assert_unification 'a.foo', 'h1 {@extend .foo}', 'a.foo'
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
@@ -251,7 +251,7 @@ SCSS
|
|
251
251
|
assert_unification 'ns|a.foo', '*|a {@extend .foo}', 'ns|a'
|
252
252
|
|
253
253
|
assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
|
254
|
-
|
254
|
+
assert_unification 'ns1|a.foo', 'ns2|a {@extend .foo}', 'ns1|a.foo'
|
255
255
|
end
|
256
256
|
|
257
257
|
assert_unification 'ns|a.foo', 'ns|a {@extend .foo}', 'ns|a'
|
@@ -270,11 +270,11 @@ SCSS
|
|
270
270
|
assert_unification ':foo.baz', '::foo {@extend .baz}', ':foo.baz, :foo::foo'
|
271
271
|
|
272
272
|
assert_extend_doesnt_match('::bar', '.baz', :failed_to_unify, 2) do
|
273
|
-
|
273
|
+
assert_unification '::foo.baz', '::bar {@extend .baz}', '::foo.baz'
|
274
274
|
end
|
275
275
|
|
276
276
|
assert_extend_doesnt_match('::foo(2n+1)', '.baz', :failed_to_unify, 2) do
|
277
|
-
|
277
|
+
assert_unification '::foo.baz', '::foo(2n+1) {@extend .baz}', '::foo.baz'
|
278
278
|
end
|
279
279
|
|
280
280
|
assert_unification '::foo.baz', '::foo {@extend .baz}', '::foo'
|
@@ -310,183 +310,9 @@ SCSS
|
|
310
310
|
end
|
311
311
|
|
312
312
|
def test_negation_unification
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
end
|
317
|
-
|
318
|
-
def test_prefixed_pseudoclass_unification
|
319
|
-
assert_unification(
|
320
|
-
':nth-child(2n+1 of .foo).baz',
|
321
|
-
':nth-child(2n of .foo) {@extend .baz}',
|
322
|
-
':nth-child(2n+1 of .foo).baz, :nth-child(2n+1 of .foo):nth-child(2n of .foo)')
|
323
|
-
|
324
|
-
assert_unification(
|
325
|
-
':nth-child(2n+1 of .foo).baz',
|
326
|
-
':nth-child(2n+1 of .bar) {@extend .baz}',
|
327
|
-
':nth-child(2n+1 of .foo).baz, :nth-child(2n+1 of .foo):nth-child(2n+1 of .bar)')
|
328
|
-
|
329
|
-
assert_unification(
|
330
|
-
':nth-child(2n+1 of .foo).baz',
|
331
|
-
':nth-child(2n+1 of .foo) {@extend .baz}',
|
332
|
-
':nth-child(2n+1 of .foo)')
|
333
|
-
end
|
334
|
-
|
335
|
-
def test_extend_into_not
|
336
|
-
assert_extends(':not(.foo)', '.x {@extend .foo}', ':not(.foo, .x)')
|
337
|
-
assert_extends(':not(.foo.bar)', '.x {@extend .bar}', ':not(.foo.bar, .foo.x)')
|
338
|
-
assert_extends(
|
339
|
-
':not(.foo.bar, .baz.bar)',
|
340
|
-
'.x {@extend .bar}',
|
341
|
-
':not(.foo.bar, .foo.x, .baz.bar, .baz.x)')
|
342
|
-
end
|
343
|
-
|
344
|
-
def test_extend_into_mergeable_pseudoclasses
|
345
|
-
assert_extends(':matches(.foo)', '.x {@extend .foo}', ':matches(.foo, .x)')
|
346
|
-
assert_extends(':matches(.foo.bar)', '.x {@extend .bar}', ':matches(.foo.bar, .foo.x)')
|
347
|
-
assert_extends(
|
348
|
-
':matches(.foo.bar, .baz.bar)',
|
349
|
-
'.x {@extend .bar}',
|
350
|
-
':matches(.foo.bar, .foo.x, .baz.bar, .baz.x)')
|
351
|
-
|
352
|
-
assert_extends(':-moz-any(.foo)', '.x {@extend .foo}', ':-moz-any(.foo, .x)')
|
353
|
-
assert_extends(':current(.foo)', '.x {@extend .foo}', ':current(.foo, .x)')
|
354
|
-
assert_extends(':has(.foo)', '.x {@extend .foo}', ':has(.foo, .x)')
|
355
|
-
assert_extends(':host(.foo)', '.x {@extend .foo}', ':host(.foo, .x)')
|
356
|
-
assert_extends(':host-context(.foo)', '.x {@extend .foo}', ':host-context(.foo, .x)')
|
357
|
-
assert_extends(':nth-child(n of .foo)', '.x {@extend .foo}', ':nth-child(n of .foo, .x)')
|
358
|
-
assert_extends(
|
359
|
-
':nth-last-child(n of .foo)',
|
360
|
-
'.x {@extend .foo}',
|
361
|
-
':nth-last-child(n of .foo, .x)')
|
362
|
-
end
|
363
|
-
|
364
|
-
def test_complex_extend_into_pseudoclass
|
365
|
-
assert_extends(':not(.bar)', '.x .y {@extend .bar}', ':not(.bar, .x .y)')
|
366
|
-
assert_extends(':matches(.bar)', '.x .y {@extend .bar}', ':matches(.bar, .x .y)')
|
367
|
-
assert_extends(':current(.bar)', '.x .y {@extend .bar}', ':current(.bar, .x .y)')
|
368
|
-
assert_extends(':has(.bar)', '.x .y {@extend .bar}', ':has(.bar, .x .y)')
|
369
|
-
assert_extends(':host(.bar)', '.x .y {@extend .bar}', ':host(.bar, .x .y)')
|
370
|
-
assert_extends(':host-context(.bar)', '.x .y {@extend .bar}', ':host-context(.bar, .x .y)')
|
371
|
-
assert_extends(
|
372
|
-
':-moz-any(.bar)',
|
373
|
-
'.x .y {@extend .bar}',
|
374
|
-
':-moz-any(.bar, .x .y)')
|
375
|
-
assert_extends(
|
376
|
-
':nth-child(n of .bar)',
|
377
|
-
'.x .y {@extend .bar}',
|
378
|
-
':nth-child(n of .bar, .x .y)')
|
379
|
-
assert_extends(
|
380
|
-
':nth-last-child(n of .bar)',
|
381
|
-
'.x .y {@extend .bar}',
|
382
|
-
':nth-last-child(n of .bar, .x .y)')
|
383
|
-
end
|
384
|
-
|
385
|
-
def test_extend_over_selector_pseudoclass
|
386
|
-
assert_extends(':not(.foo)', '.x {@extend :not(.foo)}', ':not(.foo), .x')
|
387
|
-
assert_extends(
|
388
|
-
':matches(.foo, .bar)',
|
389
|
-
'.x {@extend :matches(.foo, .bar)}',
|
390
|
-
':matches(.foo, .bar), .x')
|
391
|
-
end
|
392
|
-
|
393
|
-
def test_matches_within_not
|
394
|
-
assert_extends(
|
395
|
-
':not(.foo, .bar)',
|
396
|
-
':matches(.x, .y) {@extend .foo}',
|
397
|
-
':not(.foo, .x, .y, .bar)')
|
398
|
-
end
|
399
|
-
|
400
|
-
def test_pseudoclasses_merge
|
401
|
-
assert_extends(':matches(.foo)', ':matches(.bar) {@extend .foo}', ':matches(.foo, .bar)')
|
402
|
-
assert_extends(':-moz-any(.foo)', ':-moz-any(.bar) {@extend .foo}', ':-moz-any(.foo, .bar)')
|
403
|
-
assert_extends(':current(.foo)', ':current(.bar) {@extend .foo}', ':current(.foo, .bar)')
|
404
|
-
assert_extends(
|
405
|
-
':nth-child(n of .foo)',
|
406
|
-
':nth-child(n of .bar) {@extend .foo}',
|
407
|
-
':nth-child(n of .foo, .bar)')
|
408
|
-
assert_extends(
|
409
|
-
':nth-last-child(n of .foo)',
|
410
|
-
':nth-last-child(n of .bar) {@extend .foo}',
|
411
|
-
':nth-last-child(n of .foo, .bar)')
|
412
|
-
end
|
413
|
-
|
414
|
-
def test_nesting_pseudoclasses_merge
|
415
|
-
assert_extends(':has(.foo)', ':has(.bar) {@extend .foo}', ':has(.foo, :has(.bar))')
|
416
|
-
assert_extends(':host(.foo)', ':host(.bar) {@extend .foo}', ':host(.foo, :host(.bar))')
|
417
|
-
assert_extends(
|
418
|
-
':host-context(.foo)',
|
419
|
-
':host-context(.bar) {@extend .foo}',
|
420
|
-
':host-context(.foo, :host-context(.bar))')
|
421
|
-
end
|
422
|
-
|
423
|
-
def test_not_unifies_with_unique_values
|
424
|
-
assert_unification('foo', ':not(bar) {@extend foo}', ':not(bar)')
|
425
|
-
assert_unification('#foo', ':not(#bar) {@extend #foo}', ':not(#bar)')
|
426
|
-
end
|
427
|
-
|
428
|
-
def test_not_adds_no_specificity
|
429
|
-
assert_specificity_equals(':not(.foo)', '.foo')
|
430
|
-
end
|
431
|
-
|
432
|
-
def test_matches_has_a_specificity_range
|
433
|
-
# `:matches(.foo, #bar)` has minimum specificity equal to that of `.foo`,
|
434
|
-
# which means `:matches(.foo, #bar) .a` can have less specificity than
|
435
|
-
# `#b.a`. Thus the selector generated by `#b.a` should be preserved.
|
436
|
-
assert_equal <<CSS, render(<<SCSS)
|
437
|
-
:matches(.foo, #bar) .a, :matches(.foo, #bar) #b.a {
|
438
|
-
a: b; }
|
439
|
-
CSS
|
440
|
-
:matches(.foo, #bar) %x {a: b}
|
441
|
-
.a {@extend %x}
|
442
|
-
#b.a {@extend %x}
|
443
|
-
SCSS
|
444
|
-
|
445
|
-
# `:matches(.foo, #bar)` has maximum specificity equal to that of `#bar`,
|
446
|
-
# which means `:matches(.foo, #bar).b` can have greater specificity than `.a
|
447
|
-
# .b`. Thus the selector generated by `:matches(.foo, #bar).b` should be
|
448
|
-
# preserved.
|
449
|
-
assert_equal <<CSS, render(<<SCSS)
|
450
|
-
.a .b, .a .b:matches(.foo, #bar) {
|
451
|
-
a: b; }
|
452
|
-
CSS
|
453
|
-
.a %x {a: b}
|
454
|
-
.b {@extend %x}
|
455
|
-
.b:matches(.foo, #bar) {@extend %x}
|
456
|
-
SCSS
|
457
|
-
end
|
458
|
-
|
459
|
-
def test_extend_into_not_and_normal_extend
|
460
|
-
assert_equal <<CSS, render(<<SCSS)
|
461
|
-
.x:not(.y, .bar), .foo:not(.y, .bar) {
|
462
|
-
a: b; }
|
463
|
-
CSS
|
464
|
-
.x:not(.y) {a: b}
|
465
|
-
.foo {@extend .x}
|
466
|
-
.bar {@extend .y}
|
467
|
-
SCSS
|
468
|
-
end
|
469
|
-
|
470
|
-
def test_extend_into_matches_and_normal_extend
|
471
|
-
assert_equal <<CSS, render(<<SCSS)
|
472
|
-
.x:matches(.y, .bar), .foo:matches(.y, .bar) {
|
473
|
-
a: b; }
|
474
|
-
CSS
|
475
|
-
.x:matches(.y) {a: b}
|
476
|
-
.foo {@extend .x}
|
477
|
-
.bar {@extend .y}
|
478
|
-
SCSS
|
479
|
-
end
|
480
|
-
|
481
|
-
def test_multilayer_pseudoclass_extend
|
482
|
-
assert_equal <<CSS, render(<<SCSS)
|
483
|
-
:matches(.x, .foo, .bar) {
|
484
|
-
a: b; }
|
485
|
-
CSS
|
486
|
-
:matches(.x) {a: b}
|
487
|
-
.foo {@extend .x}
|
488
|
-
.bar {@extend .foo}
|
489
|
-
SCSS
|
313
|
+
assert_unification ':not(.foo).baz', ':not(.bar) {@extend .baz}', ':not(.foo).baz, :not(.foo):not(.bar)'
|
314
|
+
assert_unification ':not(.foo).baz', ':not(.foo) {@extend .baz}', ':not(.foo)'
|
315
|
+
assert_unification ':not([a=b]).baz', ':not([a = b]) {@extend .baz}', ':not([a=b])'
|
490
316
|
end
|
491
317
|
|
492
318
|
def test_comma_extendee
|
@@ -522,7 +348,7 @@ SCSS
|
|
522
348
|
|
523
349
|
def test_long_extendee_requires_all_selectors
|
524
350
|
assert_extend_doesnt_match('.baz', '.foo.bar', :not_found, 2) do
|
525
|
-
|
351
|
+
assert_extends '.foo', '.baz {@extend .foo.bar}', '.foo'
|
526
352
|
end
|
527
353
|
end
|
528
354
|
|
@@ -546,11 +372,11 @@ SCSS
|
|
546
372
|
|
547
373
|
def test_long_extender_aborts_unification
|
548
374
|
assert_extend_doesnt_match('h1.baz', '.foo', :failed_to_unify, 2) do
|
549
|
-
|
375
|
+
assert_extends 'a.foo#bar', 'h1.baz {@extend .foo}', 'a.foo#bar'
|
550
376
|
end
|
551
377
|
|
552
378
|
assert_extend_doesnt_match('.bang#baz', '.foo', :failed_to_unify, 2) do
|
553
|
-
|
379
|
+
assert_extends 'a.foo#bar', '.bang#baz {@extend .foo}', 'a.foo#bar'
|
554
380
|
end
|
555
381
|
end
|
556
382
|
|
@@ -566,7 +392,7 @@ SCSS
|
|
566
392
|
|
567
393
|
def test_nested_extender_aborts_unification
|
568
394
|
assert_extend_doesnt_match('foo bar', '.foo', :failed_to_unify, 2) do
|
569
|
-
|
395
|
+
assert_extends 'baz.foo', 'foo bar {@extend .foo}', 'baz.foo'
|
570
396
|
end
|
571
397
|
end
|
572
398
|
|
@@ -663,7 +489,7 @@ CSS
|
|
663
489
|
SCSS
|
664
490
|
end
|
665
491
|
|
666
|
-
def
|
492
|
+
def test_another_nested_extender_with_early_child_selectors_doesnt_subseq_them
|
667
493
|
assert_equal <<CSS, render(<<SCSS)
|
668
494
|
.foo .bar, .foo .bip > .baz {
|
669
495
|
a: b; }
|
@@ -690,7 +516,7 @@ SCSS
|
|
690
516
|
end
|
691
517
|
|
692
518
|
def test_nested_extender_with_trailing_child_selector
|
693
|
-
|
519
|
+
assert_raise(Sass::SyntaxError, "bar > can't extend: invalid selector") do
|
694
520
|
render("bar > {@extend .baz}")
|
695
521
|
end
|
696
522
|
end
|
@@ -824,10 +650,10 @@ SCSS
|
|
824
650
|
|
825
651
|
def test_basic_extend_loop
|
826
652
|
assert_equal <<CSS, render(<<SCSS)
|
827
|
-
.
|
653
|
+
.bar, .foo {
|
828
654
|
a: b; }
|
829
655
|
|
830
|
-
.
|
656
|
+
.foo, .bar {
|
831
657
|
c: d; }
|
832
658
|
CSS
|
833
659
|
.foo {a: b; @extend .bar}
|
@@ -837,13 +663,13 @@ SCSS
|
|
837
663
|
|
838
664
|
def test_three_level_extend_loop
|
839
665
|
assert_equal <<CSS, render(<<SCSS)
|
840
|
-
.
|
666
|
+
.baz, .bar, .foo {
|
841
667
|
a: b; }
|
842
668
|
|
843
|
-
.
|
669
|
+
.foo, .baz, .bar {
|
844
670
|
c: d; }
|
845
671
|
|
846
|
-
.
|
672
|
+
.bar, .foo, .baz {
|
847
673
|
e: f; }
|
848
674
|
CSS
|
849
675
|
.foo {a: b; @extend .bar}
|
@@ -866,18 +692,6 @@ CSS
|
|
866
692
|
SCSS
|
867
693
|
end
|
868
694
|
|
869
|
-
def test_cross_loop
|
870
|
-
# The first law of extend means the selector should stick around.
|
871
|
-
assert_equal <<CSS, render(<<SCSS)
|
872
|
-
.foo.bar, .foo, .bar {
|
873
|
-
a: b; }
|
874
|
-
CSS
|
875
|
-
.foo.bar {a: b}
|
876
|
-
.foo {@extend .bar}
|
877
|
-
.bar {@extend .foo}
|
878
|
-
SCSS
|
879
|
-
end
|
880
|
-
|
881
695
|
def test_multiple_extender_merges_with_superset_selector
|
882
696
|
assert_equal <<CSS, render(<<SCSS)
|
883
697
|
a.bar.baz, a.foo {
|
@@ -996,7 +810,10 @@ SCSS
|
|
996
810
|
|
997
811
|
def test_placeholder_selector_as_modifier
|
998
812
|
assert_extend_doesnt_match('div', '%foo', :failed_to_unify, 3) do
|
999
|
-
render(<<SCSS)
|
813
|
+
assert_equal <<CSS, render(<<SCSS)
|
814
|
+
a.baz.bar {
|
815
|
+
color: blue; }
|
816
|
+
CSS
|
1000
817
|
a%foo.baz {color: blue}
|
1001
818
|
.bar {@extend %foo}
|
1002
819
|
div {@extend %foo}
|
@@ -1016,17 +833,6 @@ $foo: foo;
|
|
1016
833
|
SCSS
|
1017
834
|
end
|
1018
835
|
|
1019
|
-
def test_placeholder_in_selector_pseudoclass
|
1020
|
-
assert_equal <<CSS, render(<<SCSS)
|
1021
|
-
:matches(.bar, .baz) {
|
1022
|
-
color: blue; }
|
1023
|
-
CSS
|
1024
|
-
:matches(%foo) {color: blue}
|
1025
|
-
.bar {@extend %foo}
|
1026
|
-
.baz {@extend %foo}
|
1027
|
-
SCSS
|
1028
|
-
end
|
1029
|
-
|
1030
836
|
def test_media_in_placeholder_selector
|
1031
837
|
assert_equal <<CSS, render(<<SCSS)
|
1032
838
|
.baz {
|
@@ -1038,11 +844,16 @@ SCSS
|
|
1038
844
|
end
|
1039
845
|
|
1040
846
|
def test_extend_out_of_media
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
847
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
848
|
+
DEPRECATION WARNING on line 3 of test_extend_out_of_media_inline.scss:
|
849
|
+
@extending an outer selector from within @media is deprecated.
|
850
|
+
You may only @extend selectors within the same directive.
|
851
|
+
This will be an error in Sass 3.3.
|
852
|
+
It can only work once @extend is supported natively in the browser.
|
853
|
+
WARN
|
854
|
+
.foo {
|
855
|
+
a: b; }
|
856
|
+
CSS
|
1046
857
|
.foo {a: b}
|
1047
858
|
@media screen {
|
1048
859
|
.bar {@extend .foo}
|
@@ -1051,11 +862,18 @@ SCSS
|
|
1051
862
|
end
|
1052
863
|
|
1053
864
|
def test_extend_out_of_unknown_directive
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
865
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
866
|
+
DEPRECATION WARNING on line 3 of test_extend_out_of_unknown_directive_inline.scss:
|
867
|
+
@extending an outer selector from within @flooblehoof is deprecated.
|
868
|
+
You may only @extend selectors within the same directive.
|
869
|
+
This will be an error in Sass 3.3.
|
870
|
+
It can only work once @extend is supported natively in the browser.
|
871
|
+
WARN
|
872
|
+
.foo {
|
873
|
+
a: b; }
|
874
|
+
|
875
|
+
@flooblehoof {}
|
876
|
+
CSS
|
1059
877
|
.foo {a: b}
|
1060
878
|
@flooblehoof {
|
1061
879
|
.bar {@extend .foo}
|
@@ -1064,11 +882,19 @@ SCSS
|
|
1064
882
|
end
|
1065
883
|
|
1066
884
|
def test_extend_out_of_nested_directives
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
885
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
886
|
+
DEPRECATION WARNING on line 4 of test_extend_out_of_nested_directives_inline.scss:
|
887
|
+
@extending an outer selector from within @flooblehoof is deprecated.
|
888
|
+
You may only @extend selectors within the same directive.
|
889
|
+
This will be an error in Sass 3.3.
|
890
|
+
It can only work once @extend is supported natively in the browser.
|
891
|
+
WARN
|
892
|
+
@media screen {
|
893
|
+
.foo {
|
894
|
+
a: b; }
|
895
|
+
|
896
|
+
@flooblehoof {} }
|
897
|
+
CSS
|
1072
898
|
@media screen {
|
1073
899
|
.foo {a: b}
|
1074
900
|
@flooblehoof {
|
@@ -1136,6 +962,7 @@ SCSS
|
|
1136
962
|
@flooblehoof {
|
1137
963
|
.foo, .bar {
|
1138
964
|
a: b; } }
|
965
|
+
|
1139
966
|
@flooblehoof {}
|
1140
967
|
CSS
|
1141
968
|
@flooblehoof {.foo {a: b}}
|
@@ -1158,11 +985,20 @@ SCSS
|
|
1158
985
|
end
|
1159
986
|
|
1160
987
|
def test_extend_within_and_without_media
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
988
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
989
|
+
DEPRECATION WARNING on line 4 of test_extend_within_and_without_media_inline.scss:
|
990
|
+
@extending an outer selector from within @media is deprecated.
|
991
|
+
You may only @extend selectors within the same directive.
|
992
|
+
This will be an error in Sass 3.3.
|
993
|
+
It can only work once @extend is supported natively in the browser.
|
994
|
+
WARN
|
995
|
+
.foo {
|
996
|
+
a: b; }
|
997
|
+
|
998
|
+
@media screen {
|
999
|
+
.foo, .bar {
|
1000
|
+
c: d; } }
|
1001
|
+
CSS
|
1166
1002
|
.foo {a: b}
|
1167
1003
|
@media screen {
|
1168
1004
|
.foo {c: d}
|
@@ -1172,11 +1008,20 @@ SCSS
|
|
1172
1008
|
end
|
1173
1009
|
|
1174
1010
|
def test_extend_within_and_without_unknown_directive
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1011
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
1012
|
+
DEPRECATION WARNING on line 4 of test_extend_within_and_without_unknown_directive_inline.scss:
|
1013
|
+
@extending an outer selector from within @flooblehoof is deprecated.
|
1014
|
+
You may only @extend selectors within the same directive.
|
1015
|
+
This will be an error in Sass 3.3.
|
1016
|
+
It can only work once @extend is supported natively in the browser.
|
1017
|
+
WARN
|
1018
|
+
.foo {
|
1019
|
+
a: b; }
|
1020
|
+
|
1021
|
+
@flooblehoof {
|
1022
|
+
.foo, .bar {
|
1023
|
+
c: d; } }
|
1024
|
+
CSS
|
1180
1025
|
.foo {a: b}
|
1181
1026
|
@flooblehoof {
|
1182
1027
|
.foo {c: d}
|
@@ -1186,11 +1031,21 @@ SCSS
|
|
1186
1031
|
end
|
1187
1032
|
|
1188
1033
|
def test_extend_within_and_without_nested_directives
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1034
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
1035
|
+
DEPRECATION WARNING on line 5 of test_extend_within_and_without_nested_directives_inline.scss:
|
1036
|
+
@extending an outer selector from within @flooblehoof is deprecated.
|
1037
|
+
You may only @extend selectors within the same directive.
|
1038
|
+
This will be an error in Sass 3.3.
|
1039
|
+
It can only work once @extend is supported natively in the browser.
|
1040
|
+
WARN
|
1041
|
+
@media screen {
|
1042
|
+
.foo {
|
1043
|
+
a: b; }
|
1044
|
+
|
1045
|
+
@flooblehoof {
|
1046
|
+
.foo, .bar {
|
1047
|
+
c: d; } } }
|
1048
|
+
CSS
|
1194
1049
|
@media screen {
|
1195
1050
|
.foo {a: b}
|
1196
1051
|
@flooblehoof {
|
@@ -1202,7 +1057,7 @@ SCSS
|
|
1202
1057
|
end
|
1203
1058
|
|
1204
1059
|
def test_extend_with_subject_transfers_subject_to_extender
|
1205
|
-
|
1060
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1206
1061
|
foo bar! baz, foo .bip .bap! baz, .bip foo .bap! baz {
|
1207
1062
|
a: b; }
|
1208
1063
|
CSS
|
@@ -1210,7 +1065,7 @@ foo bar! baz {a: b}
|
|
1210
1065
|
.bip .bap {@extend bar}
|
1211
1066
|
SCSS
|
1212
1067
|
|
1213
|
-
|
1068
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1214
1069
|
foo.x bar.y! baz.z, foo.x .bip bar.bap! baz.z, .bip foo.x bar.bap! baz.z {
|
1215
1070
|
a: b; }
|
1216
1071
|
CSS
|
@@ -1220,7 +1075,7 @@ SCSS
|
|
1220
1075
|
end
|
1221
1076
|
|
1222
1077
|
def test_extend_with_subject_retains_subject_on_target
|
1223
|
-
|
1078
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1224
1079
|
.foo! .bar, .foo! .bip .bap, .bip .foo! .bap {
|
1225
1080
|
a: b; }
|
1226
1081
|
CSS
|
@@ -1230,7 +1085,7 @@ SCSS
|
|
1230
1085
|
end
|
1231
1086
|
|
1232
1087
|
def test_extend_with_subject_transfers_subject_to_target
|
1233
|
-
|
1088
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1234
1089
|
a.foo .bar, .bip a.bap! .bar {
|
1235
1090
|
a: b; }
|
1236
1091
|
CSS
|
@@ -1240,7 +1095,7 @@ SCSS
|
|
1240
1095
|
end
|
1241
1096
|
|
1242
1097
|
def test_extend_with_subject_retains_subject_on_extender
|
1243
|
-
|
1098
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1244
1099
|
.foo .bar, .foo .bip! .bap, .bip! .foo .bap {
|
1245
1100
|
a: b; }
|
1246
1101
|
CSS
|
@@ -1250,38 +1105,43 @@ SCSS
|
|
1250
1105
|
end
|
1251
1106
|
|
1252
1107
|
def test_extend_with_subject_fails_with_conflicting_subject
|
1253
|
-
|
1108
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1254
1109
|
x! .bar {
|
1255
1110
|
a: b; }
|
1256
1111
|
CSS
|
1257
1112
|
x! .bar {a: b}
|
1258
1113
|
y! .bap {@extend .bar}
|
1259
1114
|
SCSS
|
1260
|
-
|
1115
|
+
end
|
1261
1116
|
|
1262
1117
|
def test_extend_warns_when_extendee_doesnt_exist
|
1263
|
-
|
1264
|
-
".foo" failed to @extend ".bar".
|
1265
|
-
The selector ".bar" was not found.
|
1266
|
-
|
1267
|
-
|
1118
|
+
assert_warning(<<WARN) {assert_equal("", render(<<SCSS))}
|
1119
|
+
WARNING on line 1 of test_extend_warns_when_extendee_doesnt_exist_inline.scss: ".foo" failed to @extend ".bar".
|
1120
|
+
The selector ".bar" was not found.
|
1121
|
+
This will be an error in future releases of Sass.
|
1122
|
+
Use "@extend .bar !optional" if the extend should be able to fail.
|
1123
|
+
WARN
|
1268
1124
|
.foo {@extend .bar}
|
1269
1125
|
SCSS
|
1270
1126
|
end
|
1271
1127
|
|
1272
1128
|
def test_extend_warns_when_extension_fails
|
1273
|
-
|
1274
|
-
"b.foo" failed to @extend ".bar".
|
1275
|
-
No selectors matching ".bar" could be unified with "b.foo".
|
1276
|
-
|
1277
|
-
|
1129
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
|
1130
|
+
WARNING on line 2 of test_extend_warns_when_extension_fails_inline.scss: "b.foo" failed to @extend ".bar".
|
1131
|
+
No selectors matching ".bar" could be unified with "b.foo".
|
1132
|
+
This will be an error in future releases of Sass.
|
1133
|
+
Use "@extend .bar !optional" if the extend should be able to fail.
|
1134
|
+
WARN
|
1135
|
+
a.bar {
|
1136
|
+
a: b; }
|
1137
|
+
CSS
|
1278
1138
|
a.bar {a: b}
|
1279
1139
|
b.foo {@extend .bar}
|
1280
1140
|
SCSS
|
1281
1141
|
end
|
1282
1142
|
|
1283
|
-
def
|
1284
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1143
|
+
def test_extend_does_not_warn_when_one_extension_fails_but_others_dont
|
1144
|
+
assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
|
1285
1145
|
a.bar {
|
1286
1146
|
a: b; }
|
1287
1147
|
|
@@ -1294,14 +1154,14 @@ b.foo {@extend .bar}
|
|
1294
1154
|
SCSS
|
1295
1155
|
end
|
1296
1156
|
|
1297
|
-
def
|
1298
|
-
assert_equal("", render(<<SCSS))
|
1157
|
+
def test_optional_extend_does_not_warn_when_extendee_doesnt_exist
|
1158
|
+
assert_no_warning {assert_equal("", render(<<SCSS))}
|
1299
1159
|
.foo {@extend .bar !optional}
|
1300
1160
|
SCSS
|
1301
1161
|
end
|
1302
1162
|
|
1303
|
-
def
|
1304
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1163
|
+
def test_optional_extend_does_not_warn_when_extension_fails
|
1164
|
+
assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
|
1305
1165
|
a.bar {
|
1306
1166
|
a: b; }
|
1307
1167
|
CSS
|
@@ -1312,16 +1172,6 @@ SCSS
|
|
1312
1172
|
|
1313
1173
|
# Regression Tests
|
1314
1174
|
|
1315
|
-
def test_extend_parent_selector_suffix
|
1316
|
-
assert_equal <<CSS, render(<<SCSS)
|
1317
|
-
.a-b, .c {
|
1318
|
-
x: y; }
|
1319
|
-
CSS
|
1320
|
-
.a {&-b {x: y}}
|
1321
|
-
.c {@extend .a-b}
|
1322
|
-
SCSS
|
1323
|
-
end
|
1324
|
-
|
1325
1175
|
def test_pseudo_element_superselector
|
1326
1176
|
# Pseudo-elements shouldn't be removed in superselector calculations.
|
1327
1177
|
assert_equal <<CSS, render(<<SCSS)
|
@@ -1590,7 +1440,7 @@ SCSS
|
|
1590
1440
|
private
|
1591
1441
|
|
1592
1442
|
def assert_extend_doesnt_match(extender, target, reason, line, syntax = :scss)
|
1593
|
-
|
1443
|
+
warn = "\"#{extender}\" failed to @extend \"#{target}\"."
|
1594
1444
|
reason =
|
1595
1445
|
if reason == :not_found
|
1596
1446
|
"The selector \"#{target}\" was not found."
|
@@ -1598,14 +1448,15 @@ SCSS
|
|
1598
1448
|
"No selectors matching \"#{target}\" could be unified with \"#{extender}\"."
|
1599
1449
|
end
|
1600
1450
|
|
1601
|
-
|
1602
|
-
#{
|
1603
|
-
#{reason}
|
1604
|
-
|
1605
|
-
|
1451
|
+
assert_warning(<<WARNING) {yield}
|
1452
|
+
WARNING on line #{line} of #{filename_for_test syntax}: #{warn}
|
1453
|
+
#{reason}
|
1454
|
+
This will be an error in future releases of Sass.
|
1455
|
+
Use "@extend #{target} !optional" if the extend should be able to fail.
|
1456
|
+
WARNING
|
1606
1457
|
end
|
1607
1458
|
|
1608
|
-
def assert_unification(selector, extension, unified
|
1459
|
+
def assert_unification(selector, extension, unified)
|
1609
1460
|
# Do some trickery so the first law of extend doesn't get in our way.
|
1610
1461
|
assert_extends(
|
1611
1462
|
"%-a #{selector}",
|
@@ -1613,41 +1464,11 @@ ERR
|
|
1613
1464
|
unified.split(', ').map {|s| "-a #{s}"}.join(', '))
|
1614
1465
|
end
|
1615
1466
|
|
1616
|
-
def assert_specificity_equals(sel1, sel2)
|
1617
|
-
assert_specificity_gte(sel1, sel2)
|
1618
|
-
assert_specificity_gte(sel2, sel1)
|
1619
|
-
end
|
1620
|
-
|
1621
|
-
def assert_specificity_gte(sel1, sel2)
|
1622
|
-
assert_equal <<CSS, render(<<SCSS)
|
1623
|
-
#{sel1} .a {
|
1624
|
-
a: b; }
|
1625
|
-
CSS
|
1626
|
-
#{sel1} %-a {a: b}
|
1627
|
-
.a {@extend %-a}
|
1628
|
-
#{sel2}.a {@extend %-a}
|
1629
|
-
SCSS
|
1630
|
-
end
|
1631
|
-
|
1632
|
-
def render_unification(selector, extension)
|
1633
|
-
render_extends(
|
1634
|
-
"%-a #{selector}",
|
1635
|
-
extension + " -a {@extend %-a}")
|
1636
|
-
end
|
1637
|
-
|
1638
1467
|
def assert_extends(selector, extension, result)
|
1639
|
-
assert_equal <<CSS,
|
1468
|
+
assert_equal <<CSS, render(<<SCSS)
|
1640
1469
|
#{result} {
|
1641
1470
|
a: b; }
|
1642
1471
|
CSS
|
1643
|
-
end
|
1644
|
-
|
1645
|
-
def assert_extends_to_nothing(selector, extension)
|
1646
|
-
assert_equal '', render_extends(selector, extension)
|
1647
|
-
end
|
1648
|
-
|
1649
|
-
def render_extends(selector, extension)
|
1650
|
-
render(<<SCSS)
|
1651
1472
|
#{selector} {a: b}
|
1652
1473
|
#{extension}
|
1653
1474
|
SCSS
|