haml-edge 2.3.16 → 2.3.17
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/engine.rb +17 -0
- data/test/sass/engine_test.rb +19 -1
- data/test/sass/plugin_test.rb +4 -2
- data/test/sass/script_test.rb +0 -15
- data/test/sass/templates/complex.sass +0 -2
- data/test/test_helper.rb +15 -0
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.17
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.17
|
data/lib/sass/engine.rb
CHANGED
@@ -268,6 +268,7 @@ END
|
|
268
268
|
continued_rule, child = nil, continued_rule
|
269
269
|
end
|
270
270
|
|
271
|
+
check_for_no_children(child)
|
271
272
|
validate_and_append_child(parent, child, line, root)
|
272
273
|
end
|
273
274
|
|
@@ -294,6 +295,22 @@ END
|
|
294
295
|
end
|
295
296
|
end
|
296
297
|
|
298
|
+
def check_for_no_children(node)
|
299
|
+
return unless node.is_a?(Tree::RuleNode) && node.children.empty?
|
300
|
+
warning = (node.rules.size == 1) ? <<SHORT : <<LONG
|
301
|
+
WARNING:
|
302
|
+
Selector #{node.rules.first.inspect} doesn't have any properties and will not be rendered.
|
303
|
+
SHORT
|
304
|
+
|
305
|
+
WARNING:
|
306
|
+
Selector
|
307
|
+
#{node.rules.join("\n ")}
|
308
|
+
doesn't have any properties and will not be rendered.
|
309
|
+
LONG
|
310
|
+
|
311
|
+
warn(warning.strip)
|
312
|
+
end
|
313
|
+
|
297
314
|
def parse_line(parent, line, root)
|
298
315
|
case line.text[0]
|
299
316
|
when PROPERTY_CHAR
|
data/test/sass/engine_test.rb
CHANGED
@@ -130,7 +130,7 @@ class SassEngineTest < Test::Unit::TestCase
|
|
130
130
|
define_method("test_exception (#{key.inspect})") do
|
131
131
|
line = 10
|
132
132
|
begin
|
133
|
-
Sass::Engine.new(key, :filename => __FILE__, :line => line).render
|
133
|
+
silence_warnings {Sass::Engine.new(key, :filename => __FILE__, :line => line).render}
|
134
134
|
rescue Sass::SyntaxError => err
|
135
135
|
value = [value] unless value.is_a?(Array)
|
136
136
|
|
@@ -704,6 +704,24 @@ a
|
|
704
704
|
SASS
|
705
705
|
end
|
706
706
|
|
707
|
+
def test_empty_selector_warning
|
708
|
+
assert_warning(<<END) {render("foo bar")}
|
709
|
+
WARNING:
|
710
|
+
Selector "foo bar" doesn't have any properties and will not be rendered.
|
711
|
+
END
|
712
|
+
|
713
|
+
assert_warning(<<END) {render(<<SASS)}
|
714
|
+
WARNING:
|
715
|
+
Selector
|
716
|
+
foo, bar, baz,
|
717
|
+
bang, bip, bop
|
718
|
+
doesn't have any properties and will not be rendered.
|
719
|
+
END
|
720
|
+
foo, bar, baz,
|
721
|
+
bang, bip, bop
|
722
|
+
SASS
|
723
|
+
end
|
724
|
+
|
707
725
|
# Regression tests
|
708
726
|
|
709
727
|
def test_parens_in_mixins
|
data/test/sass/plugin_test.rb
CHANGED
@@ -22,8 +22,10 @@ class SassPluginTest < Test::Unit::TestCase
|
|
22
22
|
FileUtils.rm_r tempfile_loc(nil,"more_")
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
@@templates.each do |name|
|
26
|
+
define_method("test_template_renders_correctly (#{name})") do
|
27
|
+
assert_renders_correctly(name)
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
def test_no_update
|
data/test/sass/script_test.rb
CHANGED
@@ -243,21 +243,6 @@ WARN
|
|
243
243
|
Sass::Engine.new(sass, options).render
|
244
244
|
end
|
245
245
|
|
246
|
-
def assert_warning(message)
|
247
|
-
the_real_stderr, $stderr = $stderr, StringIO.new
|
248
|
-
yield
|
249
|
-
assert_equal message.strip, $stderr.string.strip
|
250
|
-
ensure
|
251
|
-
$stderr = the_real_stderr
|
252
|
-
end
|
253
|
-
|
254
|
-
def silence_warnings
|
255
|
-
the_real_stderr, $stderr = $stderr, StringIO.new
|
256
|
-
yield
|
257
|
-
ensure
|
258
|
-
$stderr = the_real_stderr
|
259
|
-
end
|
260
|
-
|
261
246
|
def env(hash = {})
|
262
247
|
env = Sass::Environment.new
|
263
248
|
hash.each {|k, v| env.set_var(k, v)}
|
data/test/test_helper.rb
CHANGED
@@ -26,4 +26,19 @@ class Test::Unit::TestCase
|
|
26
26
|
path = File.dirname(__FILE__) + "/../.sass-cache"
|
27
27
|
FileUtils.rm_r(path) if File.exist?(path)
|
28
28
|
end
|
29
|
+
|
30
|
+
def assert_warning(message)
|
31
|
+
the_real_stderr, $stderr = $stderr, StringIO.new
|
32
|
+
yield
|
33
|
+
assert_equal message.strip, $stderr.string.strip
|
34
|
+
ensure
|
35
|
+
$stderr = the_real_stderr
|
36
|
+
end
|
37
|
+
|
38
|
+
def silence_warnings
|
39
|
+
the_real_stderr, $stderr = $stderr, StringIO.new
|
40
|
+
yield
|
41
|
+
ensure
|
42
|
+
$stderr = the_real_stderr
|
43
|
+
end
|
29
44
|
end
|