sass 3.4.25 → 3.5.0.pre.rc.1
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 +13 -157
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/lib/sass.rb +3 -10
- data/lib/sass/cache_stores/filesystem.rb +1 -1
- data/lib/sass/css.rb +2 -3
- data/lib/sass/engine.rb +46 -32
- data/lib/sass/environment.rb +27 -6
- data/lib/sass/error.rb +5 -5
- data/lib/sass/exec/base.rb +3 -12
- data/lib/sass/features.rb +1 -0
- data/lib/sass/importers/filesystem.rb +2 -2
- data/lib/sass/plugin.rb +1 -1
- data/lib/sass/plugin/compiler.rb +21 -51
- data/lib/sass/plugin/configuration.rb +1 -1
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/staleness_checker.rb +3 -3
- data/lib/sass/railtie.rb +1 -1
- data/lib/sass/script.rb +3 -3
- data/lib/sass/script/functions.rb +238 -47
- data/lib/sass/script/lexer.rb +8 -6
- data/lib/sass/script/parser.rb +76 -75
- data/lib/sass/script/tree/funcall.rb +35 -30
- data/lib/sass/script/tree/list_literal.rb +23 -8
- data/lib/sass/script/tree/map_literal.rb +2 -2
- data/lib/sass/script/tree/node.rb +2 -10
- data/lib/sass/script/tree/operation.rb +16 -50
- data/lib/sass/script/value.rb +2 -0
- data/lib/sass/script/value/arg_list.rb +1 -1
- data/lib/sass/script/value/base.rb +20 -3
- data/lib/sass/script/value/callable.rb +25 -0
- data/lib/sass/script/value/color.rb +10 -10
- data/lib/sass/script/value/function.rb +19 -0
- data/lib/sass/script/value/helpers.rb +16 -7
- data/lib/sass/script/value/list.rb +33 -12
- data/lib/sass/script/value/map.rb +2 -2
- data/lib/sass/script/value/number.rb +3 -3
- data/lib/sass/script/value/string.rb +12 -5
- data/lib/sass/scss/parser.rb +101 -45
- data/lib/sass/scss/rx.rb +5 -11
- data/lib/sass/scss/static_parser.rb +0 -7
- data/lib/sass/selector.rb +4 -0
- data/lib/sass/selector/abstract_sequence.rb +5 -5
- data/lib/sass/selector/comma_sequence.rb +3 -15
- data/lib/sass/selector/pseudo.rb +4 -0
- data/lib/sass/selector/sequence.rb +30 -3
- data/lib/sass/selector/simple.rb +13 -7
- data/lib/sass/selector/simple_sequence.rb +1 -1
- data/lib/sass/shared.rb +3 -5
- data/lib/sass/source/map.rb +4 -4
- data/lib/sass/source/position.rb +4 -4
- data/lib/sass/stack.rb +21 -1
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +1 -1
- data/lib/sass/tree/node.rb +3 -3
- data/lib/sass/tree/prop_node.rb +46 -54
- data/lib/sass/tree/rule_node.rb +7 -15
- data/lib/sass/tree/visitors/check_nesting.rb +1 -1
- data/lib/sass/tree/visitors/convert.rb +2 -3
- data/lib/sass/tree/visitors/cssize.rb +1 -10
- data/lib/sass/tree/visitors/deep_copy.rb +2 -2
- data/lib/sass/tree/visitors/perform.rb +23 -12
- data/lib/sass/tree/visitors/set_options.rb +1 -1
- data/lib/sass/tree/visitors/to_css.rb +46 -12
- data/lib/sass/util.rb +16 -321
- data/lib/sass/util/multibyte_string_scanner.rb +127 -131
- data/lib/sass/util/normalized_map.rb +1 -8
- data/lib/sass/version.rb +2 -2
- data/test/sass-spec.yml +1 -1
- data/test/sass/compiler_test.rb +4 -14
- data/test/sass/conversion_test.rb +113 -162
- data/test/sass/css2sass_test.rb +17 -19
- data/test/sass/css_variable_test.rb +176 -70
- data/test/sass/encoding_test.rb +2 -32
- data/test/sass/engine_test.rb +114 -65
- data/test/sass/extend_test.rb +37 -51
- data/test/sass/functions_test.rb +57 -15
- data/test/sass/importer_test.rb +2 -2
- 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 +9 -12
- data/test/sass/script_conversion_test.rb +9 -0
- data/test/sass/script_test.rb +38 -48
- data/test/sass/scss/css_test.rb +5 -19
- data/test/sass/scss/scss_test.rb +58 -39
- data/test/sass/source_map_test.rb +26 -28
- 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 +139 -149
- data/test/sass/util_test.rb +0 -36
- data/test/test_helper.rb +39 -0
- metadata +30 -57
- data/extra/sass-spec-ref.sh +0 -32
- data/lib/sass/deprecation.rb +0 -55
- data/lib/sass/script/css_variable_warning.rb +0 -52
- data/lib/sass/util/cross_platform_random.rb +0 -19
- data/lib/sass/util/ordered_hash.rb +0 -192
- data/test/sass/results/import_charset_1_8.css +0 -5
- data/test/sass/templates/import_charset_1_8.sass +0 -6
- data/vendor/listen/CHANGELOG.md +0 -1
- data/vendor/listen/CONTRIBUTING.md +0 -38
- data/vendor/listen/Gemfile +0 -20
- data/vendor/listen/Guardfile +0 -8
- data/vendor/listen/LICENSE +0 -20
- data/vendor/listen/README.md +0 -349
- data/vendor/listen/Rakefile +0 -5
- data/vendor/listen/Vagrantfile +0 -96
- data/vendor/listen/lib/listen.rb +0 -54
- data/vendor/listen/lib/listen/adapter.rb +0 -327
- data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
- data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
- data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
- data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
- data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
- data/vendor/listen/lib/listen/directory_record.rb +0 -406
- data/vendor/listen/lib/listen/listener.rb +0 -323
- data/vendor/listen/lib/listen/turnstile.rb +0 -32
- data/vendor/listen/lib/listen/version.rb +0 -3
- data/vendor/listen/listen.gemspec +0 -28
- data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
- data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
- data/vendor/listen/spec/listen/listener_spec.rb +0 -258
- data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
- data/vendor/listen/spec/listen_spec.rb +0 -67
- data/vendor/listen/spec/spec_helper.rb +0 -25
- data/vendor/listen/spec/support/adapter_helper.rb +0 -666
- data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
- data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
- data/vendor/listen/spec/support/listeners_helper.rb +0 -179
- data/vendor/listen/spec/support/platform_helper.rb +0 -15
data/test/sass/functions_test.rb
CHANGED
@@ -21,7 +21,9 @@ module Sass::Script::Functions
|
|
21
21
|
declare :only_kw_args, [], :var_kwargs => true
|
22
22
|
|
23
23
|
def deprecated_arg_fn(arg1, arg2, arg3 = nil)
|
24
|
-
Sass::Script::Value::List.new(
|
24
|
+
Sass::Script::Value::List.new(
|
25
|
+
[arg1, arg2, arg3 || Sass::Script::Value::Null.new],
|
26
|
+
separator: :space)
|
25
27
|
end
|
26
28
|
declare :deprecated_arg_fn, [:arg1, :arg2, :arg3], :deprecated => [:arg_1, :arg_2, :arg3]
|
27
29
|
declare :deprecated_arg_fn, [:arg1, :arg2], :deprecated => [:arg_1, :arg_2]
|
@@ -876,12 +878,22 @@ WARNING
|
|
876
878
|
|
877
879
|
def test_invert
|
878
880
|
assert_equal("#112233", evaluate("invert(#edc)"))
|
881
|
+
assert_equal("#d8cabd", evaluate("invert(#edc, 10%)"))
|
879
882
|
assert_equal("rgba(245, 235, 225, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5))"))
|
883
|
+
assert_equal("rgba(34, 42, 50, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5), 10%)"))
|
880
884
|
assert_equal("invert(20%)", evaluate("invert(20%)"))
|
881
885
|
end
|
882
886
|
|
883
887
|
def test_invert_tests_types
|
884
888
|
assert_error_message("$color: \"foo\" is not a color for `invert'", "invert(\"foo\")")
|
889
|
+
assert_error_message("$weight: \"foo\" is not a number for `invert'", "invert(#edc, \"foo\")")
|
890
|
+
end
|
891
|
+
|
892
|
+
def test_invert_tests_bounds
|
893
|
+
assert_error_message("Weight -0.001 must be between 0% and 100% for `invert'",
|
894
|
+
"invert(#edc, -0.001)")
|
895
|
+
assert_error_message("Weight 100.001 must be between 0% and 100% for `invert'",
|
896
|
+
"invert(#edc, 100.001)")
|
885
897
|
end
|
886
898
|
|
887
899
|
def test_unquote
|
@@ -891,6 +903,7 @@ WARNING
|
|
891
903
|
assert_warning <<MESSAGE do
|
892
904
|
DEPRECATION WARNING: Passing blue, a non-string value, to unquote()
|
893
905
|
will be an error in future versions of Sass.
|
906
|
+
on line 1 of test_unquote_inline.scss
|
894
907
|
MESSAGE
|
895
908
|
assert_equal('blue', evaluate('unquote(blue)'))
|
896
909
|
end
|
@@ -1467,30 +1480,56 @@ SCSS
|
|
1467
1480
|
end
|
1468
1481
|
|
1469
1482
|
def test_call_with_positional_arguments
|
1470
|
-
|
1483
|
+
# TODO: Remove this block in 4.0
|
1484
|
+
Sass::Util.silence_sass_warnings do
|
1485
|
+
assert_equal evaluate("lighten(blue, 5%)"), evaluate("call(lighten, blue, 5%)")
|
1486
|
+
end
|
1487
|
+
assert_equal evaluate("lighten(blue, 5%)"), evaluate("call(get-function(lighten), blue, 5%)")
|
1471
1488
|
end
|
1472
1489
|
|
1473
1490
|
def test_call_with_keyword_arguments
|
1491
|
+
# TODO: Remove this block in 4.0
|
1492
|
+
Sass::Util.silence_sass_warnings do
|
1493
|
+
assert_equal(
|
1494
|
+
evaluate("lighten($color: blue, $amount: 5%)"),
|
1495
|
+
evaluate("call(lighten, $color: blue, $amount: 5%)"))
|
1496
|
+
end
|
1474
1497
|
assert_equal(
|
1475
1498
|
evaluate("lighten($color: blue, $amount: 5%)"),
|
1476
|
-
evaluate("call(lighten, $color: blue, $amount: 5%)"))
|
1499
|
+
evaluate("call(get-function(lighten), $color: blue, $amount: 5%)"))
|
1477
1500
|
end
|
1478
1501
|
|
1479
1502
|
def test_call_with_keyword_and_positional_arguments
|
1503
|
+
# TODO: Remove this block in 4.0
|
1504
|
+
Sass::Util.silence_sass_warnings do
|
1505
|
+
assert_equal(
|
1506
|
+
evaluate("lighten(blue, $amount: 5%)"),
|
1507
|
+
evaluate("call(lighten, blue, $amount: 5%)"))
|
1508
|
+
end
|
1480
1509
|
assert_equal(
|
1481
1510
|
evaluate("lighten(blue, $amount: 5%)"),
|
1482
|
-
evaluate("call(lighten, blue, $amount: 5%)"))
|
1511
|
+
evaluate("call(get-function(lighten), blue, $amount: 5%)"))
|
1483
1512
|
end
|
1484
1513
|
|
1485
1514
|
def test_call_with_dynamic_name
|
1515
|
+
# TODO: Remove this block in 4.0
|
1516
|
+
Sass::Util.silence_sass_warnings do
|
1517
|
+
assert_equal(
|
1518
|
+
evaluate("lighten($color: blue, $amount: 5%)"),
|
1519
|
+
evaluate("call($fn, $color: blue, $amount: 5%)",
|
1520
|
+
env("fn" => Sass::Script::Value::String.new("lighten"))))
|
1521
|
+
end
|
1486
1522
|
assert_equal(
|
1487
1523
|
evaluate("lighten($color: blue, $amount: 5%)"),
|
1488
1524
|
evaluate("call($fn, $color: blue, $amount: 5%)",
|
1489
|
-
env("fn" => Sass::Script::
|
1525
|
+
env("fn" => Sass::Script::Value::Function.new(
|
1526
|
+
Sass::Callable.new("lighten", nil, nil, nil, nil, nil, "function", :builtin)))))
|
1490
1527
|
end
|
1491
1528
|
|
1529
|
+
# TODO: Remove this test in 4.0
|
1492
1530
|
def test_call_uses_local_scope
|
1493
|
-
|
1531
|
+
Sass::Util.silence_sass_warnings do
|
1532
|
+
assert_equal <<CSS, render(<<SCSS)
|
1494
1533
|
.first-scope {
|
1495
1534
|
a: local; }
|
1496
1535
|
|
@@ -1508,18 +1547,24 @@ CSS
|
|
1508
1547
|
a: call(foo);
|
1509
1548
|
}
|
1510
1549
|
SCSS
|
1550
|
+
end
|
1511
1551
|
end
|
1512
1552
|
|
1513
1553
|
def test_call_unknown_function
|
1514
|
-
|
1554
|
+
# TODO: Remove this block in 4.0
|
1555
|
+
Sass::Util.silence_sass_warnings do
|
1556
|
+
assert_equal evaluate("unknown(red, blue)"), evaluate("call(unknown, red, blue)")
|
1557
|
+
end
|
1558
|
+
assert_equal evaluate("unknown(red, blue)"), evaluate("call(get-function(unknown, $css: true), red, blue)")
|
1515
1559
|
end
|
1516
1560
|
|
1517
1561
|
def test_call_with_non_string_argument
|
1518
|
-
assert_error_message "$
|
1562
|
+
assert_error_message "$function: 3px is not a function for `call'", "call(3px)"
|
1519
1563
|
end
|
1520
1564
|
|
1521
1565
|
def test_errors_in_called_function
|
1522
|
-
assert_error_message "$color: 3px is not a color for `lighten'",
|
1566
|
+
assert_error_message "$color: 3px is not a color for `lighten'",
|
1567
|
+
"call(get-function(lighten), 3px, 5%)"
|
1523
1568
|
end
|
1524
1569
|
|
1525
1570
|
def test_variable_exists
|
@@ -1841,11 +1886,8 @@ WARNING
|
|
1841
1886
|
assert_equal(".bar", evaluate("selector-replace('.foo', '.foo', '.bar')"))
|
1842
1887
|
assert_equal(".foo.baz", evaluate("selector-replace('.foo.bar', '.bar', '.baz')"))
|
1843
1888
|
assert_equal(".a .foo.baz", evaluate("selector-replace('.foo.bar', '.bar', '.a .baz')"))
|
1844
|
-
|
1845
|
-
|
1846
|
-
# functions.
|
1847
|
-
assert_no_warning {assert_equal(".foo.bar", evaluate("selector-replace('.foo.bar', '.baz.bar', '.qux')"))}
|
1848
|
-
assert_no_warning {assert_equal(".bar.qux", evaluate("selector-replace('.foo.bar.baz', '.foo.baz', '.qux')"))}
|
1889
|
+
assert_equal(".foo.bar", evaluate("selector-replace('.foo.bar', '.baz.bar', '.qux')"))
|
1890
|
+
assert_equal(".bar.qux", evaluate("selector-replace('.foo.bar.baz', '.foo.baz', '.qux')"))
|
1849
1891
|
|
1850
1892
|
assert_equal(":not(.bar)", evaluate("selector-replace(':not(.foo)', '.foo', '.bar')"))
|
1851
1893
|
assert_equal(".bar", evaluate("selector-replace(':not(.foo)', ':not(.foo)', '.bar')"))
|
@@ -1958,7 +2000,7 @@ WARNING
|
|
1958
2000
|
end
|
1959
2001
|
|
1960
2002
|
def perform(value, environment = env)
|
1961
|
-
Sass::Script::Parser.parse(value, 0,
|
2003
|
+
Sass::Script::Parser.parse(value, 1, 0, {:filename => "#{test_name}_inline.scss"}).perform(environment)
|
1962
2004
|
end
|
1963
2005
|
|
1964
2006
|
def render(sass, options = {})
|
data/test/sass/importer_test.rb
CHANGED
@@ -282,7 +282,7 @@ SCSS
|
|
282
282
|
|
283
283
|
_, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
|
284
284
|
|
285
|
-
uri = Sass::Util.file_uri_from_path(
|
285
|
+
uri = Sass::Util.file_uri_from_path(File.absolute_path(filename_for_test(:scss)))
|
286
286
|
assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => 'css_uri')
|
287
287
|
{
|
288
288
|
"version": 3,
|
@@ -309,7 +309,7 @@ SCSS
|
|
309
309
|
|
310
310
|
_, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
|
311
311
|
|
312
|
-
uri = Sass::Util.file_uri_from_path(
|
312
|
+
uri = Sass::Util.file_uri_from_path(File.absolute_path(filename_for_test(:scss)))
|
313
313
|
assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => 'css_uri', :css_path => 'css_path')
|
314
314
|
{
|
315
315
|
"version": 3,
|
@@ -1,23 +1,23 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
body
|
4
|
-
font
|
5
|
-
background
|
4
|
+
:font Arial
|
5
|
+
:background blue
|
6
6
|
|
7
7
|
#page
|
8
|
-
width
|
9
|
-
height
|
8
|
+
:width 700px
|
9
|
+
:height 100
|
10
10
|
#header
|
11
|
-
height
|
11
|
+
:height 300px
|
12
12
|
h1
|
13
|
-
font-size
|
14
|
-
color
|
13
|
+
:font-size 50px
|
14
|
+
:color blue
|
15
15
|
|
16
16
|
#content.user.show
|
17
17
|
#container.top
|
18
18
|
#column.left
|
19
|
-
width
|
19
|
+
:width 100px
|
20
20
|
#column.right
|
21
|
-
width
|
21
|
+
:width 600px
|
22
22
|
#container.bottom
|
23
|
-
background
|
23
|
+
:background brown
|
data/test/sass/plugin_test.rb
CHANGED
@@ -21,10 +21,9 @@ class SassPluginTest < MiniTest::Test
|
|
21
21
|
@@templates = %w{
|
22
22
|
complex script parent_ref import scss_import alt
|
23
23
|
subdir/subdir subdir/nested_subdir/nested_subdir
|
24
|
-
options import_content filename_fn
|
24
|
+
options import_content filename_fn import_charset
|
25
|
+
import_charset_ibm866
|
25
26
|
}
|
26
|
-
@@templates += %w[import_charset import_charset_ibm866] unless Sass::Util.ruby1_8?
|
27
|
-
@@templates << 'import_charset_1_8' if Sass::Util.ruby1_8?
|
28
27
|
|
29
28
|
@@cache_store = Sass::CacheStores::Memory.new
|
30
29
|
|
@@ -45,7 +44,7 @@ class SassPluginTest < MiniTest::Test
|
|
45
44
|
|
46
45
|
@@templates.each do |name|
|
47
46
|
define_method("test_template_renders_correctly (#{name})") do
|
48
|
-
|
47
|
+
assert_renders_correctly(name)
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
@@ -117,7 +116,7 @@ Error: Undefined variable: "$bork".
|
|
117
116
|
on line 2 of #{template_loc('bork1')}
|
118
117
|
|
119
118
|
1: bork
|
120
|
-
2: bork
|
119
|
+
2: :bork $bork
|
121
120
|
CSS
|
122
121
|
end
|
123
122
|
File.delete(tempfile_loc('bork1'))
|
@@ -134,7 +133,7 @@ Error: Undefined variable: "$bork".
|
|
134
133
|
|
135
134
|
1: bork
|
136
135
|
2: /* foo *\\/
|
137
|
-
3: bork
|
136
|
+
3: :bork $bork
|
138
137
|
CSS
|
139
138
|
end
|
140
139
|
File.delete(tempfile_loc('bork1'))
|
@@ -396,15 +395,13 @@ WARNING
|
|
396
395
|
|
397
396
|
expected_str = File.read(result_loc(result_name, prefix))
|
398
397
|
actual_str = File.read(tempfile_loc(tempfile_name, prefix))
|
399
|
-
|
400
|
-
|
401
|
-
actual_str = actual_str.force_encoding('IBM866') if tempfile_name == 'import_charset_ibm866'
|
402
|
-
end
|
398
|
+
expected_str = expected_str.force_encoding('IBM866') if result_name == 'import_charset_ibm866'
|
399
|
+
actual_str = actual_str.force_encoding('IBM866') if tempfile_name == 'import_charset_ibm866'
|
403
400
|
expected_lines = expected_str.split("\n")
|
404
401
|
actual_lines = actual_str.split("\n")
|
405
402
|
|
406
403
|
if actual_lines.first == "/*" && expected_lines.first != "/*"
|
407
|
-
assert(false, actual_lines[0..
|
404
|
+
assert(false, actual_lines[0..actual_lines.each_with_index.find {|l, i| l == "*/"}.last].join("\n"))
|
408
405
|
end
|
409
406
|
|
410
407
|
expected_lines.zip(actual_lines).each_with_index do |pair, line|
|
@@ -423,7 +420,7 @@ WARNING
|
|
423
420
|
expected_lines = File.read(result_loc(name)).split("\n")
|
424
421
|
actual_lines = File.read(tempfile_loc(name)).split("\n")
|
425
422
|
if actual_lines.first == "/*" && expected_lines.first != "/*"
|
426
|
-
assert(false, actual_lines[0..actual_lines.
|
423
|
+
assert(false, actual_lines[0..actual_lines.each_with_index.find {|l, i| l == "*/"}.last].join("\n"))
|
427
424
|
end
|
428
425
|
end
|
429
426
|
|
@@ -343,6 +343,15 @@ RUBY
|
|
343
343
|
assert_equal '"foo#{$bar}baz"', render("'foo\#{$bar}baz'")
|
344
344
|
end
|
345
345
|
|
346
|
+
def test_bracketed_lists
|
347
|
+
assert_renders("[]")
|
348
|
+
assert_renders("[foo, bar]")
|
349
|
+
assert_renders("[[foo]]")
|
350
|
+
assert_renders("[(foo bar)]")
|
351
|
+
assert_renders("[foo bar,]")
|
352
|
+
assert_renders("[(foo,)]")
|
353
|
+
end
|
354
|
+
|
346
355
|
private
|
347
356
|
|
348
357
|
def assert_renders(script, options = {})
|
data/test/sass/script_test.rb
CHANGED
@@ -78,7 +78,7 @@ class SassScriptTest < MiniTest::Test
|
|
78
78
|
def test_color_names
|
79
79
|
assert_equal "white", resolve("white")
|
80
80
|
assert_equal "#ffffff", resolve("#ffffff")
|
81
|
-
|
81
|
+
assert_equal "#fffffe", resolve("white - #000001")
|
82
82
|
assert_equal "transparent", resolve("transparent")
|
83
83
|
assert_equal "transparent", resolve("rgba(0, 0, 0, 0)")
|
84
84
|
end
|
@@ -97,23 +97,23 @@ class SassScriptTest < MiniTest::Test
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def test_rgba_color_math
|
100
|
-
|
101
|
-
|
100
|
+
assert_equal "rgba(50, 50, 100, 0.35)", resolve("rgba(1, 1, 2, 0.35) * rgba(50, 50, 50, 0.35)")
|
101
|
+
assert_equal "rgba(52, 52, 52, 0.25)", resolve("rgba(2, 2, 2, 0.25) + rgba(50, 50, 50, 0.25)")
|
102
102
|
|
103
103
|
assert_raise_message(Sass::SyntaxError, "Alpha channels must be equal: rgba(1, 2, 3, 0.15) + rgba(50, 50, 50, 0.75)") do
|
104
|
-
|
104
|
+
resolve("rgba(1, 2, 3, 0.15) + rgba(50, 50, 50, 0.75)")
|
105
105
|
end
|
106
106
|
assert_raise_message(Sass::SyntaxError, "Alpha channels must be equal: #123456 * rgba(50, 50, 50, 0.75)") do
|
107
|
-
|
107
|
+
resolve("#123456 * rgba(50, 50, 50, 0.75)")
|
108
108
|
end
|
109
109
|
assert_raise_message(Sass::SyntaxError, "Alpha channels must be equal: rgba(50, 50, 50, 0.75) / #123456") do
|
110
|
-
|
110
|
+
resolve("rgba(50, 50, 50, 0.75) / #123456")
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
114
|
def test_rgba_number_math
|
115
|
-
|
116
|
-
|
115
|
+
assert_equal "rgba(49, 49, 49, 0.75)", resolve("rgba(50, 50, 50, 0.75) - 1")
|
116
|
+
assert_equal "rgba(100, 100, 100, 0.75)", resolve("rgba(50, 50, 50, 0.75) * 2")
|
117
117
|
end
|
118
118
|
|
119
119
|
def test_rgba_rounding
|
@@ -284,10 +284,10 @@ SASS
|
|
284
284
|
end
|
285
285
|
|
286
286
|
def test_adding_functions_directly_to_functions_module
|
287
|
-
assert !Functions.callable?('
|
288
|
-
Functions.class_eval { def
|
289
|
-
assert Functions.callable?('
|
290
|
-
Functions.send :remove_method, :
|
287
|
+
assert !Functions.callable?('nonexistent')
|
288
|
+
Functions.class_eval { def nonexistent; end }
|
289
|
+
assert Functions.callable?('nonexistent')
|
290
|
+
Functions.send :remove_method, :nonexistent
|
291
291
|
end
|
292
292
|
|
293
293
|
def test_default_functions
|
@@ -504,7 +504,7 @@ SASS
|
|
504
504
|
|
505
505
|
def test_functions
|
506
506
|
assert_equal "#80ff80", resolve("hsl(120, 100%, 75%)")
|
507
|
-
|
507
|
+
assert_equal "#81ff81", resolve("hsl(120, 100%, 75%) + #010001")
|
508
508
|
end
|
509
509
|
|
510
510
|
def test_operator_unit_conversion
|
@@ -518,19 +518,17 @@ SASS
|
|
518
518
|
assert_equal "true", resolve("2mm == 8q")
|
519
519
|
assert_equal "false", resolve("2px > 3q")
|
520
520
|
|
521
|
-
|
522
|
-
assert_warning(<<WARNING) {assert_equal "true", resolve("1 == 1cm")}
|
521
|
+
assert_warning(<<WARNING) {assert_equal "true", resolve("1 == 1cm")}
|
523
522
|
DEPRECATION WARNING on line 1 of test_operator_unit_conversion_inline.sass:
|
524
523
|
The result of `1 == 1cm` will be `false` in future releases of Sass.
|
525
524
|
Unitless numbers will no longer be equal to the same numbers with units.
|
526
525
|
WARNING
|
527
526
|
|
528
|
-
|
527
|
+
assert_warning(<<WARNING) {assert_equal "false", resolve("1 != 1cm")}
|
529
528
|
DEPRECATION WARNING on line 1 of test_operator_unit_conversion_inline.sass:
|
530
529
|
The result of `1 != 1cm` will be `true` in future releases of Sass.
|
531
530
|
Unitless numbers will no longer be equal to the same numbers with units.
|
532
531
|
WARNING
|
533
|
-
end
|
534
532
|
end
|
535
533
|
|
536
534
|
def test_length_units
|
@@ -560,9 +558,9 @@ WARNING
|
|
560
558
|
end
|
561
559
|
|
562
560
|
def test_resolution_units
|
563
|
-
assert_equal "
|
564
|
-
assert_equal "
|
565
|
-
assert_equal "
|
561
|
+
assert_equal "2.54", resolve("(1dpi/1dpcm)")
|
562
|
+
assert_equal "37.79528", resolve("(1dpcm/1dppx)")
|
563
|
+
assert_equal "0.01042", resolve("(1dppx/1dpi)")
|
566
564
|
end
|
567
565
|
|
568
566
|
def test_operations_have_options
|
@@ -990,7 +988,7 @@ SCSS
|
|
990
988
|
end
|
991
989
|
|
992
990
|
def test_color_format_isnt_preserved_when_modified
|
993
|
-
assert_equal "magenta", resolve("
|
991
|
+
assert_equal "magenta", resolve("#f00 + #00f")
|
994
992
|
end
|
995
993
|
|
996
994
|
def test_ids
|
@@ -1134,9 +1132,8 @@ SASS
|
|
1134
1132
|
assert_equal "#2", resolve('"##{1 + 1}"')
|
1135
1133
|
end
|
1136
1134
|
|
1137
|
-
def
|
1138
|
-
|
1139
|
-
'Invalid CSS after "foo(bar, ": expected function argument, was ")"') {eval('foo(bar, )')}
|
1135
|
+
def test_func_call_arglist_trailing_comma
|
1136
|
+
assert_equal eval('foo(bar)'), eval('foo(bar, )')
|
1140
1137
|
end
|
1141
1138
|
|
1142
1139
|
def test_color_prefixed_identifier
|
@@ -1309,37 +1306,32 @@ SASS
|
|
1309
1306
|
end
|
1310
1307
|
|
1311
1308
|
def test_active_lazy_interpolation_deprecation_warning
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
assert_equal "-1 2 3", resolve_with_lazy_interp_warning('quote((-#{1} 2 3))', '"-1 #{2 3}"')
|
1321
|
-
end
|
1309
|
+
assert_equal "1, 2, 3", resolve_with_lazy_interp_warning('quote((1, #{2}, 3))', '"1, 2, 3"')
|
1310
|
+
assert_equal "1", resolve_with_lazy_interp_warning('length((1, #{2}, 3))', '"1, 2, 3"')
|
1311
|
+
assert_equal "1, 2, 3", resolve_with_lazy_interp_warning('inspect((1, #{2}, 3))', '"1, 2, 3"')
|
1312
|
+
assert_equal "string", resolve_with_lazy_interp_warning('type-of((1, #{2}, 3))', '"1, 2, 3"')
|
1313
|
+
|
1314
|
+
assert_equal "+1 2 3", resolve_with_lazy_interp_warning('quote((+#{1} 2 3))', '"+1 #{2 3}"')
|
1315
|
+
assert_equal "/1 2 3", resolve_with_lazy_interp_warning('quote((/#{1} 2 3))', '"/1 #{2 3}"')
|
1316
|
+
assert_equal "-1 2 3", resolve_with_lazy_interp_warning('quote((-#{1} 2 3))', '"-1 #{2 3}"')
|
1322
1317
|
end
|
1323
1318
|
|
1324
1319
|
def test_comparison_of_complex_units
|
1325
1320
|
# Tests for issue #1960
|
1326
|
-
|
1327
|
-
assert_warning(<<WARNING) do
|
1321
|
+
assert_warning(<<WARNING) do
|
1328
1322
|
DEPRECATION WARNING on line 1 of test_comparison_of_complex_units_inline.sass:
|
1329
1323
|
The result of `10 == 10px` will be `false` in future releases of Sass.
|
1330
1324
|
Unitless numbers will no longer be equal to the same numbers with units.
|
1331
1325
|
WARNING
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1326
|
+
assert_equal "true", resolve("10 == 2 * 5px")
|
1327
|
+
end
|
1328
|
+
assert_warning(<<WARNING) do
|
1335
1329
|
DEPRECATION WARNING on line 1 of test_comparison_of_complex_units_inline.sass:
|
1336
1330
|
The result of `10 == 10px*px` will be `false` in future releases of Sass.
|
1337
1331
|
Unitless numbers will no longer be equal to the same numbers with units.
|
1338
1332
|
WARNING
|
1339
|
-
|
1340
|
-
end
|
1333
|
+
assert_equal "true", resolve("10 == 2px * 5px")
|
1341
1334
|
end
|
1342
|
-
|
1343
1335
|
assert_equal "true", resolve("10px * 1px == 2px * 5px")
|
1344
1336
|
assert_equal "true", resolve("5px * 1px < 2px * 5px")
|
1345
1337
|
end
|
@@ -1349,9 +1341,8 @@ WARNING
|
|
1349
1341
|
def resolve_with_lazy_interp_warning(str, contents = nil, environment = env)
|
1350
1342
|
contents ||= "\"#{str}\""
|
1351
1343
|
result = assert_warning(<<WARNING) {resolve(str, {}, environment)}
|
1352
|
-
DEPRECATION WARNING on line 1 of #{filename_for_test}:
|
1353
|
-
|
1354
|
-
To preserve the current behavior, use quotes:
|
1344
|
+
DEPRECATION WARNING on line 1 of #{filename_for_test}: \#{} interpolation near operators will be simplified
|
1345
|
+
in a future version of Sass. To preserve the current behavior, use quotes:
|
1355
1346
|
|
1356
1347
|
unquote(#{contents})
|
1357
1348
|
WARNING
|
@@ -1362,9 +1353,8 @@ WARNING
|
|
1362
1353
|
def resolve_with_interp_warning(str, contents = nil, environment = env)
|
1363
1354
|
contents ||= "\"#{str}\""
|
1364
1355
|
assert_warning(<<WARNING) {resolve(str, {}, environment)}
|
1365
|
-
DEPRECATION WARNING on line 1 of #{filename_for_test}:
|
1366
|
-
|
1367
|
-
To preserve the current behavior, use quotes:
|
1356
|
+
DEPRECATION WARNING on line 1 of #{filename_for_test}: \#{} interpolation near operators will be simplified
|
1357
|
+
in a future version of Sass. To preserve the current behavior, use quotes:
|
1368
1358
|
|
1369
1359
|
unquote(#{contents})
|
1370
1360
|
|