sass 3.1.0.alpha.221 → 3.1.0.alpha.246
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sass/cache_stores/filesystem.rb +6 -4
- data/lib/sass/engine.rb +18 -44
- data/lib/sass/exec.rb +3 -10
- data/lib/sass/importers/filesystem.rb +10 -9
- data/lib/sass/less.rb +1 -1
- data/lib/sass/plugin.rb +1 -1
- data/lib/sass/plugin/compiler.rb +2 -2
- data/lib/sass/script.rb +2 -25
- data/lib/sass/script/color.rb +0 -11
- data/lib/sass/script/funcall.rb +0 -9
- data/lib/sass/script/functions.rb +1 -21
- data/lib/sass/script/lexer.rb +1 -4
- data/lib/sass/script/list.rb +0 -1
- data/lib/sass/script/node.rb +0 -27
- data/lib/sass/script/number.rb +1 -1
- data/lib/sass/script/operation.rb +0 -5
- data/lib/sass/script/parser.rb +1 -8
- data/lib/sass/script/string.rb +2 -17
- data/lib/sass/script/string_interpolation.rb +1 -0
- data/lib/sass/scss/parser.rb +3 -1
- data/lib/sass/scss/rx.rb +2 -1
- data/lib/sass/scss/script_lexer.rb +1 -1
- data/lib/sass/tree/comment_node.rb +23 -2
- data/lib/sass/tree/mixin_node.rb +0 -7
- data/lib/sass/tree/prop_node.rb +10 -3
- data/lib/sass/tree/visitors/check_nesting.rb +26 -16
- data/lib/sass/tree/visitors/convert.rb +11 -2
- data/lib/sass/tree/visitors/perform.rb +10 -13
- data/lib/sass/tree/visitors/to_css.rb +17 -5
- data/test/sass/conversion_test.rb +17 -102
- data/test/sass/engine_test.rb +70 -370
- data/test/sass/functions_test.rb +4 -0
- data/test/sass/plugin_test.rb +36 -24
- data/test/sass/script_conversion_test.rb +0 -38
- data/test/test_helper.rb +0 -3
- metadata +2 -4
- data/bin/css2sass +0 -13
data/test/sass/functions_test.rb
CHANGED
@@ -35,6 +35,10 @@ module Sass::Script::Functions::UserFunctions
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
module Sass::Script::Functions
|
39
|
+
include Sass::Script::Functions::UserFunctions
|
40
|
+
end
|
41
|
+
|
38
42
|
class SassFunctionTest < Test::Unit::TestCase
|
39
43
|
# Tests taken from:
|
40
44
|
# http://www.w3.org/Style/CSS/Test/CSS3/Color/20070927/html4/t040204-hsl-h-rotating-b.htm
|
data/test/sass/plugin_test.rb
CHANGED
@@ -19,7 +19,7 @@ class SassPluginTest < Test::Unit::TestCase
|
|
19
19
|
FileUtils.mkdir_p tempfile_loc
|
20
20
|
FileUtils.mkdir_p tempfile_loc(nil,"more_")
|
21
21
|
set_plugin_opts
|
22
|
-
|
22
|
+
check_for_updates!
|
23
23
|
reset_mtimes
|
24
24
|
end
|
25
25
|
|
@@ -39,21 +39,21 @@ class SassPluginTest < Test::Unit::TestCase
|
|
39
39
|
def test_no_update
|
40
40
|
File.delete(tempfile_loc('basic'))
|
41
41
|
assert_needs_update 'basic'
|
42
|
-
|
42
|
+
check_for_updates!
|
43
43
|
assert_stylesheet_updated 'basic'
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_update_needed_when_modified
|
47
47
|
touch 'basic'
|
48
48
|
assert_needs_update 'basic'
|
49
|
-
|
49
|
+
check_for_updates!
|
50
50
|
assert_stylesheet_updated 'basic'
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_update_needed_when_dependency_modified
|
54
54
|
touch 'basic'
|
55
55
|
assert_needs_update 'import'
|
56
|
-
|
56
|
+
check_for_updates!
|
57
57
|
assert_stylesheet_updated 'basic'
|
58
58
|
assert_stylesheet_updated 'import'
|
59
59
|
end
|
@@ -61,7 +61,7 @@ class SassPluginTest < Test::Unit::TestCase
|
|
61
61
|
def test_update_needed_when_scss_dependency_modified
|
62
62
|
touch 'scss_importee'
|
63
63
|
assert_needs_update 'import'
|
64
|
-
|
64
|
+
check_for_updates!
|
65
65
|
assert_stylesheet_updated 'scss_importee'
|
66
66
|
assert_stylesheet_updated 'import'
|
67
67
|
end
|
@@ -69,7 +69,7 @@ class SassPluginTest < Test::Unit::TestCase
|
|
69
69
|
def test_scss_update_needed_when_dependency_modified
|
70
70
|
touch 'basic'
|
71
71
|
assert_needs_update 'scss_import'
|
72
|
-
|
72
|
+
check_for_updates!
|
73
73
|
assert_stylesheet_updated 'basic'
|
74
74
|
assert_stylesheet_updated 'scss_import'
|
75
75
|
end
|
@@ -77,14 +77,26 @@ class SassPluginTest < Test::Unit::TestCase
|
|
77
77
|
def test_update_needed_when_nested_import_dependency_modified
|
78
78
|
touch 'basic'
|
79
79
|
assert_needs_update 'nested_import'
|
80
|
-
|
80
|
+
check_for_updates!
|
81
81
|
assert_stylesheet_updated 'basic'
|
82
82
|
assert_stylesheet_updated 'scss_import'
|
83
83
|
end
|
84
84
|
|
85
|
+
def test_no_updates_when_always_check_and_always_update_both_false
|
86
|
+
Sass::Plugin.options[:always_update] = false
|
87
|
+
Sass::Plugin.options[:always_check] = false
|
88
|
+
|
89
|
+
touch 'basic'
|
90
|
+
assert_needs_update 'basic'
|
91
|
+
check_for_updates!
|
92
|
+
|
93
|
+
# Check it's still stale
|
94
|
+
assert_needs_update 'basic'
|
95
|
+
end
|
96
|
+
|
85
97
|
def test_full_exception_handling
|
86
98
|
File.delete(tempfile_loc('bork1'))
|
87
|
-
|
99
|
+
check_for_updates!
|
88
100
|
File.open(tempfile_loc('bork1')) do |file|
|
89
101
|
assert_equal(<<CSS.strip, file.read.split("\n")[0...6].join("\n"))
|
90
102
|
/*
|
@@ -103,17 +115,17 @@ CSS
|
|
103
115
|
Sass::Plugin.options[:full_exception] = false
|
104
116
|
|
105
117
|
File.delete(tempfile_loc('bork1'))
|
106
|
-
assert_raise(Sass::SyntaxError) {
|
118
|
+
assert_raise(Sass::SyntaxError) {check_for_updates!}
|
107
119
|
ensure
|
108
120
|
Sass::Plugin.options[:full_exception] = old_full_exception
|
109
121
|
end
|
110
|
-
|
122
|
+
|
111
123
|
def test_two_template_directories
|
112
124
|
set_plugin_opts :template_location => {
|
113
125
|
template_loc => tempfile_loc,
|
114
126
|
template_loc(nil,'more_') => tempfile_loc(nil,'more_')
|
115
127
|
}
|
116
|
-
|
128
|
+
check_for_updates!
|
117
129
|
['more1', 'more_import'].each { |name| assert_renders_correctly(name, :prefix => 'more_') }
|
118
130
|
end
|
119
131
|
|
@@ -124,7 +136,7 @@ CSS
|
|
124
136
|
template_loc => tempfile_loc,
|
125
137
|
template_loc(nil,'more_') => tempfile_loc(nil,'more_')
|
126
138
|
}
|
127
|
-
|
139
|
+
check_for_updates!
|
128
140
|
assert_renders_correctly('more1_with_line_comments', 'more1', :prefix => 'more_')
|
129
141
|
end
|
130
142
|
|
@@ -146,7 +158,7 @@ CSS
|
|
146
158
|
touch 'basic'
|
147
159
|
assert_needs_update "more1", "more_"
|
148
160
|
assert_needs_update "basic"
|
149
|
-
|
161
|
+
check_for_updates!
|
150
162
|
assert_doesnt_need_update "more1", "more_"
|
151
163
|
assert_doesnt_need_update "basic"
|
152
164
|
end
|
@@ -162,7 +174,7 @@ CSS
|
|
162
174
|
touch 'basic'
|
163
175
|
assert_needs_update "more1", "more_"
|
164
176
|
assert_needs_update "basic"
|
165
|
-
|
177
|
+
check_for_updates!
|
166
178
|
assert_doesnt_need_update "more1", "more_"
|
167
179
|
assert_needs_update "basic"
|
168
180
|
end
|
@@ -267,7 +279,7 @@ CSS
|
|
267
279
|
|
268
280
|
touch 'basic', 'more_'
|
269
281
|
assert_needs_update "import"
|
270
|
-
|
282
|
+
check_for_updates!
|
271
283
|
assert_renders_correctly("import")
|
272
284
|
ensure
|
273
285
|
FileUtils.mv(template_loc("basic", "more_"), template_loc("basic"))
|
@@ -276,7 +288,7 @@ CSS
|
|
276
288
|
def test_cached_relative_import
|
277
289
|
old_always_update = Sass::Plugin.options[:always_update]
|
278
290
|
Sass::Plugin.options[:always_update] = true
|
279
|
-
|
291
|
+
check_for_updates!
|
280
292
|
assert_renders_correctly('subdir/subdir')
|
281
293
|
ensure
|
282
294
|
Sass::Plugin.options[:always_update] = old_always_update
|
@@ -284,9 +296,9 @@ CSS
|
|
284
296
|
|
285
297
|
def test_cached_if
|
286
298
|
set_plugin_opts :cache_store => Sass::CacheStores::Filesystem.new(tempfile_loc + '/cache')
|
287
|
-
|
299
|
+
check_for_updates!
|
288
300
|
assert_renders_correctly 'if'
|
289
|
-
|
301
|
+
check_for_updates!
|
290
302
|
assert_renders_correctly 'if'
|
291
303
|
ensure
|
292
304
|
set_plugin_opts :cache_store => @@cache_store
|
@@ -344,7 +356,7 @@ CSS
|
|
344
356
|
if block_given?
|
345
357
|
yield
|
346
358
|
else
|
347
|
-
|
359
|
+
check_for_updates!
|
348
360
|
end
|
349
361
|
|
350
362
|
assert run, "Expected #{name} callback to be run with arguments:\n #{expected_args.inspect}"
|
@@ -367,23 +379,23 @@ CSS
|
|
367
379
|
if block_given?
|
368
380
|
yield
|
369
381
|
else
|
370
|
-
|
382
|
+
check_for_updates!
|
371
383
|
end
|
372
384
|
end
|
373
385
|
|
374
386
|
def assert_callbacks(*args)
|
375
|
-
return
|
387
|
+
return check_for_updates! if args.empty?
|
376
388
|
assert_callback(*args.pop) {assert_callbacks(*args)}
|
377
389
|
end
|
378
390
|
|
379
391
|
def assert_no_callbacks(*args)
|
380
|
-
return
|
392
|
+
return check_for_updates! if args.empty?
|
381
393
|
assert_no_callback(*args.pop) {assert_no_callbacks(*args)}
|
382
394
|
end
|
383
395
|
|
384
|
-
def
|
396
|
+
def check_for_updates!
|
385
397
|
Sass::Util.silence_sass_warnings do
|
386
|
-
Sass::Plugin.
|
398
|
+
Sass::Plugin.check_for_updates
|
387
399
|
end
|
388
400
|
end
|
389
401
|
|
@@ -67,19 +67,6 @@ class SassScriptConversionTest < Test::Unit::TestCase
|
|
67
67
|
def test_variable
|
68
68
|
assert_renders "$foo-bar"
|
69
69
|
assert_renders "$flaznicate"
|
70
|
-
assert_warning(<<WARN) {assert_equal "$tumbly-wumbly", render("!tumbly-wumbly")}
|
71
|
-
DEPRECATION WARNING:
|
72
|
-
On line 1, character 1 of 'test_variable_inline.sass'
|
73
|
-
Variables with ! have been deprecated and will be removed in version 3.2.
|
74
|
-
Use "$tumbly-wumbly" instead.
|
75
|
-
|
76
|
-
You can use `sass-convert --in-place --from sass2 file.sass' to convert files automatically.
|
77
|
-
WARN
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_important
|
81
|
-
assert_renders "!important"
|
82
|
-
assert_renders "$foo !important"
|
83
70
|
end
|
84
71
|
|
85
72
|
def self.test_precedence(outer, inner)
|
@@ -282,30 +269,6 @@ RUBY
|
|
282
269
|
assert_equal '"foo#{$bar}baz"', render("'foo\#{$bar}baz'")
|
283
270
|
end
|
284
271
|
|
285
|
-
def test_sass2_string_interpolation
|
286
|
-
assert_equal 'foo#{$bar}baz', render('"foo#{$bar}baz"', :context => :equals)
|
287
|
-
assert_equal '#{$bar}baz', render('"#{$bar}baz"', :context => :equals)
|
288
|
-
assert_equal 'foo#{$bar}', render('"foo#{$bar}"', :context => :equals)
|
289
|
-
|
290
|
-
assert_equal 'unquote(".foo#{$bar}.bar")', render('".foo#{$bar}.bar"', :context => :equals)
|
291
|
-
assert_equal 'unquote(".foo#{$bar}")', render('".foo#{$bar}"', :context => :equals)
|
292
|
-
assert_equal 'unquote("#{$bar}.bar")', render('"#{$bar}.bar"', :context => :equals)
|
293
|
-
|
294
|
-
assert_equal "unquote(\"f'o\#{$bar}b'z\")", render("'f\\'o\#{$bar}b\\'z'", :context => :equals)
|
295
|
-
assert_equal "unquote('f\"o\#{$bar}b\"z')", render("'f\\\"o\#{$bar}b\\\"z'", :context => :equals)
|
296
|
-
assert_equal "unquote(\"f'o\#{$bar}b\\\"z\")", render("'f\\'o\#{$bar}b\\\"z'", :context => :equals)
|
297
|
-
end
|
298
|
-
|
299
|
-
def test_sass2_urls
|
300
|
-
Sass::Util.silence_sass_warnings do
|
301
|
-
assert_equal 'url(foo/bar.gif)', render('url(foo/bar.gif)', :context => :equals)
|
302
|
-
assert_equal 'url("foo/bar.gif")', render('url("foo/bar.gif")', :context => :equals)
|
303
|
-
|
304
|
-
assert_equal 'url($var)', render('url(!var)', :context => :equals)
|
305
|
-
assert_equal 'url("#{$var}/flip.gif")', render('url("#{!var}/flip.gif")', :context => :equals)
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
272
|
private
|
310
273
|
|
311
274
|
def assert_renders(script, options = {})
|
@@ -315,7 +278,6 @@ RUBY
|
|
315
278
|
def render(script, options = {})
|
316
279
|
munge_filename(options)
|
317
280
|
node = Sass::Script.parse(script, 1, 0, options)
|
318
|
-
node.context = options[:context] if options[:context]
|
319
281
|
node.to_sass
|
320
282
|
end
|
321
283
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.alpha.
|
4
|
+
version: 3.1.0.alpha.246
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-03-14 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -38,7 +38,6 @@ description: " Sass makes CSS fun again. Sass is an extension of CSS3, addi
|
|
38
38
|
email: sass-lang@googlegroups.com
|
39
39
|
executables:
|
40
40
|
- sass
|
41
|
-
- css2sass
|
42
41
|
- sass-convert
|
43
42
|
extensions: []
|
44
43
|
|
@@ -170,7 +169,6 @@ files:
|
|
170
169
|
- vendor/fssm/spec/root/file.yml
|
171
170
|
- vendor/fssm/spec/root/moo/cow.txt
|
172
171
|
- vendor/fssm/spec/spec_helper.rb
|
173
|
-
- bin/css2sass
|
174
172
|
- bin/sass
|
175
173
|
- bin/sass-convert
|
176
174
|
- test/sass/css2sass_test.rb
|
data/bin/css2sass
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../lib/sass'
|
4
|
-
require 'sass/exec'
|
5
|
-
|
6
|
-
warn <<END
|
7
|
-
DEPRECATION WARNING:
|
8
|
-
The css2sass tool is deprecated and will be removed in Sass 3.2.
|
9
|
-
Use the sass-convert tool instead.
|
10
|
-
END
|
11
|
-
|
12
|
-
opts = Sass::Exec::SassConvert.new(%w[--from css --to sass] + ARGV)
|
13
|
-
opts.parse!
|