From ca59adfa12aa744f8169425ddda551ea04cc0b1f Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 23 Dec 2011 16:53:48 -0800 Subject: [PATCH] Add a new helper function to reject values from a list. --- lib/compass/sass_extensions/functions/lists.rb | 2 +- test/units/sass_extensions_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/compass/sass_extensions/functions/lists.rb b/lib/compass/sass_extensions/functions/lists.rb index 384a270c..fd5a17ee 100644 --- a/lib/compass/sass_extensions/functions/lists.rb +++ b/lib/compass/sass_extensions/functions/lists.rb @@ -76,7 +76,7 @@ module Compass::SassExtensions::Functions::Lists # 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. diff --git a/test/units/sass_extensions_test.rb b/test/units/sass_extensions_test.rb index 569d49f0..a877911d 100644 --- a/test/units/sass_extensions_test.rb +++ b/test/units/sass_extensions_test.rb @@ -95,6 +95,11 @@ class SassExtensionsTest < Test::Unit::TestCase 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