feat: allow drops in property access (#769)

This commit is contained in:
Santi Albo
2024-11-17 20:24:45 +08:00
committed by GitHub
parent ad039abea0
commit 11f013bf24
3 changed files with 19 additions and 7 deletions
+10
View File
@@ -50,6 +50,16 @@ describe('Expression', function () {
expect(await toPromise(create('foo[doo["foo"]]').evaluate(ctx, false))).toBe('BAR')
expect(await toPromise(create('doo[coo].foo').evaluate(ctx, false))).toBe('bar')
})
it('should support drops in property access', async function () {
class TemplateDrop extends Drop {
valueOf () { return 'bar' }
}
const ctx = new Context({
foo: { bar: 'BAR' },
coo: new TemplateDrop()
})
expect(await toPromise(create('foo[coo]').evaluate(ctx, false))).toBe('BAR')
})
})
describe('simple expression', function () {