mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: nested property for the where filter, #178
This commit is contained in:
@@ -169,5 +169,22 @@ Available products:
|
||||
- Boring sneakers
|
||||
`)
|
||||
})
|
||||
it('should support nested property', async function () {
|
||||
const authors = [
|
||||
{ name: 'Alice', books: { year: 2019 } },
|
||||
{ name: 'Bob', books: { year: 2018 } }
|
||||
]
|
||||
const html = await liquid.parseAndRender(
|
||||
`{% assign recentAuthors = authors | where: 'books.year', 2019 %}
|
||||
Recent Authors:
|
||||
{%- for author in recentAuthors %}
|
||||
- {{author.name}}
|
||||
{%- endfor %}`,
|
||||
{ authors }
|
||||
)
|
||||
expect(html).to.equal(`
|
||||
Recent Authors:
|
||||
- Alice`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user