Permalink
Browse files

Fix no-op @content.

  • Loading branch information...
1 parent 7da08d3 commit 51c4cbbd637d60c316c8a39e187e6a4a5add1d14 @nex3 nex3 committed Aug 11, 2012
Showing with 10 additions and 7 deletions.
  1. +1 −1 lib/sass/tree/visitors/perform.rb
  2. +9 −6 test/sass/engine_test.rb
@@ -274,7 +274,7 @@ def visit_mixin(node)
end
def visit_content(node)
- return unless content = @environment.content
+ return [] unless content = @environment.content
@stack.push(:filename => node.filename, :line => node.line, :name => '@content')
trace_node = Sass::Tree::TraceNode.from_node('@content', node)
with_environment(@environment.caller) {trace_node.children = content.map {|c| visit(c.dup)}.flatten}
View
@@ -152,7 +152,6 @@ class SassEngineTest < Test::Unit::TestCase
"=foo\n @content\n b: c" => "Illegal nesting: Nothing may be nested beneath @content directives.",
"@content" => '@content may only be used within a mixin.',
"=simple\n .simple\n color: red\n+simple\n color: blue" => ['Mixin "simple" does not accept a content block.', 4],
- "=foo\n @content\n+foo" => ["No @content passed.", 2],
"@import \"foo\" // bar" => "Invalid CSS after \"\"foo\" \": expected media query list, was \"// bar\"",
# Regression tests
@@ -3027,22 +3026,26 @@ def test_nested_content_blocks
end
def test_content_not_seen_through_mixin
- render(<<SASS)
+ assert_equal <<CSS, render(<<SASS)
+a foo {
+ mixin: foo;
+ a: b; }
+ a foo bar {
+ mixin: bar; }
+CSS
=foo
foo
+ mixin: foo
@content
+bar
=bar
bar
+ mixin: bar
@content
a
+foo
a: b
SASS
- assert(false, "Expected exception")
- rescue Sass::SyntaxError => e
- assert_equal("No @content passed.", e.message)
- assert_equal(7, e.sass_line)
end
def test_content_backtrace_for_perform

0 comments on commit 51c4cbb

Please sign in to comment.