Fix a crash for @for loops.

Closes #1468
This commit is contained in:
Nathan Weizenbaum
2014-10-16 18:10:56 -07:00
parent 949c8ef4f7
commit 7ac58c2e08
3 changed files with 31 additions and 1 deletions

View File

@@ -7,6 +7,8 @@
* Parent selectors now work in selector pseudoclasses (for example, `:not(&)`).
* `@for` loops no longer crash when one bound is an integer-like float.
## 3.4.5 (19 September 2014)
* Fix `sass-convert --recursive`.

View File

@@ -289,7 +289,7 @@ module Sass::Script::Value
# @raise [Sass::SyntaxError] if the number isn't an integer
def to_i
super unless int?
value
value.to_i
end
# @return [Boolean] Whether or not this number is an integer.

View File

@@ -3570,6 +3570,34 @@ SCSS
# Regression
def test_for_directive_with_float_bounds
assert_equal(<<CSS, render(<<SCSS))
.a {
b: 0;
b: 1;
b: 2;
b: 3;
b: 4;
b: 5; }
CSS
.a {
@for $i from 0.0 through 5.0 {b: $i}
}
SCSS
assert_raise_message(Sass::SyntaxError, "0.5 is not an integer.") {render(<<SCSS)}
.a {
@for $i from 0.5 through 5.0 {b: $i}
}
SCSS
assert_raise_message(Sass::SyntaxError, "5.5 is not an integer.") {render(<<SCSS)}
.a {
@for $i from 0.0 through 5.5 {b: $i}
}
SCSS
end
def test_parent_selector_in_function_pseudo_selector
assert_equal <<CSS, render(<<SCSS)
.bar:not(.foo) {