sass 3.2.19 → 3.3.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING +1 -1
- data/MIT-LICENSE +2 -2
- data/README.md +13 -14
- data/REVISION +1 -1
- data/Rakefile +4 -6
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -6
- data/bin/sass-convert +1 -6
- data/bin/scss +1 -6
- data/lib/sass/cache_stores/base.rb +0 -2
- data/lib/sass/cache_stores/chain.rb +1 -1
- data/lib/sass/cache_stores/filesystem.rb +3 -6
- data/lib/sass/callbacks.rb +1 -1
- data/lib/sass/css.rb +1 -1
- data/lib/sass/engine.rb +4 -11
- data/lib/sass/error.rb +2 -2
- data/lib/sass/exec.rb +10 -40
- data/lib/sass/importers/filesystem.rb +15 -52
- data/lib/sass/logger/log_level.rb +3 -3
- data/lib/sass/media.rb +4 -1
- data/lib/sass/plugin.rb +1 -2
- data/lib/sass/plugin/compiler.rb +18 -40
- data/lib/sass/plugin/staleness_checker.rb +5 -21
- data/lib/sass/railtie.rb +0 -1
- data/lib/sass/script/funcall.rb +8 -62
- data/lib/sass/script/functions.rb +457 -557
- data/lib/sass/script/lexer.rb +30 -25
- data/lib/sass/script/list.rb +1 -2
- data/lib/sass/script/literal.rb +18 -0
- data/lib/sass/script/null.rb +1 -4
- data/lib/sass/script/operation.rb +1 -0
- data/lib/sass/script/parser.rb +35 -42
- data/lib/sass/script/string.rb +1 -1
- data/lib/sass/script/unary_operation.rb +3 -8
- data/lib/sass/scss/parser.rb +14 -33
- data/lib/sass/scss/rx.rb +10 -3
- data/lib/sass/selector.rb +16 -19
- data/lib/sass/selector/sequence.rb +7 -16
- data/lib/sass/selector/simple.rb +1 -1
- data/lib/sass/selector/simple_sequence.rb +15 -25
- data/lib/sass/tree/comment_node.rb +2 -2
- data/lib/sass/tree/import_node.rb +2 -9
- data/lib/sass/tree/visitors/check_nesting.rb +2 -3
- data/lib/sass/tree/visitors/convert.rb +4 -9
- data/lib/sass/tree/visitors/cssize.rb +15 -36
- data/lib/sass/tree/visitors/perform.rb +20 -23
- data/lib/sass/tree/visitors/set_options.rb +0 -8
- data/lib/sass/tree/visitors/to_css.rb +1 -0
- data/lib/sass/util.rb +2 -120
- data/lib/sass/util/multibyte_string_scanner.rb +8 -29
- data/test/sass/conversion_test.rb +8 -33
- data/test/sass/css2sass_test.rb +0 -19
- data/test/sass/engine_test.rb +17 -129
- data/test/sass/extend_test.rb +24 -169
- data/test/sass/functions_test.rb +73 -93
- data/test/sass/plugin_test.rb +11 -72
- data/test/sass/script_conversion_test.rb +0 -14
- data/test/sass/script_test.rb +1 -40
- data/test/sass/scss/css_test.rb +3 -44
- data/test/sass/scss/scss_test.rb +3 -134
- data/test/sass/util_test.rb +0 -93
- data/vendor/listen/CHANGELOG.md +2 -83
- data/vendor/listen/Gemfile +1 -8
- data/vendor/listen/Guardfile +1 -1
- data/vendor/listen/LICENSE +1 -1
- data/vendor/listen/README.md +5 -8
- data/vendor/listen/lib/listen.rb +5 -7
- data/vendor/listen/lib/listen/adapter.rb +29 -76
- data/vendor/listen/lib/listen/adapters/darwin.rb +10 -11
- data/vendor/listen/lib/listen/adapters/linux.rb +30 -33
- data/vendor/listen/lib/listen/adapters/polling.rb +1 -2
- data/vendor/listen/lib/listen/adapters/windows.rb +21 -27
- data/vendor/listen/lib/listen/directory_record.rb +10 -63
- data/vendor/listen/lib/listen/listener.rb +0 -22
- data/vendor/listen/lib/listen/multi_listener.rb +0 -22
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/listen.gemspec +4 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +4 -45
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -6
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -6
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +1 -7
- data/vendor/listen/spec/listen/directory_record_spec.rb +4 -91
- data/vendor/listen/spec/listen/listener_spec.rb +0 -14
- data/vendor/listen/spec/listen/multi_listener_spec.rb +1 -19
- data/vendor/listen/spec/spec_helper.rb +3 -6
- data/vendor/listen/spec/support/adapter_helper.rb +212 -125
- data/vendor/listen/spec/support/listeners_helper.rb +1 -13
- data/vendor/listen/spec/support/platform_helper.rb +0 -4
- metadata +113 -105
- checksums.yaml +0 -7
- data/lib/sass/util/test.rb +0 -10
- data/test/sass/exec_test.rb +0 -86
- data/test/sass/results/cached_import_option.css +0 -3
- data/test/sass/templates/_cached_import_option_partial.scss +0 -1
- data/test/sass/templates/_same_name_different_partiality.scss +0 -1
- data/test/sass/templates/bork5.sass +0 -3
- data/test/sass/templates/cached_import_option.scss +0 -3
- data/test/sass/templates/same_name_different_ext.sass +0 -2
- data/test/sass/templates/same_name_different_ext.scss +0 -1
- data/test/sass/templates/same_name_different_partiality.scss +0 -1
- data/test/sass/templates/subdir/import_up1.scss +0 -1
- data/test/sass/templates/subdir/import_up2.scss +0 -1
- data/vendor/listen/CONTRIBUTING.md +0 -38
- data/vendor/listen/lib/listen/adapters/bsd.rb +0 -112
- data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
data/test/sass/plugin_test.rb
CHANGED
@@ -9,12 +9,6 @@ module Sass::Script::Functions
|
|
9
9
|
filename = options[:filename].gsub(%r{.*((/[^/]+){4})}, '\1')
|
10
10
|
Sass::Script::String.new(filename)
|
11
11
|
end
|
12
|
-
|
13
|
-
def whatever
|
14
|
-
custom = options[:custom]
|
15
|
-
whatever = custom && custom[:whatever]
|
16
|
-
Sass::Script::String.new(whatever || "incorrect")
|
17
|
-
end
|
18
12
|
end
|
19
13
|
|
20
14
|
class SassPluginTest < Test::Unit::TestCase
|
@@ -123,30 +117,13 @@ CSS
|
|
123
117
|
File.delete(tempfile_loc('bork1'))
|
124
118
|
end
|
125
119
|
|
126
|
-
def test_full_exception_with_block_comment
|
127
|
-
File.delete(tempfile_loc('bork5'))
|
128
|
-
check_for_updates!
|
129
|
-
File.open(tempfile_loc('bork5')) do |file|
|
130
|
-
assert_equal(<<CSS.strip, file.read.split("\n")[0...7].join("\n"))
|
131
|
-
/*
|
132
|
-
Syntax error: Undefined variable: "$bork".
|
133
|
-
on line 3 of #{template_loc('bork5')}
|
134
|
-
|
135
|
-
1: bork
|
136
|
-
2: /* foo *\\/
|
137
|
-
3: :bork $bork
|
138
|
-
CSS
|
139
|
-
end
|
140
|
-
File.delete(tempfile_loc('bork1'))
|
141
|
-
end
|
142
|
-
|
143
120
|
def test_single_level_import_loop
|
144
121
|
File.delete(tempfile_loc('single_import_loop'))
|
145
122
|
check_for_updates!
|
146
123
|
File.open(tempfile_loc('single_import_loop')) do |file|
|
147
124
|
assert_equal(<<CSS.strip, file.read.split("\n")[0...2].join("\n"))
|
148
125
|
/*
|
149
|
-
|
126
|
+
Sass::SyntaxError: An @import loop has been found: #{template_loc('single_import_loop')} imports itself
|
150
127
|
CSS
|
151
128
|
end
|
152
129
|
end
|
@@ -157,23 +134,9 @@ CSS
|
|
157
134
|
File.open(tempfile_loc('double_import_loop1')) do |file|
|
158
135
|
assert_equal(<<CSS.strip, file.read.split("\n")[0...4].join("\n"))
|
159
136
|
/*
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
CSS
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_import_name_cleanup
|
168
|
-
File.delete(tempfile_loc('subdir/import_up1'))
|
169
|
-
check_for_updates!
|
170
|
-
File.open(tempfile_loc('subdir/import_up1')) do |file|
|
171
|
-
assert_equal(<<CSS.strip, file.read.split("\n")[0...5].join("\n"))
|
172
|
-
/*
|
173
|
-
Syntax error: File to import not found or unreadable: ../subdir/import_up3.scss.
|
174
|
-
Load path: #{template_loc}
|
175
|
-
on line 1 of #{template_loc 'subdir/import_up2'}
|
176
|
-
from line 1 of #{template_loc 'subdir/import_up1'}
|
137
|
+
Sass::SyntaxError: An @import loop has been found:
|
138
|
+
#{template_loc('double_import_loop1')} imports #{template_loc('_double_import_loop2')}
|
139
|
+
#{template_loc('_double_import_loop2')} imports #{template_loc('double_import_loop1')}
|
177
140
|
CSS
|
178
141
|
end
|
179
142
|
end
|
@@ -247,18 +210,6 @@ CSS
|
|
247
210
|
assert_needs_update "basic"
|
248
211
|
end
|
249
212
|
|
250
|
-
def test_import_same_name
|
251
|
-
assert_warning <<WARNING do
|
252
|
-
WARNING: In #{template_loc}:
|
253
|
-
There are multiple files that match the name "same_name_different_partiality.scss":
|
254
|
-
_same_name_different_partiality.scss
|
255
|
-
same_name_different_partiality.scss
|
256
|
-
WARNING
|
257
|
-
touch "_same_name_different_partiality"
|
258
|
-
assert_needs_update "same_name_different_partiality"
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
213
|
# Callbacks
|
263
214
|
|
264
215
|
def test_updating_stylesheets_callback
|
@@ -267,6 +218,11 @@ WARNING
|
|
267
218
|
assert_callback :updating_stylesheets, []
|
268
219
|
end
|
269
220
|
|
221
|
+
def test_updating_stylesheets_callback_with_individual_files
|
222
|
+
files = [[template_loc("basic"), tempfile_loc("basic")]]
|
223
|
+
assert_callback(:updating_stylesheets, files) {Sass::Util.silence_sass_warnings{Sass::Plugin.update_stylesheets(files)}}
|
224
|
+
end
|
225
|
+
|
270
226
|
def test_updating_stylesheets_callback_with_never_update
|
271
227
|
Sass::Plugin.options[:never_update] = true
|
272
228
|
assert_no_callback :updating_stylesheets
|
@@ -377,24 +333,7 @@ WARNING
|
|
377
333
|
check_for_updates!
|
378
334
|
assert_renders_correctly 'if'
|
379
335
|
ensure
|
380
|
-
set_plugin_opts
|
381
|
-
end
|
382
|
-
|
383
|
-
def test_cached_import_option
|
384
|
-
set_plugin_opts :custom => {:whatever => "correct"}
|
385
|
-
check_for_updates!
|
386
|
-
assert_renders_correctly "cached_import_option"
|
387
|
-
|
388
|
-
@@cache_store.reset!
|
389
|
-
set_plugin_opts :custom => nil, :always_update => false
|
390
|
-
check_for_updates!
|
391
|
-
assert_renders_correctly "cached_import_option"
|
392
|
-
|
393
|
-
set_plugin_opts :custom => {:whatever => "correct"}, :always_update => true
|
394
|
-
check_for_updates!
|
395
|
-
assert_renders_correctly "cached_import_option"
|
396
|
-
ensure
|
397
|
-
set_plugin_opts :custom => nil
|
336
|
+
set_plugin_opts :cache_store => @@cache_store
|
398
337
|
end
|
399
338
|
|
400
339
|
private
|
@@ -449,7 +388,7 @@ WARNING
|
|
449
388
|
end
|
450
389
|
|
451
390
|
if block_given?
|
452
|
-
|
391
|
+
yield
|
453
392
|
else
|
454
393
|
check_for_updates!
|
455
394
|
end
|
@@ -69,20 +69,6 @@ class SassScriptConversionTest < Test::Unit::TestCase
|
|
69
69
|
assert_renders "$flaznicate"
|
70
70
|
end
|
71
71
|
|
72
|
-
def test_null
|
73
|
-
assert_renders "null"
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_empty_list
|
77
|
-
assert_renders "()"
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_list_in_args
|
81
|
-
assert_renders "foo((a, b, c))"
|
82
|
-
assert_renders "foo($arg: (a, b, c))"
|
83
|
-
assert_renders "foo(a, b, (a, b, c)...)"
|
84
|
-
end
|
85
|
-
|
86
72
|
def self.test_precedence(outer, inner)
|
87
73
|
op_outer = Sass::Script::Lexer::OPERATORS_REVERSE[outer]
|
88
74
|
op_inner = Sass::Script::Lexer::OPERATORS_REVERSE[inner]
|
data/test/sass/script_test.rb
CHANGED
@@ -134,7 +134,6 @@ class SassScriptTest < Test::Unit::TestCase
|
|
134
134
|
assert_equal '3,7', resolve('#{1 + 2},#{3 + 4}')
|
135
135
|
assert_equal '3, 7, 11', resolve('#{1 + 2}, #{3 + 4}, #{5 + 6}')
|
136
136
|
assert_equal '3, 7, 11', resolve('3, #{3 + 4}, 11')
|
137
|
-
assert_equal '3, 7, 11', resolve('3, 7, #{5 + 6}')
|
138
137
|
|
139
138
|
assert_equal '3 / 7', resolve('3 / #{3 + 4}')
|
140
139
|
assert_equal '3 /7', resolve('3 /#{3 + 4}')
|
@@ -490,13 +489,7 @@ SASS
|
|
490
489
|
end
|
491
490
|
|
492
491
|
def test_deep_argument_error_not_unwrapped
|
493
|
-
|
494
|
-
# argument errors caused by programming errors in a function and
|
495
|
-
# argument errors explicitly thrown within that function.
|
496
|
-
return if RUBY_PLATFORM =~ /java/
|
497
|
-
|
498
|
-
# Don't validate the message; it's different on Rubinius.
|
499
|
-
assert_raise(ArgumentError) {resolve("arg-error()")}
|
492
|
+
assert_raise_message(ArgumentError, 'wrong number of arguments (0 for 1)') {resolve("arg-error()")}
|
500
493
|
end
|
501
494
|
|
502
495
|
def test_shallow_argument_error_unwrapped
|
@@ -510,30 +503,6 @@ SASS
|
|
510
503
|
|
511
504
|
# Regression Tests
|
512
505
|
|
513
|
-
def test_user_defined_function_forces_division
|
514
|
-
assert_equal(<<CSS, render(<<SASS))
|
515
|
-
a {
|
516
|
-
b: 10px; }
|
517
|
-
CSS
|
518
|
-
@function foo()
|
519
|
-
@return 20px
|
520
|
-
|
521
|
-
a
|
522
|
-
b: (foo() / 2)
|
523
|
-
SASS
|
524
|
-
|
525
|
-
assert_equal(<<CSS, render(<<SASS))
|
526
|
-
a {
|
527
|
-
b: 10px; }
|
528
|
-
CSS
|
529
|
-
@function foo()
|
530
|
-
@return 20px
|
531
|
-
|
532
|
-
a
|
533
|
-
b: foo() / 2
|
534
|
-
SASS
|
535
|
-
end
|
536
|
-
|
537
506
|
def test_funcall_has_higher_precedence_than_color_name
|
538
507
|
assert_equal "teal(12)", resolve("teal(12)")
|
539
508
|
assert_equal "tealbang(12)", resolve("tealbang(12)")
|
@@ -541,13 +510,6 @@ end
|
|
541
510
|
assert_equal "teal\\+bang(12)", resolve("teal\\+bang(12)")
|
542
511
|
end
|
543
512
|
|
544
|
-
def test_funcall_has_higher_precedence_than_true_false_null
|
545
|
-
assert_equal "teal(12)", resolve("teal(12)")
|
546
|
-
assert_equal "tealbang(12)", resolve("tealbang(12)")
|
547
|
-
assert_equal "teal-bang(12)", resolve("teal-bang(12)")
|
548
|
-
assert_equal "teal\\+bang(12)", resolve("teal\\+bang(12)")
|
549
|
-
end
|
550
|
-
|
551
513
|
def test_interpolation_after_hash
|
552
514
|
assert_equal "#2", resolve('"##{1 + 1}"')
|
553
515
|
end
|
@@ -574,7 +536,6 @@ end
|
|
574
536
|
def resolve(str, opts = {}, environment = env)
|
575
537
|
munge_filename opts
|
576
538
|
val = eval(str, opts, environment)
|
577
|
-
assert_kind_of Sass::Script::Literal, val
|
578
539
|
val.is_a?(Sass::Script::String) ? val.value : val.to_s
|
579
540
|
end
|
580
541
|
|
data/test/sass/scss/css_test.rb
CHANGED
@@ -425,7 +425,7 @@ SCSS
|
|
425
425
|
assert_equal <<CSS, render(<<SCSS)
|
426
426
|
foo {
|
427
427
|
a: -0.5em;
|
428
|
-
b:
|
428
|
+
b: 0.5em;
|
429
429
|
c: -foo(12px);
|
430
430
|
d: +foo(12px); }
|
431
431
|
CSS
|
@@ -505,20 +505,13 @@ SCSS
|
|
505
505
|
assert_parses '@import url(foo.css);'
|
506
506
|
end
|
507
507
|
|
508
|
-
def
|
508
|
+
def test_import_directive_with_media
|
509
509
|
assert_parses '@import "foo.css" screen;'
|
510
510
|
assert_parses '@import "foo.css" screen, print;'
|
511
511
|
assert_parses '@import "foo.css" screen, print and (foo: 0);'
|
512
512
|
assert_parses '@import "foo.css" screen, only print, screen and (foo: 0);'
|
513
513
|
end
|
514
514
|
|
515
|
-
def test_url_import_directive_with_media
|
516
|
-
assert_parses '@import url("foo.css") screen;'
|
517
|
-
assert_parses '@import url("foo.css") screen, print;'
|
518
|
-
assert_parses '@import url("foo.css") screen, print and (foo: 0);'
|
519
|
-
assert_parses '@import url("foo.css") screen, only print, screen and (foo: 0);'
|
520
|
-
end
|
521
|
-
|
522
515
|
def test_page_directive
|
523
516
|
assert_parses <<SCSS
|
524
517
|
@page {
|
@@ -732,7 +725,7 @@ SCSS
|
|
732
725
|
|
733
726
|
# Taken from http://dev.w3.org/csswg/selectors4/#overview, but without element
|
734
727
|
# names.
|
735
|
-
def
|
728
|
+
def test_summarized_selectors
|
736
729
|
assert_selector_parses(':not(s)')
|
737
730
|
assert_selector_parses(':not(s1, s2)')
|
738
731
|
assert_selector_parses(':matches(s1, s2)')
|
@@ -1018,28 +1011,6 @@ SCSS
|
|
1018
1011
|
|
1019
1012
|
## Regressions
|
1020
1013
|
|
1021
|
-
def test_double_space_string
|
1022
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1023
|
-
.a {
|
1024
|
-
content: " a"; }
|
1025
|
-
CSS
|
1026
|
-
.a {
|
1027
|
-
content: " a";
|
1028
|
-
}
|
1029
|
-
SCSS
|
1030
|
-
end
|
1031
|
-
|
1032
|
-
def test_very_long_number_with_important_doesnt_take_forever
|
1033
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1034
|
-
.foo {
|
1035
|
-
width: 97.916666666666666666666666666667% !important; }
|
1036
|
-
CSS
|
1037
|
-
.foo {
|
1038
|
-
width: 97.916666666666666666666666666667% !important;
|
1039
|
-
}
|
1040
|
-
SCSS
|
1041
|
-
end
|
1042
|
-
|
1043
1014
|
def test_selector_without_closing_bracket
|
1044
1015
|
assert_not_parses('"]"', "foo[bar <err>{a: b}")
|
1045
1016
|
end
|
@@ -1071,18 +1042,6 @@ body {
|
|
1071
1042
|
SCSS
|
1072
1043
|
end
|
1073
1044
|
|
1074
|
-
def test_malformed_media
|
1075
|
-
render <<SCSS
|
1076
|
-
@media {
|
1077
|
-
margin: 0;
|
1078
|
-
}
|
1079
|
-
SCSS
|
1080
|
-
assert(false, "Expected syntax error")
|
1081
|
-
rescue Sass::SyntaxError => e
|
1082
|
-
assert_equal 'Invalid CSS after "@media ": expected media query (e.g. print, screen, print and screen), was "{"', e.message
|
1083
|
-
assert_equal 1, e.sass_line
|
1084
|
-
end
|
1085
|
-
|
1086
1045
|
private
|
1087
1046
|
|
1088
1047
|
def assert_selector_parses(selector)
|
data/test/sass/scss/scss_test.rb
CHANGED
@@ -270,20 +270,6 @@ SCSS
|
|
270
270
|
assert_equal "@import url(foo.css);\n", render('@import url(foo.css);')
|
271
271
|
end
|
272
272
|
|
273
|
-
def test_css_string_import_directive_with_media
|
274
|
-
assert_parses '@import "foo.css" screen;'
|
275
|
-
assert_parses '@import "foo.css" screen, print;'
|
276
|
-
assert_parses '@import "foo.css" screen, print and (foo: 0);'
|
277
|
-
assert_parses '@import "foo.css" screen, only print, screen and (foo: 0);'
|
278
|
-
end
|
279
|
-
|
280
|
-
def test_css_url_import_directive_with_media
|
281
|
-
assert_parses '@import url("foo.css") screen;'
|
282
|
-
assert_parses '@import url("foo.css") screen, print;'
|
283
|
-
assert_parses '@import url("foo.css") screen, print and (foo: 0);'
|
284
|
-
assert_parses '@import url("foo.css") screen, only print, screen and (foo: 0);'
|
285
|
-
end
|
286
|
-
|
287
273
|
def test_media_import
|
288
274
|
assert_equal("@import \"./fonts.sass\" all;\n", render("@import \"./fonts.sass\" all;"))
|
289
275
|
end
|
@@ -304,11 +290,6 @@ SCSS
|
|
304
290
|
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";"))
|
305
291
|
end
|
306
292
|
|
307
|
-
def test_protocol_relative_import
|
308
|
-
assert_equal("@import \"//fonts.googleapis.com/css?family=Droid+Sans\";\n",
|
309
|
-
render("@import \"//fonts.googleapis.com/css?family=Droid+Sans\";"))
|
310
|
-
end
|
311
|
-
|
312
293
|
def test_import_with_interpolation
|
313
294
|
assert_equal <<CSS, render(<<SCSS)
|
314
295
|
@import url("http://fonts.googleapis.com/css?family=Droid+Sans");
|
@@ -322,44 +303,6 @@ SCSS
|
|
322
303
|
assert_equal("@import url(fonts.sass);\n", render("@import url(fonts.sass);"))
|
323
304
|
end
|
324
305
|
|
325
|
-
def test_css_import_doesnt_move_through_comments
|
326
|
-
assert_equal <<CSS, render(<<SCSS)
|
327
|
-
/* Comment 1 */
|
328
|
-
@import url("foo.css");
|
329
|
-
/* Comment 2 */
|
330
|
-
@import url("bar.css");
|
331
|
-
CSS
|
332
|
-
/* Comment 1 */
|
333
|
-
@import url("foo.css");
|
334
|
-
|
335
|
-
/* Comment 2 */
|
336
|
-
@import url("bar.css");
|
337
|
-
SCSS
|
338
|
-
end
|
339
|
-
|
340
|
-
def test_css_import_movement_stops_at_comments
|
341
|
-
assert_equal <<CSS, render(<<SCSS)
|
342
|
-
/* Comment 1 */
|
343
|
-
@import url("foo.css");
|
344
|
-
/* Comment 2 */
|
345
|
-
@import url("bar.css");
|
346
|
-
.foo {
|
347
|
-
a: b; }
|
348
|
-
|
349
|
-
/* Comment 3 */
|
350
|
-
CSS
|
351
|
-
/* Comment 1 */
|
352
|
-
@import url("foo.css");
|
353
|
-
|
354
|
-
/* Comment 2 */
|
355
|
-
|
356
|
-
.foo {a: b}
|
357
|
-
|
358
|
-
/* Comment 3 */
|
359
|
-
@import url("bar.css");
|
360
|
-
SCSS
|
361
|
-
end
|
362
|
-
|
363
306
|
def test_block_comment_in_script
|
364
307
|
assert_equal <<CSS, render(<<SCSS)
|
365
308
|
foo {
|
@@ -1721,7 +1664,7 @@ SCSS
|
|
1721
1664
|
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1722
1665
|
Invalid CSS after " .foo": expected "{", was "&.bar {a: b}"
|
1723
1666
|
|
1724
|
-
"&.bar" may only be used at the beginning of a
|
1667
|
+
"&.bar" may only be used at the beginning of a selector.
|
1725
1668
|
MESSAGE
|
1726
1669
|
flim {
|
1727
1670
|
.foo&.bar {a: b}
|
@@ -1733,7 +1676,7 @@ SCSS
|
|
1733
1676
|
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1734
1677
|
Invalid CSS after " .foo.bar": expected "{", was "& {a: b}"
|
1735
1678
|
|
1736
|
-
"&" may only be used at the beginning of a
|
1679
|
+
"&" may only be used at the beginning of a selector.
|
1737
1680
|
MESSAGE
|
1738
1681
|
flim {
|
1739
1682
|
.foo.bar& {a: b}
|
@@ -1745,7 +1688,7 @@ SCSS
|
|
1745
1688
|
assert_raise_message(Sass::SyntaxError, <<MESSAGE.rstrip) {render <<SCSS}
|
1746
1689
|
Invalid CSS after " &": expected "{", was "& {a: b}"
|
1747
1690
|
|
1748
|
-
"&" may only be used at the beginning of a
|
1691
|
+
"&" may only be used at the beginning of a selector.
|
1749
1692
|
MESSAGE
|
1750
1693
|
flim {
|
1751
1694
|
&& {a: b}
|
@@ -1762,60 +1705,6 @@ SCSS
|
|
1762
1705
|
end
|
1763
1706
|
|
1764
1707
|
# Regression
|
1765
|
-
|
1766
|
-
def test_parent_ref_with_newline
|
1767
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1768
|
-
a.c
|
1769
|
-
, b.c {
|
1770
|
-
x: y; }
|
1771
|
-
CSS
|
1772
|
-
a
|
1773
|
-
, b {&.c {x: y}}
|
1774
|
-
SCSS
|
1775
|
-
end
|
1776
|
-
|
1777
|
-
def test_loud_comment_in_compressed_mode
|
1778
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1779
|
-
/*! foo */
|
1780
|
-
CSS
|
1781
|
-
/*! foo */
|
1782
|
-
SCSS
|
1783
|
-
end
|
1784
|
-
|
1785
|
-
def test_parsing_decimals_followed_by_comments_doesnt_take_forever
|
1786
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1787
|
-
.foo {
|
1788
|
-
padding: 4.21053% 4.21053% 5.63158%; }
|
1789
|
-
CSS
|
1790
|
-
.foo {
|
1791
|
-
padding: 4.21052631578947% 4.21052631578947% 5.631578947368421% /**/
|
1792
|
-
}
|
1793
|
-
SCSS
|
1794
|
-
end
|
1795
|
-
|
1796
|
-
def test_parsing_many_numbers_doesnt_take_forever
|
1797
|
-
values = ["80% 90%"] * 1000
|
1798
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1799
|
-
.foo {
|
1800
|
-
padding: #{values.join(', ')}; }
|
1801
|
-
CSS
|
1802
|
-
.foo {
|
1803
|
-
padding: #{values.join(', ')};
|
1804
|
-
}
|
1805
|
-
SCSS
|
1806
|
-
end
|
1807
|
-
|
1808
|
-
def test_import_comments_in_imports
|
1809
|
-
assert_equal(<<CSS, render(<<SCSS))
|
1810
|
-
@import url(foo.css);
|
1811
|
-
@import url(bar.css);
|
1812
|
-
@import url(baz.css);
|
1813
|
-
CSS
|
1814
|
-
@import "foo.css", // this is a comment
|
1815
|
-
"bar.css", /* this is another comment */
|
1816
|
-
"baz.css"; // this is a third comment
|
1817
|
-
SCSS
|
1818
|
-
end
|
1819
1708
|
|
1820
1709
|
def test_reference_combinator_with_parent_ref
|
1821
1710
|
assert_equal <<CSS, render(<<SCSS)
|
@@ -2083,24 +1972,4 @@ SCSS
|
|
2083
1972
|
SCSS
|
2084
1973
|
Sass::SCSS::Parser.new(template, "test.scss").parse
|
2085
1974
|
end
|
2086
|
-
|
2087
|
-
def test_extend_in_media_in_rule
|
2088
|
-
assert_equal(<<CSS, render(<<SCSS))
|
2089
|
-
@media screen {
|
2090
|
-
.foo {
|
2091
|
-
a: b; } }
|
2092
|
-
CSS
|
2093
|
-
.foo {
|
2094
|
-
@media screen {
|
2095
|
-
@extend %bar;
|
2096
|
-
}
|
2097
|
-
}
|
2098
|
-
|
2099
|
-
@media screen {
|
2100
|
-
%bar {
|
2101
|
-
a: b;
|
2102
|
-
}
|
2103
|
-
}
|
2104
|
-
SCSS
|
2105
|
-
end
|
2106
1975
|
end
|