haml-edge 2.3.179 → 2.3.180
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/README.md +88 -149
- data/VERSION +1 -1
- data/bin/css2sass +7 -1
- data/bin/sass-convert +7 -0
- data/lib/haml/exec.rb +95 -22
- data/lib/haml/template.rb +1 -1
- data/lib/haml/util.rb +50 -0
- data/lib/sass.rb +1 -1
- data/lib/sass/css.rb +38 -210
- data/lib/sass/engine.rb +121 -47
- data/lib/sass/files.rb +28 -19
- data/lib/sass/plugin.rb +32 -43
- data/lib/sass/repl.rb +1 -1
- data/lib/sass/script.rb +25 -6
- data/lib/sass/script/bool.rb +1 -0
- data/lib/sass/script/color.rb +2 -2
- data/lib/sass/script/css_lexer.rb +22 -0
- data/lib/sass/script/css_parser.rb +28 -0
- data/lib/sass/script/funcall.rb +17 -9
- data/lib/sass/script/functions.rb +46 -1
- data/lib/sass/script/interpolation.rb +42 -0
- data/lib/sass/script/lexer.rb +142 -34
- data/lib/sass/script/literal.rb +28 -12
- data/lib/sass/script/node.rb +57 -1
- data/lib/sass/script/number.rb +18 -3
- data/lib/sass/script/operation.rb +44 -8
- data/lib/sass/script/parser.rb +149 -24
- data/lib/sass/script/string.rb +50 -2
- data/lib/sass/script/unary_operation.rb +25 -10
- data/lib/sass/script/variable.rb +20 -11
- data/lib/sass/scss.rb +14 -0
- data/lib/sass/scss/css_parser.rb +39 -0
- data/lib/sass/scss/parser.rb +683 -0
- data/lib/sass/scss/rx.rb +112 -0
- data/lib/sass/scss/script_lexer.rb +13 -0
- data/lib/sass/scss/script_parser.rb +25 -0
- data/lib/sass/tree/comment_node.rb +58 -16
- data/lib/sass/tree/debug_node.rb +7 -2
- data/lib/sass/tree/directive_node.rb +38 -34
- data/lib/sass/tree/for_node.rb +6 -0
- data/lib/sass/tree/if_node.rb +13 -0
- data/lib/sass/tree/import_node.rb +26 -7
- data/lib/sass/tree/mixin_def_node.rb +18 -0
- data/lib/sass/tree/mixin_node.rb +16 -1
- data/lib/sass/tree/node.rb +98 -27
- data/lib/sass/tree/prop_node.rb +97 -20
- data/lib/sass/tree/root_node.rb +37 -0
- data/lib/sass/tree/rule_node.rb +88 -60
- data/lib/sass/tree/variable_node.rb +9 -5
- data/lib/sass/tree/while_node.rb +4 -0
- data/test/haml/results/filters.xhtml +1 -1
- data/test/haml/util_test.rb +28 -0
- data/test/sass/conversion_test.rb +884 -0
- data/test/sass/css2sass_test.rb +46 -21
- data/test/sass/engine_test.rb +680 -160
- data/test/sass/functions_test.rb +27 -0
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/more_templates/more_import.sass +3 -3
- data/test/sass/plugin_test.rb +28 -8
- data/test/sass/results/compact.css +1 -1
- data/test/sass/results/complex.css +5 -5
- data/test/sass/results/compressed.css +1 -1
- data/test/sass/results/expanded.css +1 -1
- data/test/sass/results/import.css +3 -1
- data/test/sass/results/mixins.css +12 -12
- data/test/sass/results/nested.css +1 -1
- data/test/sass/results/parent_ref.css +4 -4
- data/test/sass/results/script.css +3 -3
- data/test/sass/results/scss_import.css +15 -0
- data/test/sass/results/scss_importee.css +2 -0
- data/test/sass/script_conversion_test.rb +153 -0
- data/test/sass/script_test.rb +44 -54
- data/test/sass/scss/css_test.rb +811 -0
- data/test/sass/scss/rx_test.rb +156 -0
- data/test/sass/scss/scss_test.rb +871 -0
- data/test/sass/scss/test_helper.rb +37 -0
- data/test/sass/templates/alt.sass +2 -2
- data/test/sass/templates/bork1.sass +1 -1
- data/test/sass/templates/import.sass +4 -4
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/line_numbers.sass +1 -1
- data/test/sass/templates/mixins.sass +2 -2
- data/test/sass/templates/nested_mixin_bork.sass +1 -1
- data/test/sass/templates/options.sass +1 -1
- data/test/sass/templates/parent_ref.sass +2 -2
- data/test/sass/templates/script.sass +69 -69
- data/test/sass/templates/scss_import.scss +10 -0
- data/test/sass/templates/scss_importee.scss +1 -0
- data/test/sass/templates/units.sass +10 -10
- data/test/test_helper.rb +4 -4
- metadata +27 -2
data/test/sass/css2sass_test.rb
CHANGED
@@ -24,13 +24,10 @@ SASS
|
|
24
24
|
assert_equal(<<SASS, css2sass(<<CSS))
|
25
25
|
li
|
26
26
|
display: none
|
27
|
-
|
28
27
|
a
|
29
28
|
text-decoration: none
|
30
|
-
|
31
29
|
span
|
32
30
|
color: yellow
|
33
|
-
|
34
31
|
&:hover
|
35
32
|
text-decoration: underline
|
36
33
|
SASS
|
@@ -57,11 +54,9 @@ CSS
|
|
57
54
|
div .warning
|
58
55
|
color: #d21a19
|
59
56
|
|
60
|
-
|
61
57
|
span .debug
|
62
58
|
cursor: crosshair
|
63
59
|
|
64
|
-
|
65
60
|
div .debug
|
66
61
|
cursor: default
|
67
62
|
SASS
|
@@ -104,27 +99,34 @@ span.turkey {
|
|
104
99
|
} /* just a line here */
|
105
100
|
CSS
|
106
101
|
sass = <<SASS
|
102
|
+
/* comment
|
103
|
+
|
107
104
|
elephant.rawr
|
108
105
|
rampages: excessively
|
109
106
|
|
107
|
+
/* actual multiline
|
108
|
+
comment
|
110
109
|
|
111
110
|
span.turkey
|
112
111
|
isdinner: true
|
113
112
|
|
114
|
-
|
115
113
|
.turducken
|
114
|
+
/* Sounds funny
|
115
|
+
doesn't it
|
116
116
|
chimera: not_really
|
117
117
|
|
118
|
-
|
119
118
|
#overhere
|
120
119
|
bored: sorta
|
120
|
+
/* it's for a good
|
121
|
+
cause
|
121
122
|
better_than: thread_pools
|
122
123
|
|
123
|
-
|
124
124
|
#one_more
|
125
125
|
finally: srsly
|
126
|
+
|
127
|
+
/* just a line here
|
126
128
|
SASS
|
127
|
-
assert_equal(css2sass(css)
|
129
|
+
assert_equal(sass, css2sass(css))
|
128
130
|
end
|
129
131
|
|
130
132
|
def test_fold_commas
|
@@ -145,12 +147,10 @@ CSS
|
|
145
147
|
.one
|
146
148
|
color: green
|
147
149
|
|
148
|
-
|
149
150
|
.two
|
150
151
|
color: green
|
151
152
|
color: red
|
152
153
|
|
153
|
-
|
154
154
|
.three
|
155
155
|
color: red
|
156
156
|
SASS
|
@@ -168,20 +168,15 @@ CSS
|
|
168
168
|
assert_equal(<<SASS, css2sass(<<CSS))
|
169
169
|
hello
|
170
170
|
parent: true
|
171
|
-
|
172
171
|
there
|
173
172
|
parent: false
|
174
|
-
|
175
173
|
who
|
176
174
|
hoo: false
|
177
|
-
|
178
175
|
why
|
179
176
|
y: true
|
180
|
-
|
181
177
|
when
|
182
178
|
wen: nao
|
183
179
|
|
184
|
-
|
185
180
|
down_here
|
186
181
|
yeah: true
|
187
182
|
SASS
|
@@ -214,7 +209,6 @@ CSS
|
|
214
209
|
#location-navigation-form .form-submit, #business-listing-form .form-submit, #detailTabs ul, #detailsEnhanced #addTags, #locationSearchList, #moreHoods
|
215
210
|
display: none
|
216
211
|
|
217
|
-
|
218
212
|
#navListLeft
|
219
213
|
display: none
|
220
214
|
SASS
|
@@ -235,7 +229,6 @@ CSS
|
|
235
229
|
assert_equal(<<SASS, css2sass(<<CSS))
|
236
230
|
\\:focus
|
237
231
|
a: b
|
238
|
-
|
239
232
|
\\:foo
|
240
233
|
bar: baz
|
241
234
|
SASS
|
@@ -263,7 +256,7 @@ CSS
|
|
263
256
|
end
|
264
257
|
|
265
258
|
def test_error_truncate_after
|
266
|
-
css2sass("#{"a" *
|
259
|
+
css2sass("#{"a" * 16}foo")
|
267
260
|
assert(false, "Expected exception")
|
268
261
|
rescue Sass::SyntaxError => err
|
269
262
|
assert_equal(1, err.sass_line)
|
@@ -271,11 +264,43 @@ CSS
|
|
271
264
|
end
|
272
265
|
|
273
266
|
def test_error_truncate_was
|
274
|
-
css2sass("foo }#{"a" * 15}")
|
267
|
+
css2sass("foo }foo#{"a" * 15}")
|
275
268
|
assert(false, "Expected exception")
|
276
269
|
rescue Sass::SyntaxError => err
|
277
270
|
assert_equal(1, err.sass_line)
|
278
|
-
assert_equal('Invalid CSS after "foo ": expected "{", was "}
|
271
|
+
assert_equal('Invalid CSS after "foo ": expected "{", was "}fooaaaaaaaaaaa..."', err.message)
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_error_doesnt_truncate_after_when_elipsis_would_add_length
|
275
|
+
css2sass("#{"a" * 15}foo")
|
276
|
+
assert(false, "Expected exception")
|
277
|
+
rescue Sass::SyntaxError => err
|
278
|
+
assert_equal(1, err.sass_line)
|
279
|
+
assert_equal('Invalid CSS after "aaaaaaaaaaaaaaafoo": expected "{", was ""', err.message)
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_error_doesnt_truncate_was_when_elipsis_would_add_length
|
283
|
+
css2sass("foo }foo#{"a" * 14}")
|
284
|
+
assert(false, "Expected exception")
|
285
|
+
rescue Sass::SyntaxError => err
|
286
|
+
assert_equal(1, err.sass_line)
|
287
|
+
assert_equal('Invalid CSS after "foo ": expected "{", was "}fooaaaaaaaaaaaaaa"', err.message)
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_error_gets_rid_of_trailing_newline_for_after
|
291
|
+
css2sass("foo \n ")
|
292
|
+
assert(false, "Expected exception")
|
293
|
+
rescue Sass::SyntaxError => err
|
294
|
+
assert_equal(2, err.sass_line)
|
295
|
+
assert_equal('Invalid CSS after "foo": expected "{", was ""', err.message)
|
296
|
+
end
|
297
|
+
|
298
|
+
def test_error_gets_rid_of_trailing_newline_for_was
|
299
|
+
css2sass("foo \n }foo")
|
300
|
+
assert(false, "Expected exception")
|
301
|
+
rescue Sass::SyntaxError => err
|
302
|
+
assert_equal(2, err.sass_line)
|
303
|
+
assert_equal('Invalid CSS after "foo": expected "{", was "}foo"', err.message)
|
279
304
|
end
|
280
305
|
|
281
306
|
# Encodings
|
data/test/sass/engine_test.rb
CHANGED
@@ -15,15 +15,14 @@ class SassEngineTest < Test::Unit::TestCase
|
|
15
15
|
# if so, the second element should be the line number that should be reported for the error.
|
16
16
|
# If this isn't provided, the tests will assume the line number should be the last line of the document.
|
17
17
|
EXCEPTION_MAP = {
|
18
|
-
"
|
19
|
-
"
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
18
|
+
"$a: 1 + " => 'Invalid CSS after "1 +": expected expression (e.g. 1px, bold), was ""',
|
19
|
+
"$a: 1 + 2 +" => 'Invalid CSS after "1 + 2 +": expected expression (e.g. 1px, bold), was ""',
|
20
|
+
"$a: 1 + 2 + %" => 'Invalid CSS after "1 + 2 + ": expected expression (e.g. 1px, bold), was "%"',
|
21
|
+
"$a: foo(\"bar\"" => 'Invalid CSS after "foo("bar"": expected ")", was ""',
|
22
|
+
"$a: 1 }" => 'Invalid CSS after "1 ": expected expression (e.g. 1px, bold), was "}"',
|
23
|
+
"$a: 1 }foo\"" => 'Invalid CSS after "1 ": expected expression (e.g. 1px, bold), was "}foo""',
|
24
24
|
":" => 'Invalid property: ":".',
|
25
25
|
": a" => 'Invalid property: ": a".',
|
26
|
-
":= a" => 'Invalid property: ":= a".',
|
27
26
|
"a\n :b" => <<MSG,
|
28
27
|
Invalid property: ":b" (no value).
|
29
28
|
If ":b" should be a selector, use "\\:b" instead.
|
@@ -31,32 +30,32 @@ MSG
|
|
31
30
|
"a\n b:" => 'Invalid property: "b:" (no value).',
|
32
31
|
"a\n :b: c" => 'Invalid property: ":b: c".',
|
33
32
|
"a\n :b:c d" => 'Invalid property: ":b:c d".',
|
34
|
-
"a\n :b
|
35
|
-
"a\n :
|
36
|
-
"a\n b: c;" => 'Invalid property: "b: c;" (no ";" required at end-of-line).',
|
37
|
-
"a\n b : c" => 'Invalid property: "b : c".',
|
38
|
-
"a\n b=c: d" => 'Invalid property: "b=c: d".',
|
33
|
+
"a\n :b c;" => 'Invalid CSS after "c": expected expression (e.g. 1px, bold), was ";"',
|
34
|
+
"a\n b: c;" => 'Invalid CSS after "c": expected expression (e.g. 1px, bold), was ";"',
|
39
35
|
"a: b" => 'Properties aren\'t allowed at the root of a document.',
|
40
36
|
":a b" => 'Properties aren\'t allowed at the root of a document.',
|
41
37
|
"!" => 'Invalid variable: "!".',
|
42
|
-
"
|
38
|
+
"$a" => 'Invalid variable: "$a".',
|
43
39
|
"! a" => 'Invalid variable: "! a".',
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"a\n :
|
51
|
-
"a\n :
|
52
|
-
"
|
53
|
-
"
|
40
|
+
"$a b" => 'Invalid variable: "$a b".',
|
41
|
+
"$a: 1b + 2c" => "Incompatible units: 'c' and 'b'.",
|
42
|
+
"$a: 1b < 2c" => "Incompatible units: 'c' and 'b'.",
|
43
|
+
"$a: 1b > 2c" => "Incompatible units: 'c' and 'b'.",
|
44
|
+
"$a: 1b <= 2c" => "Incompatible units: 'c' and 'b'.",
|
45
|
+
"$a: 1b >= 2c" => "Incompatible units: 'c' and 'b'.",
|
46
|
+
"a\n b: 1b * 2c" => "2b*c isn't a valid CSS value.",
|
47
|
+
"a\n b: 1b % 2c" => "Cannot modulo by a number with units: 2c.",
|
48
|
+
"$a: 2px + #ccc" => "Cannot add a number with units (2px) to a color (#cccccc).",
|
49
|
+
"$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#cccccc).",
|
54
50
|
"& a\n :b c" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
|
55
51
|
"a\n :b\n c" => "Illegal nesting: Only properties may be nested beneath properties.",
|
56
52
|
"a,\n :b c" => ["Rules can\'t end in commas.", 1],
|
57
53
|
"a," => "Rules can\'t end in commas.",
|
58
|
-
"a,\n
|
59
|
-
"
|
54
|
+
"a,\n$b: 1" => ["Rules can\'t end in commas.", 1],
|
55
|
+
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
56
|
+
"@import foo.sass" => "File to import not found or unreadable: foo.sass.",
|
57
|
+
"a,\n$b: 1" => ["Rules can\'t end in commas.", 1],
|
58
|
+
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
60
59
|
"@import foo.sass" => <<MSG,
|
61
60
|
File to import not found or unreadable: foo.sass.
|
62
61
|
Load paths:
|
@@ -66,7 +65,7 @@ MSG
|
|
66
65
|
"@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.",
|
67
66
|
"foo\n @import templates/basic" => "Import directives may only be used at the root of a document.",
|
68
67
|
"foo\n @import #{File.dirname(__FILE__)}/templates/basic" => "Import directives may only be used at the root of a document.",
|
69
|
-
|
68
|
+
'$foo: "bar" "baz" !' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "!"},
|
70
69
|
"=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.",
|
71
70
|
"=foo\n :color red\n.bar\n +bang_bop" => "Undefined mixin 'bang_bop'.",
|
72
71
|
"=foo\n :color red\n.bar\n +bang-bop" => "Undefined mixin 'bang-bop'.",
|
@@ -82,28 +81,29 @@ MSG
|
|
82
81
|
"a\n b: c\na\n d: e" => ["The line was indented 2 levels deeper than the previous line.", 4],
|
83
82
|
"a\n b: c\n a\n d: e" => ["The line was indented 3 levels deeper than the previous line.", 4],
|
84
83
|
"a\n \tb: c" => ["Indentation can't use both tabs and spaces.", 2],
|
85
|
-
"=a(" => '
|
86
|
-
"=a(b)" => '
|
87
|
-
"=a(,)" => "
|
88
|
-
"=a(!)" =>
|
89
|
-
"=a(
|
84
|
+
"=a(" => 'Invalid CSS after "(": expected ")", was ""',
|
85
|
+
"=a(b)" => 'Invalid CSS after "(": expected ")", was "b)"',
|
86
|
+
"=a(,)" => 'Invalid CSS after "(": expected ")", was ",)"',
|
87
|
+
"=a(!)" => 'Invalid CSS after "(": expected ")", was "!)"',
|
88
|
+
"=a($foo bar)" => 'Invalid CSS after "($foo ": expected ")", was "bar)"',
|
90
89
|
"=foo\n bar: baz\n+foo" => ["Properties aren't allowed at the root of a document.", 2],
|
91
|
-
"a-\#{
|
92
|
-
"=a(
|
93
|
-
"=a(
|
94
|
-
"=a(
|
90
|
+
"a-\#{$b\n c: d" => ['Invalid CSS after "a-#{$b": expected "}", was ""', 1],
|
91
|
+
"=a($b = 1, $c)" => "Required argument $c must come before any optional arguments.",
|
92
|
+
"=a($b = 1)\n a: $b\ndiv\n +a(1,2)" => "Mixin a takes 1 argument but 2 were passed.",
|
93
|
+
"=a($b)\n a: $b\ndiv\n +a" => "Mixin a is missing parameter $b.",
|
95
94
|
"@else\n a\n b: c" => ["@else must come after @if.", 1],
|
96
95
|
"@if false\n@else foo" => "Invalid else directive '@else foo': expected 'if <expr>'.",
|
97
96
|
"@if false\n@else if " => "Invalid else directive '@else if': expected 'if <expr>'.",
|
98
|
-
"a\n !b
|
99
|
-
"
|
100
|
-
"
|
101
|
-
"c\n d
|
102
|
-
|
103
|
-
'@for
|
104
|
-
'@for
|
105
|
-
'@for
|
106
|
-
'@for
|
97
|
+
"a\n !b: 12\nc\n d: !b" => 'Undefined variable: "$b".',
|
98
|
+
"a\n $b: 12\nc\n d: $b" => 'Undefined variable: "$b".',
|
99
|
+
"=foo\n $b: 12\nc\n +foo\n d: $b" => 'Undefined variable: "$b".',
|
100
|
+
"c\n d: $b-foo" => 'Undefined variable: "$b-foo".',
|
101
|
+
"c\n d: $b_foo" => 'Undefined variable: "$b_foo".',
|
102
|
+
'@for $a from "foo" to 1' => '"foo" is not an integer.',
|
103
|
+
'@for $a from 1 to "2"' => '"2" is not an integer.',
|
104
|
+
'@for $a from 1 to "foo"' => '"foo" is not an integer.',
|
105
|
+
'@for $a from 1 to 1.232323' => '1.232 is not an integer.',
|
106
|
+
'@for $a from 1px to 3em' => "Incompatible units: 'em' and 'px'.",
|
107
107
|
'@if' => "Invalid if directive '@if': expected expression.",
|
108
108
|
'@while' => "Invalid while directive '@while': expected expression.",
|
109
109
|
'@debug' => "Invalid debug directive '@debug': expected expression.",
|
@@ -249,11 +249,11 @@ SASS
|
|
249
249
|
|
250
250
|
def test_mixin_exception
|
251
251
|
render(<<SASS)
|
252
|
-
=error-mixin(
|
253
|
-
color
|
252
|
+
=error-mixin($a)
|
253
|
+
color: $a * 1em * 1px
|
254
254
|
|
255
|
-
=outer-mixin(
|
256
|
-
+error-mixin(
|
255
|
+
=outer-mixin($a)
|
256
|
+
+error-mixin($a)
|
257
257
|
|
258
258
|
.error
|
259
259
|
+outer-mixin(12)
|
@@ -278,11 +278,11 @@ SASS
|
|
278
278
|
|
279
279
|
def test_mixin_callsite_exception
|
280
280
|
render(<<SASS)
|
281
|
-
=one-arg-mixin(
|
282
|
-
color
|
281
|
+
=one-arg-mixin($a)
|
282
|
+
color: $a
|
283
283
|
|
284
|
-
=outer-mixin(
|
285
|
-
+one-arg-mixin(
|
284
|
+
=outer-mixin($a)
|
285
|
+
+one-arg-mixin($a, 12)
|
286
286
|
|
287
287
|
.error
|
288
288
|
+outer-mixin(12)
|
@@ -365,11 +365,11 @@ CSS
|
|
365
365
|
def test_exception_css_with_mixins
|
366
366
|
opts = {:full_exception => true}
|
367
367
|
render(<<SASS, opts)
|
368
|
-
=error-mixin(
|
369
|
-
color
|
368
|
+
=error-mixin($a)
|
369
|
+
color: $a * 1em * 1px
|
370
370
|
|
371
|
-
=outer-mixin(
|
372
|
-
+error-mixin(
|
371
|
+
=outer-mixin($a)
|
372
|
+
+error-mixin($a)
|
373
373
|
|
374
374
|
.error
|
375
375
|
+outer-mixin(12)
|
@@ -382,11 +382,11 @@ Syntax error: 12em*px isn't a valid CSS value.
|
|
382
382
|
from line 5 of test_exception_css_with_mixins_inline.sass, in `outer-mixin'
|
383
383
|
from line 8 of test_exception_css_with_mixins_inline.sass
|
384
384
|
|
385
|
-
1: =error-mixin(
|
386
|
-
2: color
|
385
|
+
1: =error-mixin($a)
|
386
|
+
2: color: $a * 1em * 1px
|
387
387
|
3:
|
388
|
-
4: =outer-mixin(
|
389
|
-
5: +error-mixin(
|
388
|
+
4: =outer-mixin($a)
|
389
|
+
5: +error-mixin($a)
|
390
390
|
6:
|
391
391
|
7: .error
|
392
392
|
CSS
|
@@ -398,7 +398,7 @@ CSS
|
|
398
398
|
opts = {:full_exception => true}
|
399
399
|
render(<<SASS, opts)
|
400
400
|
.filler
|
401
|
-
stuff: stuff!
|
401
|
+
stuff: "stuff!"
|
402
402
|
|
403
403
|
a: b
|
404
404
|
|
@@ -412,7 +412,7 @@ Syntax error: Properties aren't allowed at the root of a document.
|
|
412
412
|
on line 4 of test_cssize_exception_css_inline.sass
|
413
413
|
|
414
414
|
1: .filler
|
415
|
-
2: stuff: stuff!
|
415
|
+
2: stuff: "stuff!"
|
416
416
|
3:
|
417
417
|
4: a: b
|
418
418
|
5:
|
@@ -436,7 +436,7 @@ CSS
|
|
436
436
|
|
437
437
|
def test_nonexistent_extensionless_import
|
438
438
|
assert_warning(<<WARN) do
|
439
|
-
WARNING: nonexistent.sass
|
439
|
+
WARNING: Neither nonexistent.sass nor .scss found. Using nonexistent.css instead.
|
440
440
|
This behavior is deprecated and will be removed in a future version.
|
441
441
|
If you really need nonexistent.css, import it explicitly.
|
442
442
|
WARN
|
@@ -458,18 +458,24 @@ WARN
|
|
458
458
|
end
|
459
459
|
|
460
460
|
def test_default_function
|
461
|
-
assert_equal(
|
462
|
-
|
461
|
+
assert_equal(<<CSS, render(<<SASS))
|
462
|
+
foo {
|
463
|
+
bar: url("foo.png"); }
|
464
|
+
CSS
|
465
|
+
foo
|
466
|
+
bar: url("foo.png")
|
467
|
+
SASS
|
468
|
+
assert_equal("foo {\n bar: url(); }\n", render("foo\n bar: url()\n"));
|
463
469
|
end
|
464
470
|
|
465
471
|
def test_string_minus
|
466
|
-
assert_equal("foo {\n bar: baz-boom-bat; }\n", render(%Q{foo\n bar
|
467
|
-
assert_equal("foo {\n bar: -baz-boom; }\n", render(%Q{foo\n bar
|
472
|
+
assert_equal("foo {\n bar: baz-boom-bat; }\n", render(%Q{foo\n bar: baz-boom-bat}))
|
473
|
+
assert_equal("foo {\n bar: -baz-boom; }\n", render(%Q{foo\n bar: -baz-boom}))
|
468
474
|
end
|
469
475
|
|
470
476
|
def test_string_div
|
471
|
-
assert_equal("foo {\n bar: baz/boom/bat; }\n", render(%Q{foo\n bar
|
472
|
-
assert_equal("foo {\n bar: /baz/boom; }\n", render(%Q{foo\n bar
|
477
|
+
assert_equal("foo {\n bar: baz/boom/bat; }\n", render(%Q{foo\n bar: baz/boom/bat}))
|
478
|
+
assert_equal("foo {\n bar: /baz/boom; }\n", render(%Q{foo\n bar: /baz/boom}))
|
473
479
|
end
|
474
480
|
|
475
481
|
def test_basic_multiline_selector
|
@@ -632,23 +638,23 @@ SASS
|
|
632
638
|
end
|
633
639
|
|
634
640
|
def test_debug_info
|
635
|
-
esc_file_name = Haml::Util.scope("test_debug_info_inline.sass")
|
641
|
+
esc_file_name = Sass::SCSS::RX.escape_ident(Haml::Util.scope("test_debug_info_inline.sass"))
|
636
642
|
|
637
643
|
assert_equal(<<CSS, render(<<SASS, :debug_info => true, :style => :compact))
|
638
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
644
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000032}}
|
639
645
|
foo bar { foo: bar; }
|
640
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
646
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000035}}
|
641
647
|
foo baz { blip: blop; }
|
642
648
|
|
643
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
649
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000039}}
|
644
650
|
floodle { flop: blop; }
|
645
651
|
|
646
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
652
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\0000318}}
|
647
653
|
bup { mix: on; }
|
648
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
654
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\0000315}}
|
649
655
|
bup mixin { moop: mup; }
|
650
656
|
|
651
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
657
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\0000322}}
|
652
658
|
bip hop, skip hop { a: b; }
|
653
659
|
CSS
|
654
660
|
foo
|
@@ -679,7 +685,7 @@ SASS
|
|
679
685
|
|
680
686
|
def test_debug_info_without_filename
|
681
687
|
assert_equal(<<CSS, Sass::Engine.new(<<SASS, :debug_info => true).render)
|
682
|
-
@media -sass-debug-info{filename{font-family:}line{font-family:\\
|
688
|
+
@media -sass-debug-info{filename{font-family:}line{font-family:\\000031}}
|
683
689
|
foo {
|
684
690
|
a: b; }
|
685
691
|
CSS
|
@@ -698,10 +704,10 @@ SASS
|
|
698
704
|
end
|
699
705
|
|
700
706
|
def test_debug_info_with_line_annotations
|
701
|
-
esc_file_name = Haml::Util.scope("test_debug_info_with_line_annotations_inline.sass")
|
707
|
+
esc_file_name = Sass::SCSS::RX.escape_ident(Haml::Util.scope("test_debug_info_with_line_annotations_inline.sass"))
|
702
708
|
|
703
709
|
assert_equal(<<CSS, render(<<SASS, :debug_info => true, :line_comments => true))
|
704
|
-
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\
|
710
|
+
@media -sass-debug-info{filename{font-family:file\\:\\/\\/#{esc_file_name}}line{font-family:\\000031}}
|
705
711
|
foo {
|
706
712
|
a: b; }
|
707
713
|
CSS
|
@@ -748,15 +754,99 @@ foo
|
|
748
754
|
SASS
|
749
755
|
end
|
750
756
|
|
751
|
-
def
|
752
|
-
|
753
|
-
|
757
|
+
def test_equals_warning_for_properties
|
758
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
759
|
+
DEPRECATION WARNING:
|
760
|
+
On line 3, character 3 of 'test_equals_warning_for_properties_inline.sass'
|
761
|
+
Setting properties with = has been deprecated and will be removed in version 3.2.
|
762
|
+
Use "a: $var" instead.
|
763
|
+
|
764
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
765
|
+
WARN
|
766
|
+
foo {
|
767
|
+
a: 2px 3px; }
|
768
|
+
CSS
|
769
|
+
$var: 2px 3px
|
770
|
+
foo
|
771
|
+
a = $var
|
772
|
+
SASS
|
773
|
+
end
|
774
|
+
|
775
|
+
def test_equals_warning_for_dynamic_properties
|
776
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
777
|
+
DEPRECATION WARNING:
|
778
|
+
On line 4, character 3 of 'test_equals_warning_for_dynamic_properties_inline.sass'
|
779
|
+
Setting properties with = has been deprecated and will be removed in version 3.2.
|
780
|
+
Use "a-\#{$i}: $var" instead.
|
781
|
+
|
782
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
783
|
+
WARN
|
784
|
+
foo {
|
785
|
+
a-12: 2px 3px; }
|
786
|
+
CSS
|
787
|
+
$var: 2px 3px
|
788
|
+
$i: 12
|
789
|
+
foo
|
790
|
+
a-\#{$i} = $var
|
791
|
+
SASS
|
792
|
+
end
|
793
|
+
|
794
|
+
def test_equals_warning_for_property_with_string
|
795
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
796
|
+
DEPRECATION WARNING:
|
797
|
+
On line 2, character 3 of 'test_equals_warning_for_property_with_string_inline.sass'
|
798
|
+
Setting properties with = has been deprecated and will be removed in version 3.2.
|
799
|
+
Use "a: foo" instead.
|
800
|
+
|
801
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
802
|
+
WARN
|
803
|
+
foo {
|
804
|
+
a: foo; }
|
805
|
+
CSS
|
806
|
+
foo
|
807
|
+
a = "foo"
|
808
|
+
SASS
|
809
|
+
end
|
810
|
+
|
811
|
+
def test_equals_warning_for_property_with_division
|
812
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
813
|
+
DEPRECATION WARNING:
|
814
|
+
On line 2, character 3 of 'test_equals_warning_for_property_with_division_inline.sass'
|
815
|
+
Setting properties with = has been deprecated and will be removed in version 3.2.
|
816
|
+
Use "a: (1px / 2px)" instead.
|
817
|
+
|
818
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
819
|
+
WARN
|
820
|
+
foo {
|
821
|
+
a: 0.5; }
|
822
|
+
CSS
|
823
|
+
foo
|
824
|
+
a = 1px/2px
|
825
|
+
SASS
|
826
|
+
end
|
827
|
+
|
828
|
+
def test_guarded_assign
|
829
|
+
assert_equal("foo {\n a: b; }\n", render(%Q{$foo: b\n$foo: c !default\nfoo\n a: $foo}))
|
830
|
+
assert_equal("foo {\n a: b; }\n", render(%Q{$foo: b !default\nfoo\n a: $foo}))
|
754
831
|
end
|
755
832
|
|
756
833
|
def test_mixins
|
757
834
|
renders_correctly "mixins", { :style => :expanded }
|
758
835
|
end
|
759
836
|
|
837
|
+
def test_directive_style_mixins
|
838
|
+
assert_equal <<CSS, render(<<SASS)
|
839
|
+
bar {
|
840
|
+
prop: baz; }
|
841
|
+
CSS
|
842
|
+
@mixin foo($arg)
|
843
|
+
prop: $arg
|
844
|
+
|
845
|
+
bar
|
846
|
+
@include foo(baz)
|
847
|
+
SASS
|
848
|
+
end
|
849
|
+
|
760
850
|
def test_mixins_dont_interfere_with_sibling_combinator
|
761
851
|
assert_equal("foo + bar {\n a: b; }\nfoo + baz {\n c: d; }\n",
|
762
852
|
render("foo\n +\n bar\n a: b\n baz\n c: d"))
|
@@ -764,33 +854,33 @@ SASS
|
|
764
854
|
|
765
855
|
def test_mixin_args
|
766
856
|
assert_equal("blat {\n baz: hi; }\n", render(<<SASS))
|
767
|
-
=foo(
|
768
|
-
baz
|
857
|
+
=foo($bar)
|
858
|
+
baz: $bar
|
769
859
|
blat
|
770
|
-
+foo(
|
860
|
+
+foo(hi)
|
771
861
|
SASS
|
772
862
|
assert_equal("blat {\n baz: 3; }\n", render(<<SASS))
|
773
|
-
=foo(
|
774
|
-
baz
|
863
|
+
=foo($a, $b)
|
864
|
+
baz: $a + $b
|
775
865
|
blat
|
776
866
|
+foo(1, 2)
|
777
867
|
SASS
|
778
868
|
assert_equal("blat {\n baz: 4;\n baz: 3;\n baz: 5;\n bang: 3; }\n", render(<<SASS))
|
779
|
-
=foo(
|
780
|
-
baz
|
781
|
-
|
869
|
+
=foo($c: (6 + 4) / 2)
|
870
|
+
baz: $c
|
871
|
+
$c: 3
|
782
872
|
blat
|
783
|
-
+foo(
|
784
|
-
+foo((
|
873
|
+
+foo($c + 1)
|
874
|
+
+foo(($c + 3)/2)
|
785
875
|
+foo
|
786
|
-
bang
|
876
|
+
bang: $c
|
787
877
|
SASS
|
788
878
|
end
|
789
879
|
|
790
880
|
def test_default_values_for_mixin_arguments
|
791
881
|
assert_equal("white {\n color: white; }\n\nblack {\n color: black; }\n", render(<<SASS))
|
792
|
-
=foo(
|
793
|
-
:color
|
882
|
+
=foo($a: #FFF)
|
883
|
+
:color $a
|
794
884
|
white
|
795
885
|
+foo
|
796
886
|
black
|
@@ -812,11 +902,11 @@ three {
|
|
812
902
|
padding: 2px;
|
813
903
|
margin: 3px; }
|
814
904
|
CSS
|
815
|
-
|
816
|
-
=foo(
|
817
|
-
:color
|
818
|
-
:padding
|
819
|
-
:margin
|
905
|
+
$a: 5px
|
906
|
+
=foo($a, $b: 1px, $c: 3px + $b)
|
907
|
+
:color $a
|
908
|
+
:padding $b
|
909
|
+
:margin $c
|
820
910
|
one
|
821
911
|
+foo(#fff)
|
822
912
|
two
|
@@ -844,23 +934,56 @@ a
|
|
844
934
|
SASS
|
845
935
|
end
|
846
936
|
|
937
|
+
def test_equals_warning_for_mixin_args
|
938
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
939
|
+
DEPRECATION WARNING:
|
940
|
+
On line 1, character 6 of 'test_equals_warning_for_mixin_args_inline.sass'
|
941
|
+
Setting mixin argument defaults with = has been deprecated and will be removed in version 3.2.
|
942
|
+
Use "$arg: 1px" instead.
|
943
|
+
|
944
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
945
|
+
WARN
|
946
|
+
bar {
|
947
|
+
a: 1px; }
|
948
|
+
CSS
|
949
|
+
=foo($arg = 1px)
|
950
|
+
a: $arg
|
951
|
+
|
952
|
+
bar
|
953
|
+
+foo
|
954
|
+
SASS
|
955
|
+
end
|
956
|
+
|
957
|
+
def test_css_identifier_mixin
|
958
|
+
assert_equal(<<CSS, render(<<SASS))
|
959
|
+
a {
|
960
|
+
foo: 12; }
|
961
|
+
CSS
|
962
|
+
=\\{foo\\(12\\)($a)
|
963
|
+
foo: $a
|
964
|
+
|
965
|
+
a
|
966
|
+
+\\{foo\\(12\\)(12)
|
967
|
+
SASS
|
968
|
+
end
|
969
|
+
|
847
970
|
def test_interpolation
|
848
971
|
assert_equal("a-1 {\n b-2-3: c-3; }\n", render(<<SASS))
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
a-\#{
|
853
|
-
b-\#{
|
972
|
+
$a: 1
|
973
|
+
$b: 2
|
974
|
+
$c: 3
|
975
|
+
a-\#{$a}
|
976
|
+
b-\#{$b}-\#{$c}: c-\#{$a + $b}
|
854
977
|
SASS
|
855
978
|
end
|
856
979
|
|
857
980
|
def test_if_directive
|
858
981
|
assert_equal("a {\n b: 1; }\n", render(<<SASS))
|
859
|
-
|
982
|
+
$var: true
|
860
983
|
a
|
861
|
-
@if
|
984
|
+
@if $var
|
862
985
|
b: 1
|
863
|
-
@if not
|
986
|
+
@if not $var
|
864
987
|
b: 2
|
865
988
|
SASS
|
866
989
|
end
|
@@ -891,14 +1014,38 @@ b-3 {
|
|
891
1014
|
b-4 {
|
892
1015
|
j-1: 3; }
|
893
1016
|
CSS
|
894
|
-
|
895
|
-
@for
|
896
|
-
a-\#{
|
897
|
-
2i
|
1017
|
+
$a: 3
|
1018
|
+
@for $i from 0 to $a + 1
|
1019
|
+
a-\#{$i}
|
1020
|
+
2i: 2 * $i
|
1021
|
+
|
1022
|
+
@for $j from 1 through 4
|
1023
|
+
b-\#{$j}
|
1024
|
+
j-1: $j - 1
|
1025
|
+
SASS
|
1026
|
+
end
|
1027
|
+
|
1028
|
+
def test_for_with_bang_var
|
1029
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
1030
|
+
DEPRECATION WARNING:
|
1031
|
+
On line 1, character 6 of 'test_for_with_bang_var_inline.sass'
|
1032
|
+
Variables with ! have been deprecated and will be removed in version 3.2.
|
1033
|
+
Use "$bar" instead.
|
1034
|
+
|
1035
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
1036
|
+
WARN
|
1037
|
+
a-0 {
|
1038
|
+
b: c; }
|
898
1039
|
|
899
|
-
|
900
|
-
b
|
901
|
-
|
1040
|
+
a-1 {
|
1041
|
+
b: c; }
|
1042
|
+
|
1043
|
+
a-2 {
|
1044
|
+
b: c; }
|
1045
|
+
CSS
|
1046
|
+
@for !bar from 0 to 3
|
1047
|
+
a-\#{$bar}
|
1048
|
+
b: c
|
902
1049
|
SASS
|
903
1050
|
end
|
904
1051
|
|
@@ -919,11 +1066,11 @@ a-2 {
|
|
919
1066
|
a-1 {
|
920
1067
|
blooble: gloop; }
|
921
1068
|
CSS
|
922
|
-
|
923
|
-
@while
|
924
|
-
a-\#{
|
1069
|
+
$a: 5
|
1070
|
+
@while $a != 0
|
1071
|
+
a-\#{$a}
|
925
1072
|
blooble: gloop
|
926
|
-
|
1073
|
+
$a: $a - 1
|
927
1074
|
SASS
|
928
1075
|
end
|
929
1076
|
|
@@ -973,11 +1120,83 @@ a {
|
|
973
1120
|
b: 1;
|
974
1121
|
c: 2; }
|
975
1122
|
CSS
|
976
|
-
|
1123
|
+
$a: 1
|
977
1124
|
a
|
978
|
-
b
|
979
|
-
|
980
|
-
c
|
1125
|
+
b: $a
|
1126
|
+
$a: 2
|
1127
|
+
c: $a
|
1128
|
+
SASS
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
def test_bang_variables
|
1132
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
1133
|
+
DEPRECATION WARNING:
|
1134
|
+
On line 1, character 1 of 'test_bang_variables_inline.sass'
|
1135
|
+
Variables with ! have been deprecated and will be removed in version 3.2.
|
1136
|
+
Use "$bang-var" instead.
|
1137
|
+
|
1138
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
1139
|
+
WARN
|
1140
|
+
foo {
|
1141
|
+
a: 1px; }
|
1142
|
+
CSS
|
1143
|
+
!bang-var: 1px
|
1144
|
+
foo
|
1145
|
+
a: $bang-var
|
1146
|
+
SASS
|
1147
|
+
|
1148
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
1149
|
+
DEPRECATION WARNING:
|
1150
|
+
On line 3, character 6 of 'test_bang_variables_inline.sass'
|
1151
|
+
Variables with ! have been deprecated and will be removed in version 3.2.
|
1152
|
+
Use "$dollar-var" instead.
|
1153
|
+
|
1154
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
1155
|
+
WARN
|
1156
|
+
foo {
|
1157
|
+
a: 1px; }
|
1158
|
+
CSS
|
1159
|
+
$dollar-var: 1px
|
1160
|
+
foo
|
1161
|
+
a: !dollar-var
|
1162
|
+
SASS
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
def test_equals_warning_for_variables
|
1166
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
1167
|
+
DEPRECATION WARNING:
|
1168
|
+
On line 2, character 1 of 'test_equals_warning_for_variables_inline.sass'
|
1169
|
+
Setting variables with = has been deprecated and will be removed in version 3.2.
|
1170
|
+
Use "$equals-var: 2px 3px" instead.
|
1171
|
+
|
1172
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
1173
|
+
WARN
|
1174
|
+
foo {
|
1175
|
+
a: 2px 3px; }
|
1176
|
+
CSS
|
1177
|
+
|
1178
|
+
$equals-var = 2px 3px
|
1179
|
+
foo
|
1180
|
+
a: $equals-var
|
1181
|
+
SASS
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
def test_equals_warning_for_guarded_variables
|
1185
|
+
assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
|
1186
|
+
DEPRECATION WARNING:
|
1187
|
+
On line 2, character 1 of 'test_equals_warning_for_guarded_variables_inline.sass'
|
1188
|
+
Setting variable defaults with ||= has been deprecated and will be removed in version 3.2.
|
1189
|
+
Use "$equals-var: 2px 3px !default" instead.
|
1190
|
+
|
1191
|
+
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
1192
|
+
WARN
|
1193
|
+
foo {
|
1194
|
+
a: 2px 3px; }
|
1195
|
+
CSS
|
1196
|
+
|
1197
|
+
$equals-var ||= 2px 3px
|
1198
|
+
foo
|
1199
|
+
a: $equals-var
|
981
1200
|
SASS
|
982
1201
|
end
|
983
1202
|
|
@@ -991,18 +1210,18 @@ a {
|
|
991
1210
|
b {
|
992
1211
|
d: 17; }
|
993
1212
|
CSS
|
994
|
-
|
1213
|
+
$i: 12
|
995
1214
|
a
|
996
|
-
@for
|
997
|
-
b-\#{
|
998
|
-
d
|
1215
|
+
@for $i from 1 through 2
|
1216
|
+
b-\#{$i}: c
|
1217
|
+
d: $i
|
999
1218
|
|
1000
1219
|
=foo
|
1001
|
-
|
1220
|
+
$i: 17
|
1002
1221
|
|
1003
1222
|
b
|
1004
1223
|
+foo
|
1005
|
-
d
|
1224
|
+
d: $i
|
1006
1225
|
SASS
|
1007
1226
|
end
|
1008
1227
|
|
@@ -1015,22 +1234,45 @@ d {
|
|
1015
1234
|
e: 13;
|
1016
1235
|
f: foobar; }
|
1017
1236
|
CSS
|
1018
|
-
|
1019
|
-
|
1237
|
+
$var-hyphen: 12
|
1238
|
+
$var_under: foo
|
1020
1239
|
|
1021
1240
|
a
|
1022
|
-
|
1023
|
-
|
1241
|
+
$var_hyphen: 1 + $var_hyphen
|
1242
|
+
$var-under: $var-under + bar
|
1024
1243
|
b: c
|
1025
1244
|
|
1026
1245
|
d
|
1027
|
-
e
|
1028
|
-
f
|
1246
|
+
e: $var-hyphen
|
1247
|
+
f: $var_under
|
1248
|
+
SASS
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
def test_css_identifier_variable
|
1252
|
+
assert_equal(<<CSS, render(<<SASS))
|
1253
|
+
a {
|
1254
|
+
b: 12; }
|
1255
|
+
CSS
|
1256
|
+
$\\{foo\\(12\\): 12
|
1257
|
+
|
1258
|
+
a
|
1259
|
+
b: $\\{foo\\(12\\)
|
1260
|
+
SASS
|
1261
|
+
end
|
1262
|
+
|
1263
|
+
def test_important
|
1264
|
+
assert_equal(<<CSS, render(<<SASS))
|
1265
|
+
a {
|
1266
|
+
b: 12px !important; }
|
1267
|
+
CSS
|
1268
|
+
$foo: 12px
|
1269
|
+
a
|
1270
|
+
b: $foo !important
|
1029
1271
|
SASS
|
1030
1272
|
end
|
1031
1273
|
|
1032
1274
|
def test_argument_error
|
1033
|
-
assert_raise(Sass::SyntaxError) { render("a\n b
|
1275
|
+
assert_raise(Sass::SyntaxError) { render("a\n b: hsl(1)") }
|
1034
1276
|
end
|
1035
1277
|
|
1036
1278
|
def test_comments_at_the_top_of_a_document
|
@@ -1136,25 +1378,7 @@ SASS
|
|
1136
1378
|
def test_empty_selector_warning
|
1137
1379
|
assert_warning(<<END) {render("foo bar")}
|
1138
1380
|
WARNING on line 1 of test_empty_selector_warning_inline.sass:
|
1139
|
-
|
1140
|
-
END
|
1141
|
-
|
1142
|
-
assert_warning(<<END) {render(<<SASS)}
|
1143
|
-
WARNING on line 3 of test_empty_selector_warning_inline.sass:
|
1144
|
-
Selector
|
1145
|
-
foo, bar, baz,
|
1146
|
-
bang, bip, bop
|
1147
|
-
doesn't have any properties and will not be rendered.
|
1148
|
-
END
|
1149
|
-
|
1150
|
-
|
1151
|
-
foo, bar, baz,
|
1152
|
-
bang, bip, bop
|
1153
|
-
SASS
|
1154
|
-
|
1155
|
-
assert_warning(<<END) {render("foo bar", :filename => nil)}
|
1156
|
-
WARNING on line 1:
|
1157
|
-
Selector "foo bar" doesn't have any properties and will not be rendered.
|
1381
|
+
This selector doesn't have any properties and will not be rendered.
|
1158
1382
|
END
|
1159
1383
|
end
|
1160
1384
|
|
@@ -1189,6 +1413,302 @@ foo
|
|
1189
1413
|
SASS
|
1190
1414
|
end
|
1191
1415
|
|
1416
|
+
def test_interpolation_in_raw_functions
|
1417
|
+
assert_equal(<<CSS, render(<<SASS))
|
1418
|
+
foo {
|
1419
|
+
filter: progid:Microsoft.foo.bar.Baz(flip=foobar, bang=#00ff00cc); }
|
1420
|
+
CSS
|
1421
|
+
foo
|
1422
|
+
filter: progid:Microsoft.foo.bar.Baz(flip=\#{foo + bar}, bang=#00ff00cc)
|
1423
|
+
SASS
|
1424
|
+
end
|
1425
|
+
|
1426
|
+
# SassScript string behavior
|
1427
|
+
|
1428
|
+
def test_plus_preserves_quotedness
|
1429
|
+
assert_equal(<<CSS, render(<<SASS))
|
1430
|
+
foo {
|
1431
|
+
a: "foo1";
|
1432
|
+
b: "1foo";
|
1433
|
+
c: foo1;
|
1434
|
+
d: 1foo;
|
1435
|
+
e: "foobar";
|
1436
|
+
f: foobar; }
|
1437
|
+
CSS
|
1438
|
+
foo
|
1439
|
+
a: "foo" + 1
|
1440
|
+
b: 1 + "foo"
|
1441
|
+
c: foo + 1
|
1442
|
+
d: 1 + foo
|
1443
|
+
e: "foo" + bar
|
1444
|
+
f: foo + "bar"
|
1445
|
+
SASS
|
1446
|
+
end
|
1447
|
+
|
1448
|
+
def test_colon_properties_preserve_quotedness
|
1449
|
+
assert_equal(<<CSS, render(<<SASS))
|
1450
|
+
foo {
|
1451
|
+
a: "foo";
|
1452
|
+
b: bar;
|
1453
|
+
c: "foo" bar;
|
1454
|
+
d: foo, "bar"; }
|
1455
|
+
CSS
|
1456
|
+
foo
|
1457
|
+
a: "foo"
|
1458
|
+
b: bar
|
1459
|
+
c: "foo" bar
|
1460
|
+
d: foo, "bar"
|
1461
|
+
SASS
|
1462
|
+
end
|
1463
|
+
|
1464
|
+
def test_colon_variables_preserve_quotedness
|
1465
|
+
assert_equal(<<CSS, render(<<SASS))
|
1466
|
+
foo {
|
1467
|
+
a: "foo";
|
1468
|
+
b: bar; }
|
1469
|
+
CSS
|
1470
|
+
$a: "foo"
|
1471
|
+
$b: bar
|
1472
|
+
|
1473
|
+
foo
|
1474
|
+
a: $a
|
1475
|
+
b: $b
|
1476
|
+
SASS
|
1477
|
+
end
|
1478
|
+
|
1479
|
+
def test_colon_args_preserve_quotedness
|
1480
|
+
assert_equal(<<CSS, render(<<SASS))
|
1481
|
+
foo {
|
1482
|
+
a: "foo";
|
1483
|
+
b: bar;
|
1484
|
+
c: "foo" bar;
|
1485
|
+
d: foo, "bar"; }
|
1486
|
+
CSS
|
1487
|
+
=foo($a: "foo", $b: bar, $c: "foo" bar, $d: (foo, "bar"))
|
1488
|
+
foo
|
1489
|
+
a: $a
|
1490
|
+
b: $b
|
1491
|
+
c: $c
|
1492
|
+
d: $d
|
1493
|
+
|
1494
|
+
+foo
|
1495
|
+
SASS
|
1496
|
+
end
|
1497
|
+
|
1498
|
+
def test_interpolation_unquotes_strings
|
1499
|
+
assert_equal(<<CSS, render(<<SASS))
|
1500
|
+
.foo-bar {
|
1501
|
+
a: b; }
|
1502
|
+
CSS
|
1503
|
+
.foo-\#{"bar"}
|
1504
|
+
a: b
|
1505
|
+
SASS
|
1506
|
+
|
1507
|
+
assert_equal(<<CSS, render(<<SASS))
|
1508
|
+
.foo {
|
1509
|
+
a: b c; }
|
1510
|
+
CSS
|
1511
|
+
.foo
|
1512
|
+
a: b \#{"c"}
|
1513
|
+
SASS
|
1514
|
+
end
|
1515
|
+
|
1516
|
+
def test_interpolation_unquotes_strings_in_vars
|
1517
|
+
assert_equal(<<CSS, render(<<SASS))
|
1518
|
+
.foo-bar {
|
1519
|
+
a: b; }
|
1520
|
+
CSS
|
1521
|
+
$var: "bar"
|
1522
|
+
|
1523
|
+
.foo-\#{$var}
|
1524
|
+
a: b
|
1525
|
+
SASS
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
def test_interpolation_doesnt_deep_unquote_strings
|
1529
|
+
assert_equal(<<CSS, render(<<SASS))
|
1530
|
+
.foo-"bar" "baz" {
|
1531
|
+
a: b; }
|
1532
|
+
CSS
|
1533
|
+
.foo-\#{"bar" "baz"}
|
1534
|
+
a: b
|
1535
|
+
SASS
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
# Deprecated equals behavior
|
1539
|
+
|
1540
|
+
def test_equals_properties_unquote_strings
|
1541
|
+
silence_warnings do
|
1542
|
+
assert_equal(<<CSS, render(<<SASS))
|
1543
|
+
foo {
|
1544
|
+
a: foo;
|
1545
|
+
b: bar;
|
1546
|
+
c: foo bar;
|
1547
|
+
d: foo, bar; }
|
1548
|
+
CSS
|
1549
|
+
foo
|
1550
|
+
a= "foo"
|
1551
|
+
b= bar
|
1552
|
+
c= "foo" bar
|
1553
|
+
d= foo, "bar"
|
1554
|
+
SASS
|
1555
|
+
end
|
1556
|
+
end
|
1557
|
+
|
1558
|
+
def test_equals_properties_unquote_value
|
1559
|
+
silence_warnings do
|
1560
|
+
assert_equal(<<CSS, render(<<SASS))
|
1561
|
+
foo {
|
1562
|
+
a: foo; }
|
1563
|
+
CSS
|
1564
|
+
$var: "foo"
|
1565
|
+
|
1566
|
+
foo
|
1567
|
+
a= $var
|
1568
|
+
SASS
|
1569
|
+
end
|
1570
|
+
end
|
1571
|
+
|
1572
|
+
def test_equals_properties_deep_unquote_vars
|
1573
|
+
silence_warnings do
|
1574
|
+
assert_equal(<<CSS, render(<<SASS))
|
1575
|
+
foo {
|
1576
|
+
a: foo bar;
|
1577
|
+
b: bar foo; }
|
1578
|
+
CSS
|
1579
|
+
$var: "foo"
|
1580
|
+
|
1581
|
+
foo
|
1582
|
+
a= $var "bar"
|
1583
|
+
b= "bar" $var
|
1584
|
+
SASS
|
1585
|
+
end
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
def test_equals_vars_unquote_strings
|
1589
|
+
silence_warnings do
|
1590
|
+
assert_equal(<<CSS, render(<<SASS))
|
1591
|
+
foo {
|
1592
|
+
a: foo;
|
1593
|
+
b: bar;
|
1594
|
+
c: foo bar;
|
1595
|
+
d: foo, bar; }
|
1596
|
+
CSS
|
1597
|
+
$a = "foo"
|
1598
|
+
$b = bar
|
1599
|
+
$c = "foo" bar
|
1600
|
+
$d = foo, "bar"
|
1601
|
+
|
1602
|
+
foo
|
1603
|
+
a: $a
|
1604
|
+
b: $b
|
1605
|
+
c: $c
|
1606
|
+
d: $d
|
1607
|
+
SASS
|
1608
|
+
end
|
1609
|
+
end
|
1610
|
+
|
1611
|
+
def test_equals_vars_unquote_value
|
1612
|
+
silence_warnings do
|
1613
|
+
assert_equal(<<CSS, render(<<SASS))
|
1614
|
+
foo {
|
1615
|
+
a: foo; }
|
1616
|
+
CSS
|
1617
|
+
$var1: "foo"
|
1618
|
+
$var2 = $var1
|
1619
|
+
|
1620
|
+
foo
|
1621
|
+
a: $var2
|
1622
|
+
SASS
|
1623
|
+
end
|
1624
|
+
end
|
1625
|
+
|
1626
|
+
def test_equals_vars_deep_unquote_vars
|
1627
|
+
silence_warnings do
|
1628
|
+
assert_equal(<<CSS, render(<<SASS))
|
1629
|
+
foo {
|
1630
|
+
a: foo bar;
|
1631
|
+
b: bar foo; }
|
1632
|
+
CSS
|
1633
|
+
$var: "foo"
|
1634
|
+
$a = $var "bar"
|
1635
|
+
$b = "bar" $var
|
1636
|
+
|
1637
|
+
foo
|
1638
|
+
a: $a
|
1639
|
+
b: $b
|
1640
|
+
SASS
|
1641
|
+
end
|
1642
|
+
end
|
1643
|
+
|
1644
|
+
def test_equals_args_unquote_strings
|
1645
|
+
silence_warnings do
|
1646
|
+
assert_equal(<<CSS, render(<<SASS))
|
1647
|
+
foo {
|
1648
|
+
a: foo;
|
1649
|
+
b: bar;
|
1650
|
+
c: foo bar;
|
1651
|
+
d: foo, bar; }
|
1652
|
+
CSS
|
1653
|
+
=foo($a = "foo", $b = bar, $c = "foo" bar, $d = (foo, "bar"))
|
1654
|
+
foo
|
1655
|
+
a: $a
|
1656
|
+
b: $b
|
1657
|
+
c: $c
|
1658
|
+
d: $d
|
1659
|
+
|
1660
|
+
+foo
|
1661
|
+
SASS
|
1662
|
+
end
|
1663
|
+
end
|
1664
|
+
|
1665
|
+
def test_equals_args_unquote_value
|
1666
|
+
silence_warnings do
|
1667
|
+
assert_equal(<<CSS, render(<<SASS))
|
1668
|
+
foo {
|
1669
|
+
a: foo; }
|
1670
|
+
CSS
|
1671
|
+
$var1: "foo"
|
1672
|
+
|
1673
|
+
=foo($var2 = $var1)
|
1674
|
+
foo
|
1675
|
+
a: $var2
|
1676
|
+
|
1677
|
+
+foo
|
1678
|
+
SASS
|
1679
|
+
end
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
def test_equals_args_deep_unquote_vars
|
1683
|
+
silence_warnings do
|
1684
|
+
assert_equal(<<CSS, render(<<SASS))
|
1685
|
+
foo {
|
1686
|
+
a: foo bar;
|
1687
|
+
b: bar foo; }
|
1688
|
+
CSS
|
1689
|
+
$var: "foo"
|
1690
|
+
=foo($a = $var "bar", $b = "bar" $var)
|
1691
|
+
foo
|
1692
|
+
a: $a
|
1693
|
+
b: $b
|
1694
|
+
|
1695
|
+
+foo
|
1696
|
+
SASS
|
1697
|
+
end
|
1698
|
+
end
|
1699
|
+
|
1700
|
+
def test_equals_properties_force_division
|
1701
|
+
silence_warnings do
|
1702
|
+
assert_equal(<<CSS, render(<<SASS))
|
1703
|
+
foo {
|
1704
|
+
a: 0.5; }
|
1705
|
+
CSS
|
1706
|
+
foo
|
1707
|
+
a = 1px/2px
|
1708
|
+
SASS
|
1709
|
+
end
|
1710
|
+
end
|
1711
|
+
|
1192
1712
|
# Regression tests
|
1193
1713
|
|
1194
1714
|
def test_parens_in_mixins
|
@@ -1197,9 +1717,9 @@ SASS
|
|
1197
1717
|
color: #01ff7f;
|
1198
1718
|
background-color: #000102; }
|
1199
1719
|
CSS
|
1200
|
-
=foo(
|
1201
|
-
color
|
1202
|
-
background-color
|
1720
|
+
=foo($c1, $c2: rgb(0, 1, 2))
|
1721
|
+
color: $c1
|
1722
|
+
background-color: $c2
|
1203
1723
|
|
1204
1724
|
.foo
|
1205
1725
|
+foo(rgb(1,255,127))
|
@@ -1224,7 +1744,7 @@ SOURCE
|
|
1224
1744
|
RESULT
|
1225
1745
|
.box
|
1226
1746
|
:border
|
1227
|
-
|
1747
|
+
/* :color black
|
1228
1748
|
:style solid
|
1229
1749
|
SOURCE
|
1230
1750
|
|
@@ -1310,7 +1830,7 @@ a {
|
|
1310
1830
|
b: nested; }
|
1311
1831
|
CSS
|
1312
1832
|
a
|
1313
|
-
b
|
1833
|
+
b: option("style")
|
1314
1834
|
SASS
|
1315
1835
|
end
|
1316
1836
|
|