mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: t-model on select with options with dynamic values
This commit is contained in:
committed by
Géry Debongnie
parent
0737bb39b4
commit
b208894d38
@@ -1132,6 +1132,81 @@ describe("qweb parser", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// t-model
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test("t-model select", async () => {
|
||||
expect(parse(`<select t-model="state.model"><option value="1" /></select>`)).toEqual({
|
||||
type: 2,
|
||||
tag: "select",
|
||||
dynamicTag: null,
|
||||
attrs: {},
|
||||
on: {},
|
||||
ref: null,
|
||||
content: [
|
||||
{
|
||||
type: 2,
|
||||
tag: "option",
|
||||
dynamicTag: null,
|
||||
attrs: { value: "1" },
|
||||
on: {},
|
||||
ref: null,
|
||||
content: [],
|
||||
model: null,
|
||||
ns: null,
|
||||
},
|
||||
],
|
||||
model: {
|
||||
baseExpr: "state",
|
||||
expr: "'model'",
|
||||
targetAttr: "value",
|
||||
specialInitTargetAttr: null,
|
||||
eventType: "change",
|
||||
shouldTrim: false,
|
||||
shouldNumberize: false,
|
||||
},
|
||||
ns: null,
|
||||
});
|
||||
});
|
||||
|
||||
test("t-model select dynamic options", async () => {
|
||||
expect(
|
||||
parse(`<select t-model="state.model"><option t-att-value="valueVar" /></select>`)
|
||||
).toEqual({
|
||||
type: 2,
|
||||
tag: "select",
|
||||
dynamicTag: null,
|
||||
attrs: {},
|
||||
on: {},
|
||||
ref: null,
|
||||
content: [
|
||||
{
|
||||
type: 2,
|
||||
tag: "option",
|
||||
dynamicTag: null,
|
||||
attrs: { "t-att-value": "valueVar" },
|
||||
on: {},
|
||||
ref: null,
|
||||
content: [],
|
||||
model: null,
|
||||
ns: null,
|
||||
},
|
||||
],
|
||||
model: {
|
||||
baseExpr: "state",
|
||||
expr: "'model'",
|
||||
targetAttr: "value",
|
||||
specialInitTargetAttr: null,
|
||||
eventType: "change",
|
||||
shouldTrim: false,
|
||||
shouldNumberize: false,
|
||||
hasDynamicChildren: true,
|
||||
},
|
||||
ns: null,
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// t-component
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user