fix: context for group_by_exp/where_exp/find_exp, #790

This commit is contained in:
Harttle
2025-01-19 17:53:25 +08:00
committed by Jun Yang
parent b070594fc7
commit a5070af3e4
2 changed files with 23 additions and 3 deletions
+14
View File
@@ -522,6 +522,20 @@ describe('filters/array', function () {
- Garlic press
`)
})
it('should be aware context', function () {
const tpl = `{% assign kitchen_products = products | where_exp: "item", "item.type == target" %}
Kitchen products:
{% for product in kitchen_products -%}
- {{ product.title }}
{% endfor %}`
const scope = { products, target: 'kitchen' }
const html = `
Kitchen products:
- Spatula
- Garlic press
`
return test(tpl, scope, html)
})
})
describe('group_by', function () {
const members = [