Add a new helper function to reject values from a list.
This commit is contained in:
parent
fc46730b36
commit
ca59adfa12
@ -76,7 +76,7 @@ module Compass::SassExtensions::Functions::Lists
|
|||||||
|
|
||||||
# removes the given values from the list.
|
# removes the given values from the list.
|
||||||
def reject(list, *values)
|
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
|
end
|
||||||
|
|
||||||
# returns the first value of a space delimited list.
|
# returns the first value of a space delimited list.
|
||||||
|
@ -95,6 +95,11 @@ class SassExtensionsTest < Test::Unit::TestCase
|
|||||||
assert_equal "true", evaluate("prefixed(-css2, css2-fallback(css3, css2))")
|
assert_equal "true", evaluate("prefixed(-css2, css2-fallback(css3, css2))")
|
||||||
end
|
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
|
protected
|
||||||
def evaluate(value)
|
def evaluate(value)
|
||||||
Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
|
Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
|
||||||
|
Loading…
Reference in New Issue
Block a user