mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
Allow multiple binary operator in where_exp filter (#8047)
Merge pull request 8047
This commit is contained in:
@@ -997,6 +997,23 @@ class TestFilters < JekyllUnitTest
|
||||
)
|
||||
end
|
||||
|
||||
should "filter objects across multiple conditions" do
|
||||
sample = [
|
||||
{ "color" => "teal", "size" => "large", "type" => "variable" },
|
||||
{ "color" => "red", "size" => "large", "type" => "fixed" },
|
||||
{ "color" => "red", "size" => "medium", "type" => "variable" },
|
||||
{ "color" => "blue", "size" => "medium", "type" => "fixed" },
|
||||
]
|
||||
assert_equal(
|
||||
[
|
||||
{ "color" => "red", "size" => "large", "type" => "fixed" },
|
||||
],
|
||||
@filter.where_exp(
|
||||
sample, "item", "item.type == 'fixed' and item.color == 'red' or item.color == 'teal'"
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
should "stringify during comparison for compatibility with liquid parsing" do
|
||||
hash = {
|
||||
"The Words" => { "rating" => 1.2, "featured" => false },
|
||||
|
||||
Reference in New Issue
Block a user