Skip to content
Browse files

Add a new helper function to reject values from a list.

  • Loading branch information...
1 parent fc46730 commit ca59adfa12aa744f8169425ddda551ea04cc0b1f @chriseppstein chriseppstein committed Dec 23, 2011
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/compass/sass_extensions/functions/lists.rb
  2. +5 −0 test/units/sass_extensions_test.rb
View
2 lib/compass/sass_extensions/functions/lists.rb
@@ -76,7 +76,7 @@ def _compass_slice(list, start_index, end_index = nil)
# removes the given values from the list.
def reject(list, *values)
- Sass::Script::List.new(list.values.reject{|v| values.any?{|o| v == o}}, list.separator)
+ Sass::Script::List.new(list.value.reject{|v| values.any?{|o| v == o}}, list.separator)
end
# returns the first value of a space delimited list.
View
5 test/units/sass_extensions_test.rb
@@ -95,6 +95,11 @@ def test_css2_fallback
assert_equal "true", evaluate("prefixed(-css2, css2-fallback(css3, css2))")
end
+ def test_reject
+ assert_equal "b d", evaluate("reject(a b c d, a, c)")
+ assert_equal "a b c d", evaluate("reject(a b c d, e)")
+ end
+
protected
def evaluate(value)
Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s

0 comments on commit ca59adf

Please sign in to comment.
Something went wrong with that request. Please try again.