sass 3.3.0 → 3.4.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/CODE_OF_CONDUCT.md +10 -0
- data/CONTRIBUTING.md +148 -0
- data/MIT-LICENSE +1 -1
- data/README.md +76 -62
- data/Rakefile +104 -24
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -1
- data/bin/scss +1 -1
- data/extra/sass-spec-ref.sh +32 -0
- data/extra/update_watch.rb +1 -1
- data/lib/sass/cache_stores/filesystem.rb +9 -5
- data/lib/sass/cache_stores/memory.rb +4 -5
- data/lib/sass/callbacks.rb +2 -2
- data/lib/sass/css.rb +12 -13
- data/lib/sass/deprecation.rb +55 -0
- data/lib/sass/engine.rb +106 -70
- data/lib/sass/environment.rb +39 -19
- data/lib/sass/error.rb +17 -20
- data/lib/sass/exec/base.rb +199 -0
- data/lib/sass/exec/sass_convert.rb +283 -0
- data/lib/sass/exec/sass_scss.rb +440 -0
- data/lib/sass/exec.rb +5 -771
- data/lib/sass/features.rb +9 -2
- data/lib/sass/importers/base.rb +8 -3
- data/lib/sass/importers/filesystem.rb +30 -38
- data/lib/sass/logger/base.rb +8 -2
- data/lib/sass/logger/delayed.rb +50 -0
- data/lib/sass/logger.rb +8 -3
- data/lib/sass/media.rb +1 -4
- data/lib/sass/plugin/compiler.rb +224 -90
- data/lib/sass/plugin/configuration.rb +38 -22
- data/lib/sass/plugin/merb.rb +2 -2
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/rails.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +4 -4
- data/lib/sass/plugin.rb +6 -5
- data/lib/sass/script/css_lexer.rb +1 -1
- data/lib/sass/script/css_parser.rb +2 -3
- data/lib/sass/script/css_variable_warning.rb +52 -0
- data/lib/sass/script/functions.rb +739 -318
- data/lib/sass/script/lexer.rb +134 -54
- data/lib/sass/script/parser.rb +252 -56
- data/lib/sass/script/tree/funcall.rb +13 -6
- data/lib/sass/script/tree/interpolation.rb +127 -4
- data/lib/sass/script/tree/list_literal.rb +31 -4
- data/lib/sass/script/tree/literal.rb +4 -0
- data/lib/sass/script/tree/node.rb +21 -3
- data/lib/sass/script/tree/operation.rb +54 -1
- data/lib/sass/script/tree/selector.rb +26 -0
- data/lib/sass/script/tree/string_interpolation.rb +59 -38
- data/lib/sass/script/tree/variable.rb +1 -1
- data/lib/sass/script/tree.rb +1 -0
- data/lib/sass/script/value/base.rb +17 -14
- data/lib/sass/script/value/bool.rb +0 -5
- data/lib/sass/script/value/color.rb +78 -42
- data/lib/sass/script/value/helpers.rb +119 -2
- data/lib/sass/script/value/list.rb +0 -15
- data/lib/sass/script/value/map.rb +1 -1
- data/lib/sass/script/value/null.rb +0 -5
- data/lib/sass/script/value/number.rb +112 -31
- data/lib/sass/script/value/string.rb +102 -13
- data/lib/sass/script/value.rb +0 -1
- data/lib/sass/script.rb +3 -3
- data/lib/sass/scss/css_parser.rb +24 -4
- data/lib/sass/scss/parser.rb +290 -383
- data/lib/sass/scss/rx.rb +17 -9
- data/lib/sass/scss/static_parser.rb +306 -4
- data/lib/sass/scss.rb +0 -2
- data/lib/sass/selector/abstract_sequence.rb +35 -18
- data/lib/sass/selector/comma_sequence.rb +114 -19
- data/lib/sass/selector/pseudo.rb +266 -0
- data/lib/sass/selector/sequence.rb +146 -40
- data/lib/sass/selector/simple.rb +22 -33
- data/lib/sass/selector/simple_sequence.rb +122 -39
- data/lib/sass/selector.rb +57 -197
- data/lib/sass/shared.rb +2 -2
- data/lib/sass/source/map.rb +31 -14
- data/lib/sass/source/position.rb +4 -4
- data/lib/sass/stack.rb +2 -8
- data/lib/sass/supports.rb +10 -13
- data/lib/sass/tree/at_root_node.rb +1 -0
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +1 -1
- data/lib/sass/tree/css_import_node.rb +9 -1
- data/lib/sass/tree/directive_node.rb +8 -2
- data/lib/sass/tree/error_node.rb +18 -0
- data/lib/sass/tree/extend_node.rb +1 -1
- data/lib/sass/tree/function_node.rb +9 -0
- data/lib/sass/tree/import_node.rb +6 -5
- data/lib/sass/tree/keyframe_rule_node.rb +15 -0
- data/lib/sass/tree/node.rb +5 -3
- data/lib/sass/tree/prop_node.rb +6 -7
- data/lib/sass/tree/rule_node.rb +26 -11
- data/lib/sass/tree/visitors/check_nesting.rb +56 -32
- data/lib/sass/tree/visitors/convert.rb +59 -44
- data/lib/sass/tree/visitors/cssize.rb +34 -30
- data/lib/sass/tree/visitors/deep_copy.rb +6 -1
- data/lib/sass/tree/visitors/extend.rb +15 -13
- data/lib/sass/tree/visitors/perform.rb +87 -50
- data/lib/sass/tree/visitors/set_options.rb +15 -1
- data/lib/sass/tree/visitors/to_css.rb +72 -43
- data/lib/sass/util/multibyte_string_scanner.rb +0 -2
- data/lib/sass/util/normalized_map.rb +0 -1
- data/lib/sass/util/subset_map.rb +2 -3
- data/lib/sass/util.rb +334 -154
- data/lib/sass/version.rb +7 -7
- data/lib/sass.rb +10 -8
- data/test/sass/cache_test.rb +62 -20
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/compiler_test.rb +24 -11
- data/test/sass/conversion_test.rb +241 -50
- data/test/sass/css2sass_test.rb +73 -5
- data/test/sass/css_variable_test.rb +132 -0
- data/test/sass/encoding_test.rb +219 -0
- data/test/sass/engine_test.rb +343 -260
- data/test/sass/exec_test.rb +12 -2
- data/test/sass/extend_test.rb +333 -44
- data/test/sass/functions_test.rb +353 -260
- data/test/sass/importer_test.rb +40 -21
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/more_results/more_import.css +1 -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 +24 -21
- 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 +5 -5
- data/test/sass/results/scss_import.css +1 -1
- data/test/sass/script_conversion_test.rb +71 -39
- data/test/sass/script_test.rb +714 -123
- data/test/sass/scss/css_test.rb +213 -30
- data/test/sass/scss/rx_test.rb +8 -4
- data/test/sass/scss/scss_test.rb +766 -22
- data/test/sass/source_map_test.rb +263 -95
- data/test/sass/superselector_test.rb +210 -0
- 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/scss_import.scss +2 -1
- 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/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
- data/test/sass/util/normalized_map_test.rb +1 -1
- data/test/sass/util/subset_map_test.rb +2 -2
- data/test/sass/util_test.rb +46 -45
- data/test/sass/value_helpers_test.rb +5 -7
- data/test/sass-spec.yml +3 -0
- data/test/test_helper.rb +7 -6
- data/vendor/listen/CHANGELOG.md +1 -228
- data/vendor/listen/Gemfile +5 -15
- data/vendor/listen/README.md +111 -77
- data/vendor/listen/Rakefile +0 -42
- data/vendor/listen/lib/listen/adapter.rb +195 -82
- data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
- data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
- data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
- data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
- data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
- data/vendor/listen/lib/listen/directory_record.rb +96 -61
- data/vendor/listen/lib/listen/listener.rb +135 -37
- data/vendor/listen/lib/listen/turnstile.rb +9 -5
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/lib/listen.rb +33 -19
- data/vendor/listen/listen.gemspec +6 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
- data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
- data/vendor/listen/spec/listen/listener_spec.rb +128 -39
- data/vendor/listen/spec/listen_spec.rb +15 -21
- data/vendor/listen/spec/spec_helper.rb +4 -0
- data/vendor/listen/spec/support/adapter_helper.rb +52 -15
- data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
- data/vendor/listen/spec/support/listeners_helper.rb +30 -7
- metadata +310 -300
- data/CONTRIBUTING +0 -3
- data/ext/mkrf_conf.rb +0 -27
- data/lib/sass/script/value/deprecated_false.rb +0 -55
- data/lib/sass/scss/script_lexer.rb +0 -15
- data/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
- data/vendor/listen/lib/listen/multi_listener.rb +0 -143
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
- data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
data/test/sass/engine_test.rb
CHANGED
@@ -17,6 +17,11 @@ module Sass::Script::Functions::UserFunctions
|
|
17
17
|
return Sass::Script::Value::Null.new
|
18
18
|
end
|
19
19
|
|
20
|
+
def set_a_global_variable(name, value)
|
21
|
+
environment.set_global_var(name.value, value)
|
22
|
+
return Sass::Script::Value::Null.new
|
23
|
+
end
|
24
|
+
|
20
25
|
def get_a_variable(name)
|
21
26
|
environment.var(name.value) || Sass::Script::Value::String.new("undefined")
|
22
27
|
end
|
@@ -26,7 +31,7 @@ module Sass::Script::Functions
|
|
26
31
|
include Sass::Script::Functions::UserFunctions
|
27
32
|
end
|
28
33
|
|
29
|
-
class SassEngineTest < Test
|
34
|
+
class SassEngineTest < MiniTest::Test
|
30
35
|
FAKE_FILE_NAME = __FILE__.gsub(/rb$/,"sass")
|
31
36
|
# A map of erroneous Sass documents to the error messages they should produce.
|
32
37
|
# The error messages may be arrays;
|
@@ -68,12 +73,11 @@ MSG
|
|
68
73
|
"$a: 1b >= 2c" => "Incompatible units: 'c' and 'b'.",
|
69
74
|
"a\n b: 1b * 2c" => "2b*c isn't a valid CSS value.",
|
70
75
|
"a\n b: 1b % 2c" => "Incompatible units: 'c' and 'b'.",
|
71
|
-
"$a: 2px + #ccc" => "Cannot add a number with units (2px) to a color (#
|
72
|
-
"$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#
|
76
|
+
"$a: 2px + #ccc" => "Cannot add a number with units (2px) to a color (#ccc).",
|
77
|
+
"$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#ccc).",
|
73
78
|
"& a\n :b c" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
|
74
79
|
"a\n :b\n c" => "Illegal nesting: Only properties may be nested beneath properties.",
|
75
80
|
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
76
|
-
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
77
81
|
"@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.",
|
78
82
|
"foo\n @import foo.css" => "CSS import directives may only be used at the root of a document.",
|
79
83
|
"@if true\n @import foo" => "Import directives may not be used within control directives or mixins.",
|
@@ -141,6 +145,8 @@ MSG
|
|
141
145
|
'@while' => "Invalid while directive '@while': expected expression.",
|
142
146
|
'@debug' => "Invalid debug directive '@debug': expected expression.",
|
143
147
|
%Q{@debug "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath debug directives.",
|
148
|
+
'@error' => "Invalid error directive '@error': expected expression.",
|
149
|
+
%Q{@error "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath error directives.",
|
144
150
|
'@warn' => "Invalid warn directive '@warn': expected expression.",
|
145
151
|
%Q{@warn "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath warn directives.",
|
146
152
|
"/* foo\n bar\n baz" => "Inconsistent indentation: previous line was indented by 4 spaces, but this line was indented by 2 spaces.",
|
@@ -171,6 +177,8 @@ MSG
|
|
171
177
|
"& foo\n bar: baz\n blat: bang" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
|
172
178
|
"a\n b: c\n& foo\n bar: baz\n blat: bang" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 3],
|
173
179
|
"@" => "Invalid directive: '@'.",
|
180
|
+
"$r: 20em * #ccc" => ["Cannot multiply a number with units (20em) to a color (#ccc).", 1],
|
181
|
+
"$r: #ccc / 1em" => ["Cannot divide a number with units (1em) to a color (#ccc).", 1],
|
174
182
|
}
|
175
183
|
|
176
184
|
def teardown
|
@@ -280,10 +288,10 @@ ERROR
|
|
280
288
|
def test_exception_line
|
281
289
|
to_render = <<SASS
|
282
290
|
rule
|
283
|
-
:
|
291
|
+
prop: val
|
284
292
|
// comment!
|
285
293
|
|
286
|
-
:
|
294
|
+
broken:
|
287
295
|
SASS
|
288
296
|
begin
|
289
297
|
Sass::Engine.new(to_render).render
|
@@ -297,10 +305,10 @@ SASS
|
|
297
305
|
def test_exception_location
|
298
306
|
to_render = <<SASS
|
299
307
|
rule
|
300
|
-
:
|
308
|
+
prop: val
|
301
309
|
// comment!
|
302
310
|
|
303
|
-
:
|
311
|
+
broken:
|
304
312
|
SASS
|
305
313
|
begin
|
306
314
|
Sass::Engine.new(to_render, :filename => FAKE_FILE_NAME, :line => (__LINE__-7)).render
|
@@ -526,9 +534,9 @@ ERR
|
|
526
534
|
opts = {:full_exception => true, :line => 362}
|
527
535
|
render(("a\n b: c\n" * 10) + "d\n e:\n" + ("f\n g: h\n" * 10), opts)
|
528
536
|
rescue Sass::SyntaxError => e
|
529
|
-
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..15].join("\n"))
|
537
|
+
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts[:line]).split("\n")[0..15].join("\n"))
|
530
538
|
/*
|
531
|
-
|
539
|
+
Error: Invalid property: "e:" (no value).
|
532
540
|
on line 383 of test_exception_css_with_offset_inline.sass
|
533
541
|
|
534
542
|
378: a
|
@@ -548,8 +556,7 @@ CSS
|
|
548
556
|
end
|
549
557
|
|
550
558
|
def test_exception_css_with_mixins
|
551
|
-
|
552
|
-
render(<<SASS, opts)
|
559
|
+
render(<<SASS, :full_exception => true)
|
553
560
|
=error-mixin($a)
|
554
561
|
color: $a * 1em * 1px
|
555
562
|
|
@@ -560,9 +567,9 @@ CSS
|
|
560
567
|
+outer-mixin(12)
|
561
568
|
SASS
|
562
569
|
rescue Sass::SyntaxError => e
|
563
|
-
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e
|
570
|
+
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e).split("\n")[0..13].join("\n"))
|
564
571
|
/*
|
565
|
-
|
572
|
+
Error: 12em*px isn't a valid CSS value.
|
566
573
|
on line 2 of test_exception_css_with_mixins_inline.sass, in `error-mixin'
|
567
574
|
from line 5 of test_exception_css_with_mixins_inline.sass, in `outer-mixin'
|
568
575
|
from line 8 of test_exception_css_with_mixins_inline.sass
|
@@ -580,8 +587,7 @@ CSS
|
|
580
587
|
end
|
581
588
|
|
582
589
|
def test_cssize_exception_css
|
583
|
-
|
584
|
-
render(<<SASS, opts)
|
590
|
+
render(<<SASS, :full_exception => true)
|
585
591
|
.filler
|
586
592
|
stuff: "stuff!"
|
587
593
|
|
@@ -591,9 +597,9 @@ a: b
|
|
591
597
|
a: b
|
592
598
|
SASS
|
593
599
|
rescue Sass::SyntaxError => e
|
594
|
-
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e
|
600
|
+
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e).split("\n")[0..11].join("\n"))
|
595
601
|
/*
|
596
|
-
|
602
|
+
Error: Properties are only allowed within rules, directives, mixin includes, or other properties.
|
597
603
|
on line 4 of test_cssize_exception_css_inline.sass
|
598
604
|
|
599
605
|
1: .filler
|
@@ -613,12 +619,12 @@ CSS
|
|
613
619
|
end
|
614
620
|
|
615
621
|
def test_http_import
|
616
|
-
assert_equal("@import
|
622
|
+
assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
|
617
623
|
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\""))
|
618
624
|
end
|
619
625
|
|
620
626
|
def test_protocol_relative_import
|
621
|
-
assert_equal("@import
|
627
|
+
assert_equal("@import \"//fonts.googleapis.com/css?family=Droid+Sans\";\n",
|
622
628
|
render("@import \"//fonts.googleapis.com/css?family=Droid+Sans\""))
|
623
629
|
end
|
624
630
|
|
@@ -648,18 +654,18 @@ SASS
|
|
648
654
|
|
649
655
|
def test_sass_import
|
650
656
|
sassc_file = sassc_path("importee")
|
651
|
-
assert !File.
|
657
|
+
assert !File.exist?(sassc_file)
|
652
658
|
renders_correctly "import", { :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"] }
|
653
|
-
assert File.
|
659
|
+
assert File.exist?(sassc_file)
|
654
660
|
end
|
655
661
|
|
656
662
|
def test_sass_pathname_import
|
657
663
|
sassc_file = sassc_path("importee")
|
658
|
-
assert !File.
|
664
|
+
assert !File.exist?(sassc_file)
|
659
665
|
renders_correctly("import",
|
660
666
|
:style => :compact,
|
661
667
|
:load_paths => [Pathname.new(File.dirname(__FILE__) + "/templates")])
|
662
|
-
assert File.
|
668
|
+
assert File.exist?(sassc_file)
|
663
669
|
end
|
664
670
|
|
665
671
|
def test_import_from_global_load_paths
|
@@ -675,7 +681,6 @@ SASS
|
|
675
681
|
def test_nonexistent_import
|
676
682
|
assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
|
677
683
|
File to import not found or unreadable: nonexistent.sass.
|
678
|
-
Load path: #{Dir.pwd}
|
679
684
|
ERR
|
680
685
|
render("@import nonexistent.sass")
|
681
686
|
end
|
@@ -684,30 +689,29 @@ ERR
|
|
684
689
|
def test_nonexistent_extensionless_import
|
685
690
|
assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
|
686
691
|
File to import not found or unreadable: nonexistent.
|
687
|
-
Load path: #{Dir.pwd}
|
688
692
|
ERR
|
689
693
|
render("@import nonexistent")
|
690
694
|
end
|
691
695
|
end
|
692
696
|
|
693
697
|
def test_no_cache
|
694
|
-
assert !File.
|
698
|
+
assert !File.exist?(sassc_path("importee"))
|
695
699
|
renders_correctly("import", {
|
696
700
|
:style => :compact, :cache => false,
|
697
701
|
:load_paths => [File.dirname(__FILE__) + "/templates"],
|
698
702
|
})
|
699
|
-
assert !File.
|
703
|
+
assert !File.exist?(sassc_path("importee"))
|
700
704
|
end
|
701
705
|
|
702
706
|
def test_import_in_rule
|
703
707
|
assert_equal(<<CSS, render(<<SASS, :load_paths => [File.dirname(__FILE__) + '/templates/']))
|
704
708
|
.foo #foo {
|
705
|
-
background-color: #
|
709
|
+
background-color: #baf; }
|
706
710
|
|
707
711
|
.bar {
|
708
712
|
a: b; }
|
709
713
|
.bar #foo {
|
710
|
-
background-color: #
|
714
|
+
background-color: #baf; }
|
711
715
|
CSS
|
712
716
|
.foo
|
713
717
|
@import partial
|
@@ -745,22 +749,22 @@ SASS
|
|
745
749
|
|
746
750
|
def test_basic_multiline_selector
|
747
751
|
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
748
|
-
render("#foo #bar,\n#baz #boom\n :
|
752
|
+
render("#foo #bar,\n#baz #boom\n foo: bar"))
|
749
753
|
assert_equal("#foo #bar,\n#foo #baz {\n foo: bar; }\n",
|
750
|
-
render("#foo\n #bar,\n #baz\n :
|
754
|
+
render("#foo\n #bar,\n #baz\n foo: bar"))
|
751
755
|
assert_equal("#foo,\n#bar {\n foo: bar; }\n #foo #baz,\n #bar #baz {\n foo: bar; }\n",
|
752
|
-
render("#foo,\n#bar\n :
|
756
|
+
render("#foo,\n#bar\n foo: bar\n #baz\n foo: bar"))
|
753
757
|
assert_equal("#foo #bar, #baz #boom { foo: bar; }\n",
|
754
|
-
render("#foo #bar,\n#baz #boom\n :
|
758
|
+
render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compact))
|
755
759
|
|
756
760
|
assert_equal("#foo #bar,#baz #boom{foo:bar}\n",
|
757
|
-
render("#foo #bar,\n#baz #boom\n :
|
761
|
+
render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compressed))
|
758
762
|
|
759
763
|
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
760
|
-
render("#foo #bar,,\n,#baz #boom,\n :
|
764
|
+
render("#foo #bar,,\n,#baz #boom,\n foo: bar"))
|
761
765
|
|
762
766
|
assert_equal("#bip #bop {\n foo: bar; }\n",
|
763
|
-
render("#bip #bop,, ,\n :
|
767
|
+
render("#bip #bop,, ,\n foo: bar"))
|
764
768
|
end
|
765
769
|
|
766
770
|
def test_complex_multiline_selector
|
@@ -779,7 +783,7 @@ SASS
|
|
779
783
|
end
|
780
784
|
|
781
785
|
begin
|
782
|
-
render("a\n :b c", :property_syntax => :new)
|
786
|
+
silence_warnings {render("a\n :b c", :property_syntax => :new)}
|
783
787
|
assert_equal(2, e.sass_line)
|
784
788
|
rescue Sass::SyntaxError => e
|
785
789
|
assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
|
@@ -802,53 +806,53 @@ SASS
|
|
802
806
|
def test_directive
|
803
807
|
assert_equal("@a b;\n", render("@a b"))
|
804
808
|
|
805
|
-
assert_equal("@a {\n b: c; }\n", render("@a\n :
|
806
|
-
assert_equal("@a { b: c; }\n", render("@a\n :
|
807
|
-
assert_equal("@a {\n b: c;\n}\n", render("@a\n :
|
808
|
-
assert_equal("@a{b:c}\n", render("@a\n :
|
809
|
+
assert_equal("@a {\n b: c; }\n", render("@a\n b: c"))
|
810
|
+
assert_equal("@a { b: c; }\n", render("@a\n b: c", :style => :compact))
|
811
|
+
assert_equal("@a {\n b: c;\n}\n", render("@a\n b: c", :style => :expanded))
|
812
|
+
assert_equal("@a{b:c}\n", render("@a\n b: c", :style => :compressed))
|
809
813
|
|
810
814
|
assert_equal("@a {\n b: c;\n d: e; }\n",
|
811
|
-
render("@a\n :
|
815
|
+
render("@a\n b: c\n d: e"))
|
812
816
|
assert_equal("@a { b: c; d: e; }\n",
|
813
|
-
render("@a\n :
|
817
|
+
render("@a\n b: c\n d: e", :style => :compact))
|
814
818
|
assert_equal("@a {\n b: c;\n d: e;\n}\n",
|
815
|
-
render("@a\n :
|
819
|
+
render("@a\n b: c\n d: e", :style => :expanded))
|
816
820
|
assert_equal("@a{b:c;d:e}\n",
|
817
|
-
render("@a\n :
|
821
|
+
render("@a\n b: c\n d: e", :style => :compressed))
|
818
822
|
|
819
823
|
assert_equal("@a {\n #b {\n c: d; } }\n",
|
820
|
-
render("@a\n #b\n :
|
824
|
+
render("@a\n #b\n c: d"))
|
821
825
|
assert_equal("@a { #b { c: d; } }\n",
|
822
|
-
render("@a\n #b\n :
|
826
|
+
render("@a\n #b\n c: d", :style => :compact))
|
823
827
|
assert_equal("@a {\n #b {\n c: d;\n }\n}\n",
|
824
|
-
render("@a\n #b\n :
|
828
|
+
render("@a\n #b\n c: d", :style => :expanded))
|
825
829
|
assert_equal("@a{#b{c:d}}\n",
|
826
|
-
render("@a\n #b\n :
|
830
|
+
render("@a\n #b\n c: d", :style => :compressed))
|
827
831
|
|
828
832
|
assert_equal("@a {\n #b {\n a: b; }\n #b #c {\n d: e; } }\n",
|
829
|
-
render("@a\n #b\n :
|
833
|
+
render("@a\n #b\n a: b\n #c\n d: e"))
|
830
834
|
assert_equal("@a { #b { a: b; }\n #b #c { d: e; } }\n",
|
831
|
-
render("@a\n #b\n :
|
835
|
+
render("@a\n #b\n a: b\n #c\n d: e", :style => :compact))
|
832
836
|
assert_equal("@a {\n #b {\n a: b;\n }\n #b #c {\n d: e;\n }\n}\n",
|
833
|
-
render("@a\n #b\n :
|
837
|
+
render("@a\n #b\n a: b\n #c\n d: e", :style => :expanded))
|
834
838
|
assert_equal("@a{#b{a:b}#b #c{d:e}}\n",
|
835
|
-
render("@a\n #b\n :
|
839
|
+
render("@a\n #b\n a: b\n #c\n d: e", :style => :compressed))
|
836
840
|
|
837
841
|
assert_equal("@a {\n #foo,\n #bar {\n b: c; } }\n",
|
838
|
-
render("@a\n #foo, \n #bar\n :
|
842
|
+
render("@a\n #foo, \n #bar\n b: c"))
|
839
843
|
assert_equal("@a { #foo, #bar { b: c; } }\n",
|
840
|
-
render("@a\n #foo, \n #bar\n :
|
844
|
+
render("@a\n #foo, \n #bar\n b: c", :style => :compact))
|
841
845
|
assert_equal("@a {\n #foo,\n #bar {\n b: c;\n }\n}\n",
|
842
|
-
render("@a\n #foo, \n #bar\n :
|
846
|
+
render("@a\n #foo, \n #bar\n b: c", :style => :expanded))
|
843
847
|
assert_equal("@a{#foo,#bar{b:c}}\n",
|
844
|
-
render("@a\n #foo, \n #bar\n :
|
848
|
+
render("@a\n #foo, \n #bar\n b: c", :style => :compressed))
|
845
849
|
|
846
850
|
to_render = <<END
|
847
851
|
@a
|
848
|
-
:
|
852
|
+
b: c
|
849
853
|
#d
|
850
|
-
:
|
851
|
-
:
|
854
|
+
e: f
|
855
|
+
g: h
|
852
856
|
END
|
853
857
|
rendered = <<END
|
854
858
|
@a { b: c;
|
@@ -1026,7 +1030,6 @@ SASS
|
|
1026
1030
|
@-webkit-keyframes warm {
|
1027
1031
|
from {
|
1028
1032
|
color: black; }
|
1029
|
-
|
1030
1033
|
to {
|
1031
1034
|
color: red; } }
|
1032
1035
|
CSS
|
@@ -1130,9 +1133,15 @@ SASS
|
|
1130
1133
|
end
|
1131
1134
|
|
1132
1135
|
def test_default_values_for_mixin_arguments
|
1133
|
-
assert_equal(
|
1136
|
+
assert_equal(<<CSS, render(<<SASS))
|
1137
|
+
white {
|
1138
|
+
color: #FFF; }
|
1139
|
+
|
1140
|
+
black {
|
1141
|
+
color: #000; }
|
1142
|
+
CSS
|
1134
1143
|
=foo($a: #FFF)
|
1135
|
-
:
|
1144
|
+
color: $a
|
1136
1145
|
white
|
1137
1146
|
+foo
|
1138
1147
|
black
|
@@ -1140,25 +1149,25 @@ black
|
|
1140
1149
|
SASS
|
1141
1150
|
assert_equal(<<CSS, render(<<SASS))
|
1142
1151
|
one {
|
1143
|
-
color:
|
1152
|
+
color: #fff;
|
1144
1153
|
padding: 1px;
|
1145
1154
|
margin: 4px; }
|
1146
1155
|
|
1147
1156
|
two {
|
1148
|
-
color:
|
1157
|
+
color: #fff;
|
1149
1158
|
padding: 2px;
|
1150
1159
|
margin: 5px; }
|
1151
1160
|
|
1152
1161
|
three {
|
1153
|
-
color:
|
1162
|
+
color: #fff;
|
1154
1163
|
padding: 2px;
|
1155
1164
|
margin: 3px; }
|
1156
1165
|
CSS
|
1157
1166
|
$a: 5px
|
1158
1167
|
=foo($a, $b: 1px, $c: 3px + $b)
|
1159
|
-
:
|
1160
|
-
:
|
1161
|
-
:
|
1168
|
+
color: $a
|
1169
|
+
padding: $b
|
1170
|
+
margin: $c
|
1162
1171
|
one
|
1163
1172
|
+foo(#fff)
|
1164
1173
|
two
|
@@ -1168,17 +1177,17 @@ three
|
|
1168
1177
|
SASS
|
1169
1178
|
assert_equal(<<CSS, render(<<SASS))
|
1170
1179
|
one {
|
1171
|
-
color:
|
1180
|
+
color: #fff;
|
1172
1181
|
padding: 1px;
|
1173
1182
|
margin: 4px; }
|
1174
1183
|
|
1175
1184
|
two {
|
1176
|
-
color:
|
1185
|
+
color: #fff;
|
1177
1186
|
padding: 2px;
|
1178
1187
|
margin: 5px; }
|
1179
1188
|
|
1180
1189
|
three {
|
1181
|
-
color:
|
1190
|
+
color: #fff;
|
1182
1191
|
padding: 2px;
|
1183
1192
|
margin: 3px; }
|
1184
1193
|
CSS
|
@@ -1383,7 +1392,7 @@ CSS
|
|
1383
1392
|
$variable: 0
|
1384
1393
|
bar
|
1385
1394
|
$local: 10
|
1386
|
-
-no-op: set-a-variable(variable, 5)
|
1395
|
+
-no-op: set-a-global-variable(variable, 5)
|
1387
1396
|
a: $variable
|
1388
1397
|
SASS
|
1389
1398
|
end
|
@@ -1617,31 +1626,6 @@ a
|
|
1617
1626
|
SASS
|
1618
1627
|
end
|
1619
1628
|
|
1620
|
-
def test_variable_scope
|
1621
|
-
silence_warnings {assert_equal(<<CSS, render(<<SASS))}
|
1622
|
-
a {
|
1623
|
-
b-1: c;
|
1624
|
-
b-2: c;
|
1625
|
-
d: 12; }
|
1626
|
-
|
1627
|
-
b {
|
1628
|
-
d: 17; }
|
1629
|
-
CSS
|
1630
|
-
$i: 12
|
1631
|
-
a
|
1632
|
-
@for $i from 1 through 2
|
1633
|
-
b-\#{$i}: c
|
1634
|
-
d: $i
|
1635
|
-
|
1636
|
-
=foo
|
1637
|
-
$i: 17
|
1638
|
-
|
1639
|
-
b
|
1640
|
-
+foo
|
1641
|
-
d: $i
|
1642
|
-
SASS
|
1643
|
-
end
|
1644
|
-
|
1645
1629
|
def test_hyphen_underscore_insensitive_variables
|
1646
1630
|
assert_equal(<<CSS, render(<<SASS))
|
1647
1631
|
d {
|
@@ -1684,7 +1668,7 @@ SASS
|
|
1684
1668
|
end
|
1685
1669
|
|
1686
1670
|
def test_argument_error
|
1687
|
-
|
1671
|
+
assert_raises(Sass::SyntaxError) { render("a\n b: hsl(1)") }
|
1688
1672
|
end
|
1689
1673
|
|
1690
1674
|
def test_comments_at_the_top_of_a_document
|
@@ -2029,10 +2013,10 @@ $var: "bar"
|
|
2029
2013
|
SASS
|
2030
2014
|
end
|
2031
2015
|
|
2032
|
-
def
|
2016
|
+
def test_interpolation_deep_unquotes_strings
|
2033
2017
|
assert_equal(<<CSS, render(<<SASS))
|
2034
2018
|
.foo {
|
2035
|
-
a:
|
2019
|
+
a: bar baz; }
|
2036
2020
|
CSS
|
2037
2021
|
.foo
|
2038
2022
|
a: \#{"bar" "baz"}
|
@@ -2074,20 +2058,21 @@ SASS
|
|
2074
2058
|
end
|
2075
2059
|
|
2076
2060
|
def test_warn_with_imports
|
2061
|
+
prefix = Sass::Util.cleanpath(File.dirname(__FILE__)).to_s
|
2077
2062
|
expected_warning = <<WARN
|
2078
2063
|
WARNING: In the main file
|
2079
|
-
on line 1 of #{
|
2064
|
+
on line 1 of #{prefix}/templates/warn.sass
|
2080
2065
|
|
2081
2066
|
WARNING: Imported
|
2082
|
-
on line 1 of #{
|
2083
|
-
from line 2 of #{
|
2067
|
+
on line 1 of #{prefix}/templates/warn_imported.sass
|
2068
|
+
from line 2 of #{prefix}/templates/warn.sass
|
2084
2069
|
|
2085
2070
|
WARNING: In an imported mixin
|
2086
|
-
on line 4 of #{
|
2087
|
-
from line 3 of #{
|
2071
|
+
on line 4 of #{prefix}/templates/warn_imported.sass, in `emits-a-warning'
|
2072
|
+
from line 3 of #{prefix}/templates/warn.sass
|
2088
2073
|
WARN
|
2089
2074
|
assert_warning expected_warning do
|
2090
|
-
renders_correctly "warn", :style => :compact, :load_paths => [
|
2075
|
+
renders_correctly "warn", :style => :compact, :load_paths => ["#{prefix}/templates"]
|
2091
2076
|
end
|
2092
2077
|
end
|
2093
2078
|
|
@@ -2472,6 +2457,18 @@ SASS
|
|
2472
2457
|
|
2473
2458
|
# Regression tests
|
2474
2459
|
|
2460
|
+
def test_interpolation_in_multiline_selector
|
2461
|
+
assert_equal(<<CSS, render(<<SASS))
|
2462
|
+
.foo,
|
2463
|
+
.bar {
|
2464
|
+
a: b; }
|
2465
|
+
CSS
|
2466
|
+
.foo,
|
2467
|
+
\#{".bar"}
|
2468
|
+
a: b
|
2469
|
+
SASS
|
2470
|
+
end
|
2471
|
+
|
2475
2472
|
def test_list_separator_with_arg_list
|
2476
2473
|
assert_equal(<<CSS, render(<<SASS))
|
2477
2474
|
.test {
|
@@ -2601,29 +2598,29 @@ SASS
|
|
2601
2598
|
border-style: solid; }
|
2602
2599
|
RESULT
|
2603
2600
|
.box
|
2604
|
-
:
|
2605
|
-
|
2606
|
-
:
|
2601
|
+
border:
|
2602
|
+
//color: black
|
2603
|
+
style: solid
|
2607
2604
|
SOURCE
|
2608
2605
|
|
2609
2606
|
assert_equal(<<RESULT, render(<<SOURCE))
|
2610
2607
|
.box {
|
2611
|
-
/* :
|
2608
|
+
/* color: black */
|
2612
2609
|
border-style: solid; }
|
2613
2610
|
RESULT
|
2614
2611
|
.box
|
2615
|
-
:
|
2616
|
-
/* :
|
2617
|
-
:
|
2612
|
+
border:
|
2613
|
+
/* color: black
|
2614
|
+
style: solid
|
2618
2615
|
SOURCE
|
2619
2616
|
|
2620
2617
|
assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed))
|
2621
2618
|
.box{border-style:solid}
|
2622
2619
|
RESULT
|
2623
2620
|
.box
|
2624
|
-
:
|
2625
|
-
|
2626
|
-
:
|
2621
|
+
border:
|
2622
|
+
/*color: black
|
2623
|
+
style: solid
|
2627
2624
|
SOURCE
|
2628
2625
|
end
|
2629
2626
|
|
@@ -2898,145 +2895,6 @@ CSS
|
|
2898
2895
|
SASS
|
2899
2896
|
end
|
2900
2897
|
|
2901
|
-
# Encodings
|
2902
|
-
|
2903
|
-
unless Sass::Util.ruby1_8?
|
2904
|
-
def test_encoding_error
|
2905
|
-
render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
|
2906
|
-
assert(false, "Expected exception")
|
2907
|
-
rescue Sass::SyntaxError => e
|
2908
|
-
assert_equal(3, e.sass_line)
|
2909
|
-
assert_equal('Invalid UTF-8 character "\xFE"', e.message)
|
2910
|
-
end
|
2911
|
-
|
2912
|
-
def test_ascii_incompatible_encoding_error
|
2913
|
-
template = "foo\nbar\nb_z".encode("utf-16le")
|
2914
|
-
template[9] = "\xFE".force_encoding("utf-16le")
|
2915
|
-
render(template)
|
2916
|
-
assert(false, "Expected exception")
|
2917
|
-
rescue Sass::SyntaxError => e
|
2918
|
-
assert_equal(3, e.sass_line)
|
2919
|
-
assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
|
2920
|
-
end
|
2921
|
-
|
2922
|
-
def test_same_charset_as_encoding
|
2923
|
-
assert_renders_encoded(<<CSS, <<SASS)
|
2924
|
-
@charset "UTF-8";
|
2925
|
-
fóó {
|
2926
|
-
a: b; }
|
2927
|
-
CSS
|
2928
|
-
@charset "utf-8"
|
2929
|
-
fóó
|
2930
|
-
a: b
|
2931
|
-
SASS
|
2932
|
-
end
|
2933
|
-
|
2934
|
-
def test_different_charset_than_encoding
|
2935
|
-
assert_renders_encoded(<<CSS.force_encoding("IBM866"), <<SASS)
|
2936
|
-
@charset "IBM866";
|
2937
|
-
fóó {
|
2938
|
-
a: b; }
|
2939
|
-
CSS
|
2940
|
-
@charset "ibm866"
|
2941
|
-
fóó
|
2942
|
-
a: b
|
2943
|
-
SASS
|
2944
|
-
end
|
2945
|
-
|
2946
|
-
def test_different_encoding_than_system
|
2947
|
-
assert_renders_encoded(<<CSS.encode("IBM866"), <<SASS.encode("IBM866"))
|
2948
|
-
@charset "IBM866";
|
2949
|
-
тАЬ {
|
2950
|
-
a: b; }
|
2951
|
-
CSS
|
2952
|
-
тАЬ
|
2953
|
-
a: b
|
2954
|
-
SASS
|
2955
|
-
end
|
2956
|
-
|
2957
|
-
def test_multibyte_charset
|
2958
|
-
assert_renders_encoded(<<CSS.encode("UTF-16LE"), <<SASS.encode("UTF-16LE").force_encoding("UTF-8"))
|
2959
|
-
@charset "UTF-16LE";
|
2960
|
-
fóó {
|
2961
|
-
a: b; }
|
2962
|
-
CSS
|
2963
|
-
@charset "utf-16le"
|
2964
|
-
fóó
|
2965
|
-
a: b
|
2966
|
-
SASS
|
2967
|
-
end
|
2968
|
-
|
2969
|
-
def test_multibyte_charset_without_endian_specifier
|
2970
|
-
assert_renders_encoded(<<CSS.encode("UTF-32BE"), <<SASS.encode("UTF-32BE").force_encoding("UTF-8"))
|
2971
|
-
@charset "UTF-32BE";
|
2972
|
-
fóó {
|
2973
|
-
a: b; }
|
2974
|
-
CSS
|
2975
|
-
@charset "utf-32"
|
2976
|
-
fóó
|
2977
|
-
a: b
|
2978
|
-
SASS
|
2979
|
-
end
|
2980
|
-
|
2981
|
-
def test_utf8_bom
|
2982
|
-
assert_renders_encoded(<<CSS, <<SASS.force_encoding("BINARY"))
|
2983
|
-
@charset "UTF-8";
|
2984
|
-
fóó {
|
2985
|
-
a: b; }
|
2986
|
-
CSS
|
2987
|
-
\uFEFFfóó
|
2988
|
-
a: b
|
2989
|
-
SASS
|
2990
|
-
end
|
2991
|
-
|
2992
|
-
def test_utf16le_bom
|
2993
|
-
assert_renders_encoded(<<CSS.encode("UTF-16LE"), <<SASS.encode("UTF-16LE").force_encoding("BINARY"))
|
2994
|
-
@charset "UTF-16LE";
|
2995
|
-
fóó {
|
2996
|
-
a: b; }
|
2997
|
-
CSS
|
2998
|
-
\uFEFFfóó
|
2999
|
-
a: b
|
3000
|
-
SASS
|
3001
|
-
end
|
3002
|
-
|
3003
|
-
def test_utf32be_bom
|
3004
|
-
assert_renders_encoded(<<CSS.encode("UTF-32BE"), <<SASS.encode("UTF-32BE").force_encoding("BINARY"))
|
3005
|
-
@charset "UTF-32BE";
|
3006
|
-
fóó {
|
3007
|
-
a: b; }
|
3008
|
-
CSS
|
3009
|
-
\uFEFFfóó
|
3010
|
-
a: b
|
3011
|
-
SASS
|
3012
|
-
end
|
3013
|
-
|
3014
|
-
# Encoding Regression Test
|
3015
|
-
|
3016
|
-
def test_multibyte_prop_name
|
3017
|
-
assert_equal(<<CSS, render(<<SASS))
|
3018
|
-
@charset "UTF-8";
|
3019
|
-
#bar {
|
3020
|
-
cölor: blue; }
|
3021
|
-
CSS
|
3022
|
-
#bar
|
3023
|
-
cölor: blue
|
3024
|
-
SASS
|
3025
|
-
end
|
3026
|
-
|
3027
|
-
def test_multibyte_and_interpolation
|
3028
|
-
assert_equal(<<CSS, render(<<SCSS, :syntax => :scss))
|
3029
|
-
#bar {
|
3030
|
-
background: a 0%; }
|
3031
|
-
CSS
|
3032
|
-
#bar {
|
3033
|
-
//
|
3034
|
-
background: \#{a} 0%;
|
3035
|
-
}
|
3036
|
-
SCSS
|
3037
|
-
end
|
3038
|
-
end
|
3039
|
-
|
3040
2898
|
def test_original_filename_set
|
3041
2899
|
importer = MockImporter.new
|
3042
2900
|
importer.add_import("imported", "div{color:red}")
|
@@ -3057,7 +2915,7 @@ SCSS
|
|
3057
2915
|
assert_equal <<CSS, render(<<SASS)
|
3058
2916
|
div {
|
3059
2917
|
maximum: 1.00000001;
|
3060
|
-
too-much: 1
|
2918
|
+
too-much: 1; }
|
3061
2919
|
CSS
|
3062
2920
|
div
|
3063
2921
|
maximum : 1.00000001
|
@@ -3287,6 +3145,13 @@ test_debug_inspects_sass_objects_inline.scss:1 DEBUG: (a: 1, b: 2)
|
|
3287
3145
|
END
|
3288
3146
|
end
|
3289
3147
|
|
3148
|
+
def test_error_throws_sass_objects
|
3149
|
+
assert_raise_message(Sass::SyntaxError, "(a: 1, b: 2)") {render("@error (a: 1, b: 2)")}
|
3150
|
+
assert_raise_message(Sass::SyntaxError, "(a: 1, b: 2)") do
|
3151
|
+
render("$map: (a: 1, b: 2); @error $map", :syntax => :scss)
|
3152
|
+
end
|
3153
|
+
end
|
3154
|
+
|
3290
3155
|
def test_default_arg_before_splat
|
3291
3156
|
assert_equal <<CSS, render(<<SASS, :syntax => :scss)
|
3292
3157
|
.foo-positional {
|
@@ -3315,10 +3180,227 @@ CSS
|
|
3315
3180
|
SASS
|
3316
3181
|
end
|
3317
3182
|
|
3183
|
+
def test_keyframes
|
3184
|
+
assert_equal <<CSS, render(<<SASS)
|
3185
|
+
@keyframes identifier {
|
3186
|
+
0% {
|
3187
|
+
top: 0;
|
3188
|
+
left: 0; }
|
3189
|
+
30% {
|
3190
|
+
top: 50px; }
|
3191
|
+
68%, 72% {
|
3192
|
+
left: 50px; }
|
3193
|
+
100% {
|
3194
|
+
top: 100px;
|
3195
|
+
left: 100%; } }
|
3196
|
+
CSS
|
3197
|
+
@keyframes identifier
|
3198
|
+
0%
|
3199
|
+
top: 0
|
3200
|
+
left: 0
|
3201
|
+
\#{"30%"}
|
3202
|
+
top: 50px
|
3203
|
+
68%, 72%
|
3204
|
+
left: 50px
|
3205
|
+
100%
|
3206
|
+
top: 100px
|
3207
|
+
left: 100%
|
3208
|
+
SASS
|
3209
|
+
end
|
3210
|
+
|
3211
|
+
def test_prefixed_keyframes
|
3212
|
+
assert_equal <<CSS, render(<<SASS)
|
3213
|
+
@-moz-keyframes identifier {
|
3214
|
+
0% {
|
3215
|
+
top: 0;
|
3216
|
+
left: 0; }
|
3217
|
+
30% {
|
3218
|
+
top: 50px; }
|
3219
|
+
68%, 72% {
|
3220
|
+
left: 50px; }
|
3221
|
+
100% {
|
3222
|
+
top: 100px;
|
3223
|
+
left: 100%; } }
|
3224
|
+
CSS
|
3225
|
+
@-moz-keyframes identifier
|
3226
|
+
0%
|
3227
|
+
top: 0
|
3228
|
+
left: 0
|
3229
|
+
\#{"30%"}
|
3230
|
+
top: 50px
|
3231
|
+
68%, 72%
|
3232
|
+
left: 50px
|
3233
|
+
100%
|
3234
|
+
top: 100px
|
3235
|
+
left: 100%
|
3236
|
+
SASS
|
3237
|
+
end
|
3238
|
+
|
3239
|
+
def test_uppercase_keyframes
|
3240
|
+
assert_equal <<CSS, render(<<SASS)
|
3241
|
+
@KEYFRAMES identifier {
|
3242
|
+
0% {
|
3243
|
+
top: 0;
|
3244
|
+
left: 0; }
|
3245
|
+
30% {
|
3246
|
+
top: 50px; }
|
3247
|
+
68%, 72% {
|
3248
|
+
left: 50px; }
|
3249
|
+
100% {
|
3250
|
+
top: 100px;
|
3251
|
+
left: 100%; } }
|
3252
|
+
CSS
|
3253
|
+
@KEYFRAMES identifier
|
3254
|
+
0%
|
3255
|
+
top: 0
|
3256
|
+
left: 0
|
3257
|
+
\#{"30%"}
|
3258
|
+
top: 50px
|
3259
|
+
68%, 72%
|
3260
|
+
left: 50px
|
3261
|
+
100%
|
3262
|
+
top: 100px
|
3263
|
+
left: 100%
|
3264
|
+
SASS
|
3265
|
+
end
|
3266
|
+
|
3267
|
+
def test_compressed_unknown_directive
|
3268
|
+
assert_equal(<<CSS, render(<<SASS, :style => :compressed))
|
3269
|
+
x{@foo;a:b;@bar}
|
3270
|
+
CSS
|
3271
|
+
x
|
3272
|
+
@foo
|
3273
|
+
a: b
|
3274
|
+
@bar
|
3275
|
+
SASS
|
3276
|
+
end
|
3277
|
+
|
3278
|
+
def test_compressed_unknown_directive_in_directive
|
3279
|
+
assert_equal(<<CSS, render(<<SASS, :style => :compressed))
|
3280
|
+
@x{@foo;a:b;@bar}
|
3281
|
+
CSS
|
3282
|
+
@x
|
3283
|
+
@foo
|
3284
|
+
a: b
|
3285
|
+
@bar
|
3286
|
+
SASS
|
3287
|
+
end
|
3288
|
+
|
3289
|
+
def test_compressed_unknown_directive_with_children_in_directive
|
3290
|
+
assert_equal(<<CSS, render(<<SASS, :style => :compressed))
|
3291
|
+
@x{@foo{a:b}c:d;@bar{e:f}}
|
3292
|
+
CSS
|
3293
|
+
@x
|
3294
|
+
@foo
|
3295
|
+
a: b
|
3296
|
+
c: d
|
3297
|
+
@bar
|
3298
|
+
e: f
|
3299
|
+
SASS
|
3300
|
+
end
|
3301
|
+
|
3302
|
+
def test_compressed_rule_in_directive
|
3303
|
+
assert_equal(<<CSS, render(<<SASS, :style => :compressed))
|
3304
|
+
@x{foo{a:b}c:d;bar{e:f}}
|
3305
|
+
CSS
|
3306
|
+
@x
|
3307
|
+
foo
|
3308
|
+
a: b
|
3309
|
+
c: d
|
3310
|
+
bar
|
3311
|
+
e: f
|
3312
|
+
SASS
|
3313
|
+
end
|
3314
|
+
|
3315
|
+
def test_import_two_css_files_issue_1806
|
3316
|
+
assert_equal(<<CSS, render(<<SASS, :syntax => :scss, :style => :compressed))
|
3317
|
+
@import url(\"foo.css\");@import url(\"bar.css\");@import url(\"baz.css\")
|
3318
|
+
CSS
|
3319
|
+
@import url("foo.css");
|
3320
|
+
@import url("bar.css");
|
3321
|
+
@import url("baz.css");
|
3322
|
+
SASS
|
3323
|
+
end
|
3324
|
+
|
3325
|
+
def test_numeric_formatting_of_integers
|
3326
|
+
assert_equal(<<CSS, render(<<SASS, :syntax => :scss, :style => :compressed))
|
3327
|
+
a{near:3.00001;plus:3;minus:3;negative:-3}
|
3328
|
+
CSS
|
3329
|
+
a {
|
3330
|
+
near: (3 + 0.00001);
|
3331
|
+
plus: (3 + 0.0000001);
|
3332
|
+
minus: (3 - 0.0000001);
|
3333
|
+
negative: (-3 + 0.0000001);
|
3334
|
+
}
|
3335
|
+
SASS
|
3336
|
+
end
|
3337
|
+
|
3338
|
+
def test_escaped_semicolons_are_not_compressed
|
3339
|
+
assert_equal(<<'CSS', render(<<'SASS', :syntax => :scss, :style => :compressed))
|
3340
|
+
div{color:#f00000\9\0\;}
|
3341
|
+
CSS
|
3342
|
+
div {
|
3343
|
+
color: #f00000\9\0\;
|
3344
|
+
}
|
3345
|
+
SASS
|
3346
|
+
end
|
3347
|
+
|
3348
|
+
def test_compressed_output_of_nth_selectors
|
3349
|
+
assert_equal(<<CSS, render(<<SASS, :syntax => :scss, :style => :compressed))
|
3350
|
+
:nth-of-type(2n-1),:nth-child(2n-1),:nth(2n-1),:nth-of-type(2n-1),:nth-of-type(2n-1){color:red}:nth-of-type(2n+1),:nth-child(2n+1),:nth(2n+1),:nth-of-type(2n+1),:nth-of-type(2n+1){color:red}
|
3351
|
+
CSS
|
3352
|
+
:nth-of-type(2n-1), :nth-child(2n- 1), :nth(2n -1), :nth-of-type(2n - 1), :nth-of-type( 2n - 1 ) {
|
3353
|
+
color: red }
|
3354
|
+
:nth-of-type(2n+1), :nth-child(2n+ 1), :nth(2n +1), :nth-of-type(2n + 1), :nth-of-type( 2n + 1 ) {
|
3355
|
+
color: red }
|
3356
|
+
SASS
|
3357
|
+
end
|
3358
|
+
|
3359
|
+
def test_descendant_selectors_with_leading_dash
|
3360
|
+
assert_equal(<<CSS, render(<<SASS, :syntax => :scss, :style => :compressed))
|
3361
|
+
a -b{color:red}
|
3362
|
+
CSS
|
3363
|
+
a -b {
|
3364
|
+
color: red }
|
3365
|
+
SASS
|
3366
|
+
end
|
3367
|
+
|
3368
|
+
def test_import_with_supports_clause_interp
|
3369
|
+
assert_equal(<<CSS, render(<<'SASS', :style => :compressed))
|
3370
|
+
@import url("fallback-layout.css") supports(not (display: flex))
|
3371
|
+
CSS
|
3372
|
+
$display-type: flex
|
3373
|
+
@import url("fallback-layout.css") supports(not (display: #{$display-type}))
|
3374
|
+
SASS
|
3375
|
+
end
|
3376
|
+
|
3377
|
+
def test_import_with_supports_clause
|
3378
|
+
assert_equal(<<CSS, render(<<SASS, :style => :compressed))
|
3379
|
+
@import url("fallback-layout.css") supports(not (display: flex))
|
3380
|
+
CSS
|
3381
|
+
@import url("fallback-layout.css") supports(not (display: flex))
|
3382
|
+
SASS
|
3383
|
+
end
|
3384
|
+
|
3385
|
+
def test_compressed_commas_in_attribute_selectors
|
3386
|
+
assert_equal(<<CSS, render(<<SASS, :style => :compressed))
|
3387
|
+
.classname[a="1, 2, 3"],.another[b="4, 5, 6"]{color:red}
|
3388
|
+
CSS
|
3389
|
+
.classname[a="1, 2, 3"], .another[b="4, 5, 6"]
|
3390
|
+
color: red
|
3391
|
+
SASS
|
3392
|
+
end
|
3393
|
+
|
3318
3394
|
private
|
3319
3395
|
|
3320
3396
|
def assert_hash_has(hash, expected)
|
3321
|
-
expected.each
|
3397
|
+
expected.each do |k, v|
|
3398
|
+
if v.nil?
|
3399
|
+
assert_nil(hash[k])
|
3400
|
+
else
|
3401
|
+
assert_equal(v, hash[k])
|
3402
|
+
end
|
3403
|
+
end
|
3322
3404
|
end
|
3323
3405
|
|
3324
3406
|
def assert_renders_encoded(css, sass)
|
@@ -3350,7 +3432,8 @@ SASS
|
|
3350
3432
|
end
|
3351
3433
|
|
3352
3434
|
def filename(name, type)
|
3353
|
-
File.dirname(__FILE__) + "/#{type == 'sass' ? 'templates' : 'results'}/#{name}.#{type}"
|
3435
|
+
path = File.dirname(__FILE__) + "/#{type == 'sass' ? 'templates' : 'results'}/#{name}.#{type}"
|
3436
|
+
Sass::Util.cleanpath(path).to_s
|
3354
3437
|
end
|
3355
3438
|
|
3356
3439
|
def sassc_path(template)
|