Permalink
Browse files

Fix nested @if conversion.

Closes #373
  • Loading branch information...
1 parent 69d755b commit cb84d9f19b590ae2b108cf1c8ddb6434f2c79f01 @nex3 nex3 committed May 5, 2012
Showing with 28 additions and 0 deletions.
  1. +1 −0 doc-src/SASS_CHANGELOG.md
  2. +1 −0 lib/sass/tree/visitors/convert.rb
  3. +26 −0 test/sass/conversion_test.rb
@@ -14,6 +14,7 @@
* Support keyword arguments for the `invert()` function.
* Handle backslash-separated paths better on Windows.
* Fix `rake install` on Ruby 1.9.
+* Properly convert nested `@if` statements with `sass-convert`.
## 3.1.16
@@ -138,6 +138,7 @@ def visit_if(node)
elsif node.expr; "else if"
else; "else"
end
+ @is_else = false
str = "#{tab_str}@#{name}"
str << " #{node.expr.to_sass(@options)}" if node.expr
str << yield
@@ -1168,6 +1168,32 @@ def test_empty_lists
SCSS
end
+ def test_nested_if_statements
+ assert_renders(<<SASS, <<SCSS)
+@if $foo
+ one
+ a: b
+@else
+ @if $bar
+ two
+ a: b
+ @else
+ three
+ a: b
+SASS
+@if $foo {
+ one {
+ a: b; } }
+@else {
+ @if $bar {
+ two {
+ a: b; } }
+ @else {
+ three {
+ a: b; } } }
+SCSS
+ end
+
private
def assert_sass_to_sass(sass, options = {})

0 comments on commit cb84d9f

Please sign in to comment.