[FIX] qweb: properly parse short object description

Before this commit, using an expression such as "{machin}" was compiled
in qweb into "{scope['machin']}" which is not valid.

With this commit, we instead transform it into "{machin:
scope['machin']}".

closes #885
This commit is contained in:
Géry Debongnie
2021-07-02 12:14:56 +02:00
committed by aab-odoo
parent d08ea63565
commit dabe7f9bfa
2 changed files with 21 additions and 1 deletions
+6
View File
@@ -200,4 +200,10 @@ describe("expression evaluation", () => {
test("works with builtin properties", () => {
expect(compileExpr("state.constructor.name", {})).toBe("scope['state'].constructor.name");
});
test("works with shortcut object key description", () => {
expect(compileExpr("{a}", {})).toBe("{a:scope['a']}");
expect(compileExpr("{a,b}", {})).toBe("{a:scope['a'],b:scope['b']}");
expect(compileExpr("{a,b:3,c}", {})).toBe("{a:scope['a'],b:3,c:scope['c']}");
});
});