haml 3.0.21 → 3.0.22
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/Rakefile +1 -41
- data/VERSION +1 -1
- data/lib/haml/precompiler.rb +8 -6
- data/lib/haml/template/plugin.rb +16 -6
- data/lib/sass/less.rb +31 -12
- data/lib/sass/script/funcall.rb +2 -1
- data/lib/sass/script/operation.rb +10 -5
- data/lib/sass/script/parser.rb +9 -0
- data/test/haml/engine_test.rb +25 -0
- data/test/sass/less_conversion_test.rb +24 -3
- data/test/sass/script_conversion_test.rb +60 -0
- metadata +243 -426
- data/vendor/sass/CONTRIBUTING +0 -3
- data/vendor/sass/MIT-LICENSE +0 -20
- data/vendor/sass/README.md +0 -201
- data/vendor/sass/Rakefile +0 -363
- data/vendor/sass/TODO +0 -39
- data/vendor/sass/VERSION +0 -1
- data/vendor/sass/VERSION_NAME +0 -1
- data/vendor/sass/bin/css2sass +0 -13
- data/vendor/sass/bin/sass +0 -8
- data/vendor/sass/bin/sass-convert +0 -7
- data/vendor/sass/doc-src/FAQ.md +0 -35
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -1870
- data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1713
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
- data/vendor/sass/ext/extconf.rb +0 -10
- data/vendor/sass/extra/update_watch.rb +0 -13
- data/vendor/sass/init.rb +0 -18
- data/vendor/sass/lib/sass.rb +0 -71
- data/vendor/sass/lib/sass/cache_store.rb +0 -208
- data/vendor/sass/lib/sass/callbacks.rb +0 -66
- data/vendor/sass/lib/sass/css.rb +0 -294
- data/vendor/sass/lib/sass/engine.rb +0 -792
- data/vendor/sass/lib/sass/environment.rb +0 -143
- data/vendor/sass/lib/sass/error.rb +0 -201
- data/vendor/sass/lib/sass/exec.rb +0 -619
- data/vendor/sass/lib/sass/importers.rb +0 -22
- data/vendor/sass/lib/sass/importers/base.rb +0 -138
- data/vendor/sass/lib/sass/importers/filesystem.rb +0 -121
- data/vendor/sass/lib/sass/less.rb +0 -363
- data/vendor/sass/lib/sass/plugin.rb +0 -126
- data/vendor/sass/lib/sass/plugin/compiler.rb +0 -346
- data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
- data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
- data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
- data/vendor/sass/lib/sass/plugin/rack.rb +0 -47
- data/vendor/sass/lib/sass/plugin/rails.rb +0 -41
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -145
- data/vendor/sass/lib/sass/railtie.rb +0 -8
- data/vendor/sass/lib/sass/repl.rb +0 -58
- data/vendor/sass/lib/sass/root.rb +0 -7
- data/vendor/sass/lib/sass/script.rb +0 -63
- data/vendor/sass/lib/sass/script/bool.rb +0 -18
- data/vendor/sass/lib/sass/script/color.rb +0 -491
- data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
- data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
- data/vendor/sass/lib/sass/script/funcall.rb +0 -79
- data/vendor/sass/lib/sass/script/functions.rb +0 -852
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -70
- data/vendor/sass/lib/sass/script/lexer.rb +0 -337
- data/vendor/sass/lib/sass/script/literal.rb +0 -236
- data/vendor/sass/lib/sass/script/node.rb +0 -101
- data/vendor/sass/lib/sass/script/number.rb +0 -423
- data/vendor/sass/lib/sass/script/operation.rb +0 -92
- data/vendor/sass/lib/sass/script/parser.rb +0 -392
- data/vendor/sass/lib/sass/script/string.rb +0 -67
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -93
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -57
- data/vendor/sass/lib/sass/script/variable.rb +0 -48
- data/vendor/sass/lib/sass/scss.rb +0 -17
- data/vendor/sass/lib/sass/scss/css_parser.rb +0 -51
- data/vendor/sass/lib/sass/scss/parser.rb +0 -838
- data/vendor/sass/lib/sass/scss/rx.rb +0 -126
- data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
- data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
- data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
- data/vendor/sass/lib/sass/selector.rb +0 -361
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -82
- data/vendor/sass/lib/sass/selector/sequence.rb +0 -236
- data/vendor/sass/lib/sass/selector/simple.rb +0 -113
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -135
- data/vendor/sass/lib/sass/shared.rb +0 -78
- data/vendor/sass/lib/sass/tree/comment_node.rb +0 -128
- data/vendor/sass/lib/sass/tree/debug_node.rb +0 -36
- data/vendor/sass/lib/sass/tree/directive_node.rb +0 -75
- data/vendor/sass/lib/sass/tree/extend_node.rb +0 -65
- data/vendor/sass/lib/sass/tree/for_node.rb +0 -67
- data/vendor/sass/lib/sass/tree/if_node.rb +0 -81
- data/vendor/sass/lib/sass/tree/import_node.rb +0 -124
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -60
- data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -123
- data/vendor/sass/lib/sass/tree/node.rb +0 -490
- data/vendor/sass/lib/sass/tree/prop_node.rb +0 -220
- data/vendor/sass/lib/sass/tree/root_node.rb +0 -125
- data/vendor/sass/lib/sass/tree/rule_node.rb +0 -273
- data/vendor/sass/lib/sass/tree/variable_node.rb +0 -39
- data/vendor/sass/lib/sass/tree/warn_node.rb +0 -42
- data/vendor/sass/lib/sass/tree/while_node.rb +0 -48
- data/vendor/sass/lib/sass/util.rb +0 -700
- data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
- data/vendor/sass/lib/sass/version.rb +0 -109
- data/vendor/sass/rails/init.rb +0 -1
- data/vendor/sass/sass.gemspec +0 -32
- data/vendor/sass/test/sass/cache_test.rb +0 -74
- data/vendor/sass/test/sass/callbacks_test.rb +0 -61
- data/vendor/sass/test/sass/conversion_test.rb +0 -1210
- data/vendor/sass/test/sass/css2sass_test.rb +0 -364
- data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
- data/vendor/sass/test/sass/engine_test.rb +0 -2283
- data/vendor/sass/test/sass/extend_test.rb +0 -1348
- data/vendor/sass/test/sass/functions_test.rb +0 -565
- data/vendor/sass/test/sass/importer_test.rb +0 -104
- data/vendor/sass/test/sass/less_conversion_test.rb +0 -632
- data/vendor/sass/test/sass/mock_importer.rb +0 -49
- data/vendor/sass/test/sass/more_results/more1.css +0 -9
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/vendor/sass/test/sass/more_results/more_import.css +0 -29
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
- data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
- data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
- data/vendor/sass/test/sass/plugin_test.rb +0 -430
- data/vendor/sass/test/sass/results/alt.css +0 -4
- data/vendor/sass/test/sass/results/basic.css +0 -9
- data/vendor/sass/test/sass/results/compact.css +0 -5
- data/vendor/sass/test/sass/results/complex.css +0 -86
- data/vendor/sass/test/sass/results/compressed.css +0 -1
- data/vendor/sass/test/sass/results/expanded.css +0 -19
- data/vendor/sass/test/sass/results/import.css +0 -31
- data/vendor/sass/test/sass/results/line_numbers.css +0 -49
- data/vendor/sass/test/sass/results/mixins.css +0 -95
- data/vendor/sass/test/sass/results/multiline.css +0 -24
- data/vendor/sass/test/sass/results/nested.css +0 -22
- data/vendor/sass/test/sass/results/options.css +0 -1
- data/vendor/sass/test/sass/results/parent_ref.css +0 -13
- data/vendor/sass/test/sass/results/script.css +0 -16
- data/vendor/sass/test/sass/results/scss_import.css +0 -31
- data/vendor/sass/test/sass/results/scss_importee.css +0 -2
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
- data/vendor/sass/test/sass/results/units.css +0 -11
- data/vendor/sass/test/sass/results/warn.css +0 -0
- data/vendor/sass/test/sass/results/warn_imported.css +0 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -254
- data/vendor/sass/test/sass/script_test.rb +0 -470
- data/vendor/sass/test/sass/scss/css_test.rb +0 -897
- data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
- data/vendor/sass/test/sass/scss/scss_test.rb +0 -1088
- data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
- data/vendor/sass/test/sass/templates/_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/alt.sass +0 -16
- data/vendor/sass/test/sass/templates/basic.sass +0 -23
- data/vendor/sass/test/sass/templates/bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/compact.sass +0 -17
- data/vendor/sass/test/sass/templates/complex.sass +0 -305
- data/vendor/sass/test/sass/templates/compressed.sass +0 -15
- data/vendor/sass/test/sass/templates/expanded.sass +0 -17
- data/vendor/sass/test/sass/templates/import.sass +0 -12
- data/vendor/sass/test/sass/templates/importee.less +0 -2
- data/vendor/sass/test/sass/templates/importee.sass +0 -19
- data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
- data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
- data/vendor/sass/test/sass/templates/mixins.sass +0 -76
- data/vendor/sass/test/sass/templates/multiline.sass +0 -20
- data/vendor/sass/test/sass/templates/nested.sass +0 -25
- data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/vendor/sass/test/sass/templates/options.sass +0 -2
- data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
- data/vendor/sass/test/sass/templates/script.sass +0 -101
- data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
- data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
- data/vendor/sass/test/sass/templates/units.sass +0 -11
- data/vendor/sass/test/sass/templates/warn.sass +0 -3
- data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
- data/vendor/sass/test/sass/test_helper.rb +0 -8
- data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
- data/vendor/sass/test/sass/util_test.rb +0 -275
- data/vendor/sass/test/test_helper.rb +0 -64
- data/vendor/sass/yard/callbacks.rb +0 -29
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
- data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
- data/vendor/sass/yard/inherited_hash.rb +0 -41
@@ -1,156 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
4
|
-
require 'sass/engine'
|
5
|
-
|
6
|
-
class ScssRxTest < Test::Unit::TestCase
|
7
|
-
include Sass::SCSS::RX
|
8
|
-
|
9
|
-
def test_identifiers
|
10
|
-
assert_match IDENT, "foo"
|
11
|
-
assert_match IDENT, "\xC3\xBFoo" # Initial char can be nonascii
|
12
|
-
assert_match IDENT, "\\123abcoo" # Initial char can be unicode escape
|
13
|
-
assert_match IDENT, "\\f oo" # Unicode escapes can be followed by whitespace
|
14
|
-
assert_match IDENT, "\\fa\too"
|
15
|
-
assert_match IDENT, "\\ff2\roo"
|
16
|
-
assert_match IDENT, "\\f13a\foo"
|
17
|
-
assert_match IDENT, "\\f13abcoo"
|
18
|
-
assert_match IDENT, "\\ oo" # Initial char can be a plain escape as well
|
19
|
-
assert_match IDENT, "\\~oo"
|
20
|
-
assert_match IDENT, "\\\\oo"
|
21
|
-
assert_match IDENT, "\\{oo"
|
22
|
-
assert_match IDENT, "\\\xC3\xBFoo"
|
23
|
-
assert_match IDENT, "-foo" # Can put a - before anything
|
24
|
-
assert_match IDENT, "-\xC3\xBFoo"
|
25
|
-
assert_match IDENT, "-\\f oo"
|
26
|
-
assert_match IDENT, "_foo" # Can put a _ before anything
|
27
|
-
assert_match IDENT, "_\xC3\xBFoo"
|
28
|
-
assert_match IDENT, "_\\f oo"
|
29
|
-
|
30
|
-
assert_match IDENT, "foo-bar"
|
31
|
-
assert_match IDENT, "f012-23"
|
32
|
-
assert_match IDENT, "foo_-_bar"
|
33
|
-
assert_match IDENT, "f012_23"
|
34
|
-
|
35
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/escapes-003.xht
|
36
|
-
assert_match IDENT, "c\\lass"
|
37
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/escapes-004.xht
|
38
|
-
assert_match IDENT, "c\\00006Cas\\000073"
|
39
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-001.xht
|
40
|
-
assert_match IDENT, "IdE6n-3t0_6"
|
41
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-006.xht
|
42
|
-
assert_match IDENT, "\\6000ident"
|
43
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-007.xht
|
44
|
-
assert_match IDENT, "iden\\6000t\\6000"
|
45
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/ident-013.xht
|
46
|
-
assert_match IDENT, "\\-ident"
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_underscores_in_identifiers
|
50
|
-
assert_match IDENT, "foo_bar"
|
51
|
-
assert_match IDENT, "_\xC3\xBFfoo"
|
52
|
-
assert_match IDENT, "__foo"
|
53
|
-
assert_match IDENT, "_1foo"
|
54
|
-
assert_match IDENT, "-_foo"
|
55
|
-
assert_match IDENT, "_-foo"
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_invalid_identifiers
|
59
|
-
assert_no_match IDENT, ""
|
60
|
-
assert_no_match IDENT, "1foo"
|
61
|
-
assert_no_match IDENT, "-1foo"
|
62
|
-
assert_no_match IDENT, "--foo"
|
63
|
-
assert_no_match IDENT, "foo bar"
|
64
|
-
assert_no_match IDENT, "foo~bar"
|
65
|
-
|
66
|
-
# http://www.w3.org/Style/CSS/Test/CSS2.1/current/xhtml1/escapes-008.xht
|
67
|
-
assert_no_match IDENT, "c\\06C ass"
|
68
|
-
assert_no_match IDENT, "back\\67\n round"
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_double_quote_strings
|
72
|
-
assert_match STRING, '"foo bar"'
|
73
|
-
assert_match STRING, '"foo\\\nbar"'
|
74
|
-
assert_match STRING, "\"\\\"\""
|
75
|
-
assert_match STRING, '"\t !#$%&(-~()*+,-./0123456789~"'
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_single_quote_strings
|
79
|
-
assert_match STRING, "'foo bar'"
|
80
|
-
assert_match STRING, "'foo\\\nbar'"
|
81
|
-
assert_match STRING, "'\\''"
|
82
|
-
assert_match STRING, "'\t !#\$%&(-~()*+,-./0123456789~'"
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_invalid_strings
|
86
|
-
assert_no_match STRING, "\"foo\nbar\""
|
87
|
-
assert_no_match STRING, "\"foo\"bar\""
|
88
|
-
assert_no_match STRING, "'foo\nbar'"
|
89
|
-
assert_no_match STRING, "'foo'bar'"
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_uri
|
93
|
-
assert_match URI, 'url("foo bar)")'
|
94
|
-
assert_match URI, "url('foo bar)')"
|
95
|
-
assert_match URI, 'url( "foo bar)" )'
|
96
|
-
assert_match URI, "url(#\\%&**+,-./0123456789~)"
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_invalid_uri
|
100
|
-
assert_no_match URI, 'url(foo)bar)'
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_unicode_range
|
104
|
-
assert_match UNICODERANGE, 'U+00-Ff'
|
105
|
-
assert_match UNICODERANGE, 'u+980-9FF'
|
106
|
-
assert_match UNICODERANGE, 'U+9aF??'
|
107
|
-
assert_match UNICODERANGE, 'U+??'
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_escape_empty_ident
|
111
|
-
assert_equal "", Sass::SCSS::RX.escape_ident("")
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_escape_just_prefix_ident
|
115
|
-
assert_equal "\\-", Sass::SCSS::RX.escape_ident("-")
|
116
|
-
assert_equal "\\_", Sass::SCSS::RX.escape_ident("_")
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_escape_plain_ident
|
120
|
-
assert_equal "foo", Sass::SCSS::RX.escape_ident("foo")
|
121
|
-
assert_equal "foo-1bar", Sass::SCSS::RX.escape_ident("foo-1bar")
|
122
|
-
assert_equal "-foo-bar", Sass::SCSS::RX.escape_ident("-foo-bar")
|
123
|
-
assert_equal "f2oo_bar", Sass::SCSS::RX.escape_ident("f2oo_bar")
|
124
|
-
assert_equal "_foo_bar", Sass::SCSS::RX.escape_ident("_foo_bar")
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_escape_initial_funky_ident
|
128
|
-
assert_equal "\\000035foo", Sass::SCSS::RX.escape_ident("5foo")
|
129
|
-
assert_equal "-\\000035foo", Sass::SCSS::RX.escape_ident("-5foo")
|
130
|
-
assert_equal "_\\000035foo", Sass::SCSS::RX.escape_ident("_5foo")
|
131
|
-
|
132
|
-
assert_equal "\\&foo", Sass::SCSS::RX.escape_ident("&foo")
|
133
|
-
assert_equal "-\\&foo", Sass::SCSS::RX.escape_ident("-&foo")
|
134
|
-
|
135
|
-
assert_equal "-\\ foo", Sass::SCSS::RX.escape_ident("- foo")
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_escape_mid_funky_ident
|
139
|
-
assert_equal "foo\\&bar", Sass::SCSS::RX.escape_ident("foo&bar")
|
140
|
-
assert_equal "foo\\ \\ bar", Sass::SCSS::RX.escape_ident("foo bar")
|
141
|
-
assert_equal "foo\\00007fbar", Sass::SCSS::RX.escape_ident("foo\177bar")
|
142
|
-
end
|
143
|
-
|
144
|
-
private
|
145
|
-
|
146
|
-
def assert_match(rx, str)
|
147
|
-
assert_not_nil(match = rx.match(str))
|
148
|
-
assert_equal str.size, match[0].size
|
149
|
-
end
|
150
|
-
|
151
|
-
def assert_no_match(rx, str)
|
152
|
-
match = rx.match(str)
|
153
|
-
assert_not_equal str.size, match && match[0].size
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
@@ -1,1088 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
require File.dirname(__FILE__) + '/test_helper'
|
4
|
-
|
5
|
-
class ScssTest < Test::Unit::TestCase
|
6
|
-
include ScssTestHelper
|
7
|
-
|
8
|
-
## One-Line Comments
|
9
|
-
|
10
|
-
def test_one_line_comments
|
11
|
-
assert_equal <<CSS, render(<<SCSS)
|
12
|
-
.foo {
|
13
|
-
baz: bang; }
|
14
|
-
CSS
|
15
|
-
.foo {// bar: baz;}
|
16
|
-
baz: bang; //}
|
17
|
-
}
|
18
|
-
SCSS
|
19
|
-
assert_equal <<CSS, render(<<SCSS)
|
20
|
-
.foo bar[val="//"] {
|
21
|
-
baz: bang; }
|
22
|
-
CSS
|
23
|
-
.foo bar[val="//"] {
|
24
|
-
baz: bang; //}
|
25
|
-
}
|
26
|
-
SCSS
|
27
|
-
end
|
28
|
-
|
29
|
-
## Script
|
30
|
-
|
31
|
-
def test_variables
|
32
|
-
assert_equal <<CSS, render(<<SCSS)
|
33
|
-
blat {
|
34
|
-
a: foo; }
|
35
|
-
CSS
|
36
|
-
$var: foo;
|
37
|
-
|
38
|
-
blat {a: $var}
|
39
|
-
SCSS
|
40
|
-
|
41
|
-
assert_equal <<CSS, render(<<SCSS)
|
42
|
-
foo {
|
43
|
-
a: 2;
|
44
|
-
b: 6; }
|
45
|
-
CSS
|
46
|
-
foo {
|
47
|
-
$var: 2;
|
48
|
-
$another-var: 4;
|
49
|
-
a: $var;
|
50
|
-
b: $var + $another-var;}
|
51
|
-
SCSS
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_unicode_variables
|
55
|
-
assert_equal <<CSS, render(<<SCSS)
|
56
|
-
blat {
|
57
|
-
a: foo; }
|
58
|
-
CSS
|
59
|
-
$vär: foo;
|
60
|
-
|
61
|
-
blat {a: $vär}
|
62
|
-
SCSS
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_guard_assign
|
66
|
-
assert_equal <<CSS, render(<<SCSS)
|
67
|
-
foo {
|
68
|
-
a: 1; }
|
69
|
-
CSS
|
70
|
-
$var: 1;
|
71
|
-
$var: 2 !default;
|
72
|
-
|
73
|
-
foo {a: $var}
|
74
|
-
SCSS
|
75
|
-
|
76
|
-
assert_equal <<CSS, render(<<SCSS)
|
77
|
-
foo {
|
78
|
-
a: 2; }
|
79
|
-
CSS
|
80
|
-
$var: 2 !default;
|
81
|
-
|
82
|
-
foo {a: $var}
|
83
|
-
SCSS
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_sass_script
|
87
|
-
assert_equal <<CSS, render(<<SCSS)
|
88
|
-
foo {
|
89
|
-
a: 3;
|
90
|
-
b: -1;
|
91
|
-
c: foobar;
|
92
|
-
d: 12px; }
|
93
|
-
CSS
|
94
|
-
foo {
|
95
|
-
a: 1 + 2;
|
96
|
-
b: 1 - 2;
|
97
|
-
c: foo + bar;
|
98
|
-
d: floor(12.3px); }
|
99
|
-
SCSS
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_debug_directive
|
103
|
-
assert_warning "test_debug_directive_inline.scss:2 DEBUG: hello world!" do
|
104
|
-
assert_equal <<CSS, render(<<SCSS)
|
105
|
-
foo {
|
106
|
-
a: b; }
|
107
|
-
|
108
|
-
bar {
|
109
|
-
c: d; }
|
110
|
-
CSS
|
111
|
-
foo {a: b}
|
112
|
-
@debug "hello world!";
|
113
|
-
bar {c: d}
|
114
|
-
SCSS
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_warn_directive
|
119
|
-
expected_warning = <<EXPECTATION
|
120
|
-
WARNING: this is a warning
|
121
|
-
on line 2 of test_warn_directive_inline.scss
|
122
|
-
|
123
|
-
WARNING: this is a mixin
|
124
|
-
on line 1 of test_warn_directive_inline.scss, in `foo'
|
125
|
-
from line 3 of test_warn_directive_inline.scss
|
126
|
-
EXPECTATION
|
127
|
-
assert_warning expected_warning do
|
128
|
-
assert_equal <<CSS, render(<<SCSS)
|
129
|
-
bar {
|
130
|
-
c: d; }
|
131
|
-
CSS
|
132
|
-
@mixin foo { @warn "this is a mixin";}
|
133
|
-
@warn "this is a warning";
|
134
|
-
bar {c: d; @include foo;}
|
135
|
-
SCSS
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_for_directive
|
140
|
-
assert_equal <<CSS, render(<<SCSS)
|
141
|
-
.foo {
|
142
|
-
a: 1;
|
143
|
-
a: 2;
|
144
|
-
a: 3;
|
145
|
-
a: 4; }
|
146
|
-
CSS
|
147
|
-
.foo {
|
148
|
-
@for $var from 1 to 5 {a: $var;}
|
149
|
-
}
|
150
|
-
SCSS
|
151
|
-
|
152
|
-
assert_equal <<CSS, render(<<SCSS)
|
153
|
-
.foo {
|
154
|
-
a: 1;
|
155
|
-
a: 2;
|
156
|
-
a: 3;
|
157
|
-
a: 4;
|
158
|
-
a: 5; }
|
159
|
-
CSS
|
160
|
-
.foo {
|
161
|
-
@for $var from 1 through 5 {a: $var;}
|
162
|
-
}
|
163
|
-
SCSS
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_if_directive
|
167
|
-
assert_equal <<CSS, render(<<SCSS)
|
168
|
-
foo {
|
169
|
-
a: b; }
|
170
|
-
CSS
|
171
|
-
@if "foo" == "foo" {foo {a: b}}
|
172
|
-
@if "foo" != "foo" {bar {a: b}}
|
173
|
-
SCSS
|
174
|
-
|
175
|
-
assert_equal <<CSS, render(<<SCSS)
|
176
|
-
bar {
|
177
|
-
a: b; }
|
178
|
-
CSS
|
179
|
-
@if "foo" != "foo" {foo {a: b}}
|
180
|
-
@else if "foo" == "foo" {bar {a: b}}
|
181
|
-
@else if true {baz {a: b}}
|
182
|
-
SCSS
|
183
|
-
|
184
|
-
assert_equal <<CSS, render(<<SCSS)
|
185
|
-
bar {
|
186
|
-
a: b; }
|
187
|
-
CSS
|
188
|
-
@if "foo" != "foo" {foo {a: b}}
|
189
|
-
@else {bar {a: b}}
|
190
|
-
SCSS
|
191
|
-
end
|
192
|
-
|
193
|
-
def test_comment_after_if_directive
|
194
|
-
assert_equal <<CSS, render(<<SCSS)
|
195
|
-
foo {
|
196
|
-
a: b;
|
197
|
-
/* This is a comment */
|
198
|
-
c: d; }
|
199
|
-
CSS
|
200
|
-
foo {
|
201
|
-
@if true {a: b}
|
202
|
-
/* This is a comment */
|
203
|
-
c: d }
|
204
|
-
SCSS
|
205
|
-
assert_equal <<CSS, render(<<SCSS)
|
206
|
-
foo {
|
207
|
-
a: b;
|
208
|
-
/* This is a comment */
|
209
|
-
c: d; }
|
210
|
-
CSS
|
211
|
-
foo {
|
212
|
-
@if true {a: b}
|
213
|
-
@else {x: y}
|
214
|
-
/* This is a comment */
|
215
|
-
c: d }
|
216
|
-
SCSS
|
217
|
-
end
|
218
|
-
|
219
|
-
def test_while_directive
|
220
|
-
assert_equal <<CSS, render(<<SCSS)
|
221
|
-
.foo {
|
222
|
-
a: 1;
|
223
|
-
a: 2;
|
224
|
-
a: 3;
|
225
|
-
a: 4; }
|
226
|
-
CSS
|
227
|
-
$i: 1;
|
228
|
-
|
229
|
-
.foo {
|
230
|
-
@while $i != 5 {
|
231
|
-
a: $i;
|
232
|
-
$i: $i + 1;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
SCSS
|
236
|
-
end
|
237
|
-
|
238
|
-
def test_css_import_directive
|
239
|
-
assert_equal "@import url(foo.css);\n", render('@import "foo.css";')
|
240
|
-
assert_equal "@import url(foo.css);\n", render("@import 'foo.css';")
|
241
|
-
assert_equal "@import url(\"foo.css\");\n", render('@import url("foo.css");')
|
242
|
-
assert_equal "@import url('foo.css');\n", render("@import url('foo.css');")
|
243
|
-
assert_equal "@import url(foo.css);\n", render('@import url(foo.css);')
|
244
|
-
end
|
245
|
-
|
246
|
-
def test_media_import
|
247
|
-
assert_equal("@import \"./fonts.sass\" all;\n", render("@import \"./fonts.sass\" all;"))
|
248
|
-
end
|
249
|
-
|
250
|
-
def test_http_import
|
251
|
-
assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
|
252
|
-
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";"))
|
253
|
-
end
|
254
|
-
|
255
|
-
def test_url_import
|
256
|
-
assert_equal("@import url(fonts.sass);\n", render("@import url(fonts.sass);"))
|
257
|
-
end
|
258
|
-
|
259
|
-
def test_block_comment_in_script
|
260
|
-
assert_equal <<CSS, render(<<SCSS)
|
261
|
-
foo {
|
262
|
-
a: 1bar; }
|
263
|
-
CSS
|
264
|
-
foo {a: 1 + /* flang */ bar}
|
265
|
-
SCSS
|
266
|
-
end
|
267
|
-
|
268
|
-
def test_line_comment_in_script
|
269
|
-
assert_equal <<CSS, render(<<SCSS)
|
270
|
-
foo {
|
271
|
-
a: 1blang; }
|
272
|
-
CSS
|
273
|
-
foo {a: 1 + // flang }
|
274
|
-
blang }
|
275
|
-
SCSS
|
276
|
-
end
|
277
|
-
|
278
|
-
## Nested Rules
|
279
|
-
|
280
|
-
def test_nested_rules
|
281
|
-
assert_equal <<CSS, render(<<SCSS)
|
282
|
-
foo bar {
|
283
|
-
a: b; }
|
284
|
-
CSS
|
285
|
-
foo {bar {a: b}}
|
286
|
-
SCSS
|
287
|
-
assert_equal <<CSS, render(<<SCSS)
|
288
|
-
foo bar {
|
289
|
-
a: b; }
|
290
|
-
foo baz {
|
291
|
-
b: c; }
|
292
|
-
CSS
|
293
|
-
foo {
|
294
|
-
bar {a: b}
|
295
|
-
baz {b: c}}
|
296
|
-
SCSS
|
297
|
-
assert_equal <<CSS, render(<<SCSS)
|
298
|
-
foo bar baz {
|
299
|
-
a: b; }
|
300
|
-
foo bang bip {
|
301
|
-
a: b; }
|
302
|
-
CSS
|
303
|
-
foo {
|
304
|
-
bar {baz {a: b}}
|
305
|
-
bang {bip {a: b}}}
|
306
|
-
SCSS
|
307
|
-
end
|
308
|
-
|
309
|
-
def test_nested_rules_with_declarations
|
310
|
-
assert_equal <<CSS, render(<<SCSS)
|
311
|
-
foo {
|
312
|
-
a: b; }
|
313
|
-
foo bar {
|
314
|
-
c: d; }
|
315
|
-
CSS
|
316
|
-
foo {
|
317
|
-
a: b;
|
318
|
-
bar {c: d}}
|
319
|
-
SCSS
|
320
|
-
assert_equal <<CSS, render(<<SCSS)
|
321
|
-
foo {
|
322
|
-
a: b; }
|
323
|
-
foo bar {
|
324
|
-
c: d; }
|
325
|
-
CSS
|
326
|
-
foo {
|
327
|
-
bar {c: d}
|
328
|
-
a: b}
|
329
|
-
SCSS
|
330
|
-
assert_equal <<CSS, render(<<SCSS)
|
331
|
-
foo {
|
332
|
-
ump: nump;
|
333
|
-
grump: clump; }
|
334
|
-
foo bar {
|
335
|
-
blat: bang;
|
336
|
-
habit: rabbit; }
|
337
|
-
foo bar baz {
|
338
|
-
a: b; }
|
339
|
-
foo bar bip {
|
340
|
-
c: d; }
|
341
|
-
foo bibble bap {
|
342
|
-
e: f; }
|
343
|
-
CSS
|
344
|
-
foo {
|
345
|
-
ump: nump;
|
346
|
-
grump: clump;
|
347
|
-
bar {
|
348
|
-
blat: bang;
|
349
|
-
habit: rabbit;
|
350
|
-
baz {a: b}
|
351
|
-
bip {c: d}}
|
352
|
-
bibble {
|
353
|
-
bap {e: f}}}
|
354
|
-
SCSS
|
355
|
-
end
|
356
|
-
|
357
|
-
def test_nested_rules_with_fancy_selectors
|
358
|
-
assert_equal <<CSS, render(<<SCSS)
|
359
|
-
foo .bar {
|
360
|
-
a: b; }
|
361
|
-
foo :baz {
|
362
|
-
c: d; }
|
363
|
-
foo bang:bop {
|
364
|
-
e: f; }
|
365
|
-
CSS
|
366
|
-
foo {
|
367
|
-
.bar {a: b}
|
368
|
-
:baz {c: d}
|
369
|
-
bang:bop {e: f}}
|
370
|
-
SCSS
|
371
|
-
end
|
372
|
-
|
373
|
-
def test_almost_ambiguous_nested_rules_and_declarations
|
374
|
-
assert_equal <<CSS, render(<<SCSS)
|
375
|
-
foo {
|
376
|
-
bar: baz bang bop biddle woo look at all these elems; }
|
377
|
-
foo bar:baz:bang:bop:biddle:woo:look:at:all:these:pseudoclasses {
|
378
|
-
a: b; }
|
379
|
-
foo bar:baz bang bop biddle woo look at all these elems {
|
380
|
-
a: b; }
|
381
|
-
CSS
|
382
|
-
foo {
|
383
|
-
bar:baz:bang:bop:biddle:woo:look:at:all:these:pseudoclasses {a: b};
|
384
|
-
bar:baz bang bop biddle woo look at all these elems {a: b};
|
385
|
-
bar:baz bang bop biddle woo look at all these elems; }
|
386
|
-
SCSS
|
387
|
-
end
|
388
|
-
|
389
|
-
def test_newlines_in_selectors
|
390
|
-
assert_equal <<CSS, render(<<SCSS)
|
391
|
-
foo
|
392
|
-
bar {
|
393
|
-
a: b; }
|
394
|
-
CSS
|
395
|
-
foo
|
396
|
-
bar {a: b}
|
397
|
-
SCSS
|
398
|
-
|
399
|
-
assert_equal <<CSS, render(<<SCSS)
|
400
|
-
foo baz,
|
401
|
-
foo bang,
|
402
|
-
bar baz,
|
403
|
-
bar bang {
|
404
|
-
a: b; }
|
405
|
-
CSS
|
406
|
-
foo,
|
407
|
-
bar {
|
408
|
-
baz,
|
409
|
-
bang {a: b}}
|
410
|
-
SCSS
|
411
|
-
|
412
|
-
assert_equal <<CSS, render(<<SCSS)
|
413
|
-
foo
|
414
|
-
bar baz
|
415
|
-
bang {
|
416
|
-
a: b; }
|
417
|
-
foo
|
418
|
-
bar bip bop {
|
419
|
-
c: d; }
|
420
|
-
CSS
|
421
|
-
foo
|
422
|
-
bar {
|
423
|
-
baz
|
424
|
-
bang {a: b}
|
425
|
-
|
426
|
-
bip bop {c: d}}
|
427
|
-
SCSS
|
428
|
-
|
429
|
-
assert_equal <<CSS, render(<<SCSS)
|
430
|
-
foo bang, foo bip
|
431
|
-
bop, bar
|
432
|
-
baz bang, bar
|
433
|
-
baz bip
|
434
|
-
bop {
|
435
|
-
a: b; }
|
436
|
-
CSS
|
437
|
-
foo, bar
|
438
|
-
baz {
|
439
|
-
bang, bip
|
440
|
-
bop {a: b}}
|
441
|
-
SCSS
|
442
|
-
end
|
443
|
-
|
444
|
-
def test_parent_selectors
|
445
|
-
assert_equal <<CSS, render(<<SCSS)
|
446
|
-
foo:hover {
|
447
|
-
a: b; }
|
448
|
-
bar foo.baz {
|
449
|
-
c: d; }
|
450
|
-
CSS
|
451
|
-
foo {
|
452
|
-
&:hover {a: b}
|
453
|
-
bar &.baz {c: d}}
|
454
|
-
SCSS
|
455
|
-
end
|
456
|
-
|
457
|
-
## Namespace Properties
|
458
|
-
|
459
|
-
def test_namespace_properties
|
460
|
-
assert_equal <<CSS, render(<<SCSS)
|
461
|
-
foo {
|
462
|
-
bar: baz;
|
463
|
-
bang-bip: 1px;
|
464
|
-
bang-bop: bar; }
|
465
|
-
CSS
|
466
|
-
foo {
|
467
|
-
bar: baz;
|
468
|
-
bang: {
|
469
|
-
bip: 1px;
|
470
|
-
bop: bar;}}
|
471
|
-
SCSS
|
472
|
-
end
|
473
|
-
|
474
|
-
def test_several_namespace_properties
|
475
|
-
assert_equal <<CSS, render(<<SCSS)
|
476
|
-
foo {
|
477
|
-
bar: baz;
|
478
|
-
bang-bip: 1px;
|
479
|
-
bang-bop: bar;
|
480
|
-
buzz-fram: "foo";
|
481
|
-
buzz-frum: moo; }
|
482
|
-
CSS
|
483
|
-
foo {
|
484
|
-
bar: baz;
|
485
|
-
bang: {
|
486
|
-
bip: 1px;
|
487
|
-
bop: bar;}
|
488
|
-
buzz: {
|
489
|
-
fram: "foo";
|
490
|
-
frum: moo;
|
491
|
-
}
|
492
|
-
}
|
493
|
-
SCSS
|
494
|
-
end
|
495
|
-
|
496
|
-
def test_nested_namespace_properties
|
497
|
-
assert_equal <<CSS, render(<<SCSS)
|
498
|
-
foo {
|
499
|
-
bar: baz;
|
500
|
-
bang-bip: 1px;
|
501
|
-
bang-bop: bar;
|
502
|
-
bang-blat-baf: bort; }
|
503
|
-
CSS
|
504
|
-
foo {
|
505
|
-
bar: baz;
|
506
|
-
bang: {
|
507
|
-
bip: 1px;
|
508
|
-
bop: bar;
|
509
|
-
blat:{baf:bort}}}
|
510
|
-
SCSS
|
511
|
-
end
|
512
|
-
|
513
|
-
def test_namespace_properties_with_value
|
514
|
-
assert_equal <<CSS, render(<<SCSS)
|
515
|
-
foo {
|
516
|
-
bar: baz;
|
517
|
-
bar-bip: bop;
|
518
|
-
bar-bing: bop; }
|
519
|
-
CSS
|
520
|
-
foo {
|
521
|
-
bar: baz {
|
522
|
-
bip: bop;
|
523
|
-
bing: bop; }}
|
524
|
-
SCSS
|
525
|
-
end
|
526
|
-
|
527
|
-
def test_namespace_properties_with_script_value
|
528
|
-
assert_equal <<CSS, render(<<SCSS)
|
529
|
-
foo {
|
530
|
-
bar: bazbang;
|
531
|
-
bar-bip: bop;
|
532
|
-
bar-bing: bop; }
|
533
|
-
CSS
|
534
|
-
foo {
|
535
|
-
bar: baz + bang {
|
536
|
-
bip: bop;
|
537
|
-
bing: bop; }}
|
538
|
-
SCSS
|
539
|
-
end
|
540
|
-
|
541
|
-
def test_no_namespace_properties_without_space
|
542
|
-
assert_equal <<CSS, render(<<SCSS)
|
543
|
-
foo bar:baz {
|
544
|
-
bip: bop; }
|
545
|
-
CSS
|
546
|
-
foo {
|
547
|
-
bar:baz {
|
548
|
-
bip: bop }}
|
549
|
-
SCSS
|
550
|
-
end
|
551
|
-
|
552
|
-
def test_no_namespace_properties_without_space_even_when_its_unambiguous
|
553
|
-
render(<<SCSS)
|
554
|
-
foo {
|
555
|
-
bar:1px {
|
556
|
-
bip: bop }}
|
557
|
-
SCSS
|
558
|
-
assert(false, "Expected syntax error")
|
559
|
-
rescue Sass::SyntaxError => e
|
560
|
-
assert_equal <<MESSAGE, e.message
|
561
|
-
Invalid CSS: a space is required between a property and its definition
|
562
|
-
when it has other properties nested beneath it.
|
563
|
-
MESSAGE
|
564
|
-
assert_equal 2, e.sass_line
|
565
|
-
end
|
566
|
-
|
567
|
-
## Mixins
|
568
|
-
|
569
|
-
def test_basic_mixins
|
570
|
-
assert_equal <<CSS, render(<<SCSS)
|
571
|
-
.foo {
|
572
|
-
a: b; }
|
573
|
-
CSS
|
574
|
-
@mixin foo {
|
575
|
-
.foo {a: b}}
|
576
|
-
|
577
|
-
@include foo;
|
578
|
-
SCSS
|
579
|
-
|
580
|
-
assert_equal <<CSS, render(<<SCSS)
|
581
|
-
bar {
|
582
|
-
c: d; }
|
583
|
-
bar .foo {
|
584
|
-
a: b; }
|
585
|
-
CSS
|
586
|
-
@mixin foo {
|
587
|
-
.foo {a: b}}
|
588
|
-
|
589
|
-
bar {
|
590
|
-
@include foo;
|
591
|
-
c: d; }
|
592
|
-
SCSS
|
593
|
-
|
594
|
-
assert_equal <<CSS, render(<<SCSS)
|
595
|
-
bar {
|
596
|
-
a: b;
|
597
|
-
c: d; }
|
598
|
-
CSS
|
599
|
-
@mixin foo {a: b}
|
600
|
-
|
601
|
-
bar {
|
602
|
-
@include foo;
|
603
|
-
c: d; }
|
604
|
-
SCSS
|
605
|
-
end
|
606
|
-
|
607
|
-
def test_mixins_with_empty_args
|
608
|
-
assert_equal <<CSS, render(<<SCSS)
|
609
|
-
.foo {
|
610
|
-
a: b; }
|
611
|
-
CSS
|
612
|
-
@mixin foo() {a: b}
|
613
|
-
|
614
|
-
.foo {@include foo();}
|
615
|
-
SCSS
|
616
|
-
|
617
|
-
assert_equal <<CSS, render(<<SCSS)
|
618
|
-
.foo {
|
619
|
-
a: b; }
|
620
|
-
CSS
|
621
|
-
@mixin foo() {a: b}
|
622
|
-
|
623
|
-
.foo {@include foo;}
|
624
|
-
SCSS
|
625
|
-
|
626
|
-
assert_equal <<CSS, render(<<SCSS)
|
627
|
-
.foo {
|
628
|
-
a: b; }
|
629
|
-
CSS
|
630
|
-
@mixin foo {a: b}
|
631
|
-
|
632
|
-
.foo {@include foo();}
|
633
|
-
SCSS
|
634
|
-
end
|
635
|
-
|
636
|
-
def test_mixins_with_args
|
637
|
-
assert_equal <<CSS, render(<<SCSS)
|
638
|
-
.foo {
|
639
|
-
a: bar; }
|
640
|
-
CSS
|
641
|
-
@mixin foo($a) {a: $a}
|
642
|
-
|
643
|
-
.foo {@include foo(bar)}
|
644
|
-
SCSS
|
645
|
-
|
646
|
-
assert_equal <<CSS, render(<<SCSS)
|
647
|
-
.foo {
|
648
|
-
a: bar;
|
649
|
-
b: 12px; }
|
650
|
-
CSS
|
651
|
-
@mixin foo($a, $b) {
|
652
|
-
a: $a;
|
653
|
-
b: $b; }
|
654
|
-
|
655
|
-
.foo {@include foo(bar, 12px)}
|
656
|
-
SCSS
|
657
|
-
end
|
658
|
-
|
659
|
-
## Interpolation
|
660
|
-
|
661
|
-
def test_basic_selector_interpolation
|
662
|
-
assert_equal <<CSS, render(<<SCSS)
|
663
|
-
foo 3 baz {
|
664
|
-
a: b; }
|
665
|
-
CSS
|
666
|
-
foo \#{1 + 2} baz {a: b}
|
667
|
-
SCSS
|
668
|
-
assert_equal <<CSS, render(<<SCSS)
|
669
|
-
foo.bar baz {
|
670
|
-
a: b; }
|
671
|
-
CSS
|
672
|
-
foo\#{".bar"} baz {a: b}
|
673
|
-
SCSS
|
674
|
-
assert_equal <<CSS, render(<<SCSS)
|
675
|
-
foo.bar baz {
|
676
|
-
a: b; }
|
677
|
-
CSS
|
678
|
-
\#{"foo"}.bar baz {a: b}
|
679
|
-
SCSS
|
680
|
-
end
|
681
|
-
|
682
|
-
def test_selector_only_interpolation
|
683
|
-
assert_equal <<CSS, render(<<SCSS)
|
684
|
-
foo bar {
|
685
|
-
a: b; }
|
686
|
-
CSS
|
687
|
-
\#{"foo" + " bar"} {a: b}
|
688
|
-
SCSS
|
689
|
-
end
|
690
|
-
|
691
|
-
def test_selector_interpolation_before_element_name
|
692
|
-
assert_equal <<CSS, render(<<SCSS)
|
693
|
-
foo barbaz {
|
694
|
-
a: b; }
|
695
|
-
CSS
|
696
|
-
\#{"foo" + " bar"}baz {a: b}
|
697
|
-
SCSS
|
698
|
-
end
|
699
|
-
|
700
|
-
def test_selector_interpolation_in_string
|
701
|
-
assert_equal <<CSS, render(<<SCSS)
|
702
|
-
foo[val="bar foo bar baz"] {
|
703
|
-
a: b; }
|
704
|
-
CSS
|
705
|
-
foo[val="bar \#{"foo" + " bar"} baz"] {a: b}
|
706
|
-
SCSS
|
707
|
-
end
|
708
|
-
|
709
|
-
def test_selector_interpolation_in_pseudoclass
|
710
|
-
assert_equal <<CSS, render(<<SCSS)
|
711
|
-
foo:nth-child(5n) {
|
712
|
-
a: b; }
|
713
|
-
CSS
|
714
|
-
foo:nth-child(\#{5 + "n"}) {a: b}
|
715
|
-
SCSS
|
716
|
-
end
|
717
|
-
|
718
|
-
def test_selector_interpolation_at_class_begininng
|
719
|
-
assert_equal <<CSS, render(<<SCSS)
|
720
|
-
.zzz {
|
721
|
-
a: b; }
|
722
|
-
CSS
|
723
|
-
$zzz: zzz;
|
724
|
-
.\#{$zzz} { a: b; }
|
725
|
-
SCSS
|
726
|
-
end
|
727
|
-
|
728
|
-
def test_selector_interpolation_at_id_begininng
|
729
|
-
assert_equal <<CSS, render(<<SCSS)
|
730
|
-
#zzz {
|
731
|
-
a: b; }
|
732
|
-
CSS
|
733
|
-
$zzz: zzz;
|
734
|
-
#\#{$zzz} { a: b; }
|
735
|
-
SCSS
|
736
|
-
end
|
737
|
-
|
738
|
-
def test_selector_interpolation_at_pseudo_begininng
|
739
|
-
assert_equal <<CSS, render(<<SCSS)
|
740
|
-
:zzz::zzz {
|
741
|
-
a: b; }
|
742
|
-
CSS
|
743
|
-
$zzz: zzz;
|
744
|
-
:\#{$zzz}::\#{$zzz} { a: b; }
|
745
|
-
SCSS
|
746
|
-
end
|
747
|
-
|
748
|
-
def test_selector_interpolation_at_attr_beginning
|
749
|
-
assert_equal <<CSS, render(<<SCSS)
|
750
|
-
[zzz=foo] {
|
751
|
-
a: b; }
|
752
|
-
CSS
|
753
|
-
$zzz: zzz;
|
754
|
-
[\#{$zzz}=foo] { a: b; }
|
755
|
-
SCSS
|
756
|
-
end
|
757
|
-
|
758
|
-
def test_selector_interpolation_at_dashes
|
759
|
-
assert_equal <<CSS, render(<<SCSS)
|
760
|
-
div {
|
761
|
-
-foo-a-b-foo: foo; }
|
762
|
-
CSS
|
763
|
-
$a : a;
|
764
|
-
$b : b;
|
765
|
-
div { -foo-\#{$a}-\#{$b}-foo: foo }
|
766
|
-
SCSS
|
767
|
-
end
|
768
|
-
|
769
|
-
def test_basic_prop_name_interpolation
|
770
|
-
assert_equal <<CSS, render(<<SCSS)
|
771
|
-
foo {
|
772
|
-
barbazbang: blip; }
|
773
|
-
CSS
|
774
|
-
foo {bar\#{"baz" + "bang"}: blip}
|
775
|
-
SCSS
|
776
|
-
assert_equal <<CSS, render(<<SCSS)
|
777
|
-
foo {
|
778
|
-
bar3: blip; }
|
779
|
-
CSS
|
780
|
-
foo {bar\#{1 + 2}: blip}
|
781
|
-
SCSS
|
782
|
-
end
|
783
|
-
|
784
|
-
def test_prop_name_only_interpolation
|
785
|
-
assert_equal <<CSS, render(<<SCSS)
|
786
|
-
foo {
|
787
|
-
bazbang: blip; }
|
788
|
-
CSS
|
789
|
-
foo {\#{"baz" + "bang"}: blip}
|
790
|
-
SCSS
|
791
|
-
end
|
792
|
-
|
793
|
-
## Errors
|
794
|
-
|
795
|
-
def test_mixin_defs_only_at_toplevel
|
796
|
-
render <<SCSS
|
797
|
-
foo {
|
798
|
-
@mixin bar {a: b}}
|
799
|
-
SCSS
|
800
|
-
assert(false, "Expected syntax error")
|
801
|
-
rescue Sass::SyntaxError => e
|
802
|
-
assert_equal "Mixins may only be defined at the root of a document.", e.message
|
803
|
-
assert_equal 2, e.sass_line
|
804
|
-
end
|
805
|
-
|
806
|
-
def test_imports_only_at_toplevel
|
807
|
-
render <<SCSS
|
808
|
-
foo {
|
809
|
-
@import "foo.scss";}
|
810
|
-
SCSS
|
811
|
-
assert(false, "Expected syntax error")
|
812
|
-
rescue Sass::SyntaxError => e
|
813
|
-
assert_equal "Import directives may only be used at the root of a document.", e.message
|
814
|
-
assert_equal 2, e.sass_line
|
815
|
-
end
|
816
|
-
|
817
|
-
def test_rules_beneath_properties
|
818
|
-
render <<SCSS
|
819
|
-
foo {
|
820
|
-
bar: {
|
821
|
-
baz {
|
822
|
-
bang: bop }}}
|
823
|
-
SCSS
|
824
|
-
assert(false, "Expected syntax error")
|
825
|
-
rescue Sass::SyntaxError => e
|
826
|
-
assert_equal 'Illegal nesting: Only properties may be nested beneath properties.', e.message
|
827
|
-
assert_equal 3, e.sass_line
|
828
|
-
end
|
829
|
-
|
830
|
-
def test_uses_property_exception_with_star_hack
|
831
|
-
render <<SCSS
|
832
|
-
foo {
|
833
|
-
*bar:baz [fail]; }
|
834
|
-
SCSS
|
835
|
-
assert(false, "Expected syntax error")
|
836
|
-
rescue Sass::SyntaxError => e
|
837
|
-
assert_equal 'Invalid CSS after " *bar:baz ": expected ";", was "[fail]; }"', e.message
|
838
|
-
assert_equal 2, e.sass_line
|
839
|
-
end
|
840
|
-
|
841
|
-
def test_uses_property_exception_with_colon_hack
|
842
|
-
render <<SCSS
|
843
|
-
foo {
|
844
|
-
:bar:baz [fail]; }
|
845
|
-
SCSS
|
846
|
-
assert(false, "Expected syntax error")
|
847
|
-
rescue Sass::SyntaxError => e
|
848
|
-
assert_equal 'Invalid CSS after " :bar:baz ": expected ";", was "[fail]; }"', e.message
|
849
|
-
assert_equal 2, e.sass_line
|
850
|
-
end
|
851
|
-
|
852
|
-
def test_uses_rule_exception_with_dot_hack
|
853
|
-
render <<SCSS
|
854
|
-
foo {
|
855
|
-
.bar:baz <fail>; }
|
856
|
-
SCSS
|
857
|
-
assert(false, "Expected syntax error")
|
858
|
-
rescue Sass::SyntaxError => e
|
859
|
-
assert_equal 'Invalid CSS after " .bar:baz ": expected "{", was "<fail>; }"', e.message
|
860
|
-
assert_equal 2, e.sass_line
|
861
|
-
end
|
862
|
-
|
863
|
-
def test_uses_property_exception_with_space_after_name
|
864
|
-
render <<SCSS
|
865
|
-
foo {
|
866
|
-
bar: baz [fail]; }
|
867
|
-
SCSS
|
868
|
-
assert(false, "Expected syntax error")
|
869
|
-
rescue Sass::SyntaxError => e
|
870
|
-
assert_equal 'Invalid CSS after " bar: baz ": expected ";", was "[fail]; }"', e.message
|
871
|
-
assert_equal 2, e.sass_line
|
872
|
-
end
|
873
|
-
|
874
|
-
def test_uses_property_exception_with_non_identifier_after_name
|
875
|
-
render <<SCSS
|
876
|
-
foo {
|
877
|
-
bar:1px [fail]; }
|
878
|
-
SCSS
|
879
|
-
assert(false, "Expected syntax error")
|
880
|
-
rescue Sass::SyntaxError => e
|
881
|
-
assert_equal 'Invalid CSS after " bar:1px ": expected ";", was "[fail]; }"', e.message
|
882
|
-
assert_equal 2, e.sass_line
|
883
|
-
end
|
884
|
-
|
885
|
-
def test_uses_property_exception_when_followed_by_open_bracket
|
886
|
-
render <<SCSS
|
887
|
-
foo {
|
888
|
-
bar:{baz: .fail} }
|
889
|
-
SCSS
|
890
|
-
assert(false, "Expected syntax error")
|
891
|
-
rescue Sass::SyntaxError => e
|
892
|
-
assert_equal 'Invalid CSS after " bar:{baz: ": expected expression (e.g. 1px, bold), was ".fail} }"', e.message
|
893
|
-
assert_equal 2, e.sass_line
|
894
|
-
end
|
895
|
-
|
896
|
-
def test_script_error
|
897
|
-
render <<SCSS
|
898
|
-
foo {
|
899
|
-
bar: "baz" * * }
|
900
|
-
SCSS
|
901
|
-
assert(false, "Expected syntax error")
|
902
|
-
rescue Sass::SyntaxError => e
|
903
|
-
assert_equal 'Invalid CSS after " bar: "baz" * ": expected expression (e.g. 1px, bold), was "* }"', e.message
|
904
|
-
assert_equal 2, e.sass_line
|
905
|
-
end
|
906
|
-
|
907
|
-
def test_multiline_script_syntax_error
|
908
|
-
render <<SCSS
|
909
|
-
foo {
|
910
|
-
bar:
|
911
|
-
"baz" * * }
|
912
|
-
SCSS
|
913
|
-
assert(false, "Expected syntax error")
|
914
|
-
rescue Sass::SyntaxError => e
|
915
|
-
assert_equal 'Invalid CSS after " "baz" * ": expected expression (e.g. 1px, bold), was "* }"', e.message
|
916
|
-
assert_equal 3, e.sass_line
|
917
|
-
end
|
918
|
-
|
919
|
-
def test_multiline_script_runtime_error
|
920
|
-
render <<SCSS
|
921
|
-
foo {
|
922
|
-
bar: "baz" +
|
923
|
-
"bar" +
|
924
|
-
$bang }
|
925
|
-
SCSS
|
926
|
-
assert(false, "Expected syntax error")
|
927
|
-
rescue Sass::SyntaxError => e
|
928
|
-
assert_equal "Undefined variable: \"$bang\".", e.message
|
929
|
-
assert_equal 4, e.sass_line
|
930
|
-
end
|
931
|
-
|
932
|
-
def test_post_multiline_script_runtime_error
|
933
|
-
render <<SCSS
|
934
|
-
foo {
|
935
|
-
bar: "baz" +
|
936
|
-
"bar" +
|
937
|
-
"baz";
|
938
|
-
bip: $bop; }
|
939
|
-
SCSS
|
940
|
-
assert(false, "Expected syntax error")
|
941
|
-
rescue Sass::SyntaxError => e
|
942
|
-
assert_equal "Undefined variable: \"$bop\".", e.message
|
943
|
-
assert_equal 5, e.sass_line
|
944
|
-
end
|
945
|
-
|
946
|
-
def test_multiline_property_runtime_error
|
947
|
-
render <<SCSS
|
948
|
-
foo {
|
949
|
-
bar: baz
|
950
|
-
bar
|
951
|
-
\#{$bang} }
|
952
|
-
SCSS
|
953
|
-
assert(false, "Expected syntax error")
|
954
|
-
rescue Sass::SyntaxError => e
|
955
|
-
assert_equal "Undefined variable: \"$bang\".", e.message
|
956
|
-
assert_equal 4, e.sass_line
|
957
|
-
end
|
958
|
-
|
959
|
-
def test_post_resolution_selector_error
|
960
|
-
render "\n\nfoo \#{\") bar\"} {a: b}"
|
961
|
-
assert(false, "Expected syntax error")
|
962
|
-
rescue Sass::SyntaxError => e
|
963
|
-
assert_equal 'Invalid CSS after "foo ": expected selector, was ") bar"', e.message
|
964
|
-
assert_equal 3, e.sass_line
|
965
|
-
end
|
966
|
-
|
967
|
-
def test_parent_in_mid_selector_error
|
968
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE) {render <<SCSS}
|
969
|
-
Invalid CSS after ".foo": expected "{", was "&.bar"
|
970
|
-
|
971
|
-
In Sass 3, the parent selector & can only be used where element names are valid,
|
972
|
-
since it could potentially be replaced by an element name.
|
973
|
-
MESSAGE
|
974
|
-
flim {
|
975
|
-
.foo&.bar {a: b}
|
976
|
-
}
|
977
|
-
SCSS
|
978
|
-
end
|
979
|
-
|
980
|
-
def test_parent_in_mid_selector_error
|
981
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE) {render <<SCSS}
|
982
|
-
Invalid CSS after " .foo.bar": expected "{", was "& {a: b}"
|
983
|
-
|
984
|
-
In Sass 3, the parent selector & can only be used where element names are valid,
|
985
|
-
since it could potentially be replaced by an element name.
|
986
|
-
MESSAGE
|
987
|
-
flim {
|
988
|
-
.foo.bar& {a: b}
|
989
|
-
}
|
990
|
-
SCSS
|
991
|
-
end
|
992
|
-
|
993
|
-
def test_double_parent_selector_error
|
994
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE) {render <<SCSS}
|
995
|
-
Invalid CSS after " &": expected "{", was "& {a: b}"
|
996
|
-
|
997
|
-
In Sass 3, the parent selector & can only be used where element names are valid,
|
998
|
-
since it could potentially be replaced by an element name.
|
999
|
-
MESSAGE
|
1000
|
-
flim {
|
1001
|
-
&& {a: b}
|
1002
|
-
}
|
1003
|
-
SCSS
|
1004
|
-
end
|
1005
|
-
|
1006
|
-
def test_no_interpolation_in_media_queries
|
1007
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1008
|
-
Invalid CSS after "...nd (min-width: ": expected expression (e.g. 1px, bold), was "\#{100}px) {"
|
1009
|
-
MESSAGE
|
1010
|
-
@media screen and (min-width: \#{100}px) {
|
1011
|
-
foo {bar: baz}
|
1012
|
-
}
|
1013
|
-
SCSS
|
1014
|
-
end
|
1015
|
-
|
1016
|
-
def test_no_interpolation_in_unrecognized_directives
|
1017
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1018
|
-
Invalid CSS after "@foo ": expected selector or at-rule, was "\#{100} {"
|
1019
|
-
MESSAGE
|
1020
|
-
@foo \#{100} {
|
1021
|
-
foo {bar: baz}
|
1022
|
-
}
|
1023
|
-
SCSS
|
1024
|
-
end
|
1025
|
-
|
1026
|
-
# Regression
|
1027
|
-
|
1028
|
-
def test_weird_added_space
|
1029
|
-
assert_equal <<CSS, render(<<SCSS)
|
1030
|
-
foo {
|
1031
|
-
bar: -moz-bip; }
|
1032
|
-
CSS
|
1033
|
-
$value : bip;
|
1034
|
-
|
1035
|
-
foo {
|
1036
|
-
bar: -moz-\#{$value};
|
1037
|
-
}
|
1038
|
-
SCSS
|
1039
|
-
end
|
1040
|
-
|
1041
|
-
def test_interpolation_with_bracket_on_next_line
|
1042
|
-
assert_equal <<CSS, render(<<SCSS)
|
1043
|
-
a.foo b {
|
1044
|
-
color: red; }
|
1045
|
-
CSS
|
1046
|
-
a.\#{"foo"} b
|
1047
|
-
{color: red}
|
1048
|
-
SCSS
|
1049
|
-
end
|
1050
|
-
|
1051
|
-
def test_extra_comma_in_mixin_arglist_error
|
1052
|
-
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1053
|
-
Invalid CSS after "...clude foo(bar, ": expected mixin argument, was ");"
|
1054
|
-
MESSAGE
|
1055
|
-
@mixin foo($a1, $a2) {
|
1056
|
-
baz: $a1 $a2;
|
1057
|
-
}
|
1058
|
-
|
1059
|
-
.bar {
|
1060
|
-
@include foo(bar, );
|
1061
|
-
}
|
1062
|
-
SCSS
|
1063
|
-
end
|
1064
|
-
|
1065
|
-
def test_interpolation
|
1066
|
-
assert_equal <<CSS, render(<<SCSS)
|
1067
|
-
ul li#foo a span.label {
|
1068
|
-
foo: bar; }
|
1069
|
-
CSS
|
1070
|
-
$bar : "#foo";
|
1071
|
-
ul li\#{$bar} a span.label { foo: bar; }
|
1072
|
-
SCSS
|
1073
|
-
end
|
1074
|
-
|
1075
|
-
def test_newlines_removed_from_selectors_when_compressed
|
1076
|
-
assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
|
1077
|
-
z a,z b{display:block}
|
1078
|
-
CSS
|
1079
|
-
a,
|
1080
|
-
b {
|
1081
|
-
z & {
|
1082
|
-
display: block;
|
1083
|
-
}
|
1084
|
-
}
|
1085
|
-
SCSS
|
1086
|
-
|
1087
|
-
end
|
1088
|
-
end
|