mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] qweb/attributes: uncomment two tests
- textarea with t-att-value - select with t-att-value
This commit is contained in:
@@ -667,6 +667,36 @@ exports[`special cases for some specific html attributes/properties input with t
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`special cases for some specific html attributes/properties select with t-att-value 1`] = `
|
||||||
|
"function anonymous(bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||||
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<select block-attribute-0=\\"value\\"><option value=\\"potato\\">Potato</option><option value=\\"tomato\\">Tomato</option><option value=\\"onion\\">Onion</option></select>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
let d1 = ctx['value'];
|
||||||
|
return block1([d1]);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`special cases for some specific html attributes/properties textarea with t-att-value 1`] = `
|
||||||
|
"function anonymous(bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||||
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<textarea block-attribute-0=\\"value\\"/>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
let d1 = ctx['v'];
|
||||||
|
return block1([d1]);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`special cases for some specific html attributes/properties various boolean html attributes 1`] = `
|
exports[`special cases for some specific html attributes/properties various boolean html attributes 1`] = `
|
||||||
"function anonymous(bdom, helpers
|
"function anonymous(bdom, helpers
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -380,12 +380,13 @@ describe("special cases for some specific html attributes/properties", () => {
|
|||||||
expect(input.indeterminate).toBe(true);
|
expect(input.indeterminate).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip("textarea with t-att-value", () => {
|
test("textarea with t-att-value", () => {
|
||||||
// render input with initial value
|
// render textarea with initial value
|
||||||
/* qweb.addTemplate("test", `<textarea t-att-value="v"/>`);
|
const template = `<textarea t-att-value="v"/>`;
|
||||||
const vnode1 = qweb.render("test", { v: "zucchini" });
|
const bnode1 = renderToBdom(template, { v: "zucchini" });
|
||||||
const vnode2 = patch(document.createElement("textarea"), vnode1);
|
const fixture = makeTestFixture();
|
||||||
let elm = vnode2.elm as HTMLInputElement;
|
mount(bnode1, fixture);
|
||||||
|
const elm = fixture.querySelector("textarea")!;
|
||||||
expect(elm.value).toBe("zucchini");
|
expect(elm.value).toBe("zucchini");
|
||||||
|
|
||||||
// change value manually in textarea, to simulate user textarea
|
// change value manually in textarea, to simulate user textarea
|
||||||
@@ -394,22 +395,22 @@ describe("special cases for some specific html attributes/properties", () => {
|
|||||||
|
|
||||||
// rerender with a different value, and patch actual dom, to check that
|
// rerender with a different value, and patch actual dom, to check that
|
||||||
// textarea value was properly reset by owl
|
// textarea value was properly reset by owl
|
||||||
const vnode3 = qweb.render("test", { v: "potato" });
|
const bnode2 = renderToBdom(template, { v: "potato" });
|
||||||
patch(vnode2, vnode3);
|
patch(bnode1, bnode2);
|
||||||
expect(elm.value).toBe("potato");*/
|
expect(elm.value).toBe("potato");
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip("select with t-att-value", () => {
|
test("select with t-att-value", () => {
|
||||||
/* const template = `
|
const template = `
|
||||||
<select t-att-value="value">
|
<select t-att-value="value">
|
||||||
<option value="potato">Potato</option>
|
<option value="potato">Potato</option>
|
||||||
<option value="tomato">Tomato</option>
|
<option value="tomato">Tomato</option>
|
||||||
<option value="onion">Onion</option>
|
<option value="onion">Onion</option>
|
||||||
</select>`;
|
</select>`;
|
||||||
qweb.addTemplate("test", template);
|
const bnode1 = renderToBdom(template, { value: "tomato" });
|
||||||
const vnode1 = qweb.render("test", { value: "tomato" });
|
const fixture = makeTestFixture();
|
||||||
const vnode2 = patch(document.createElement("select"), vnode1);
|
mount(bnode1, fixture);
|
||||||
let elm = vnode2.elm as HTMLSelectElement;
|
const elm = fixture.querySelector("select")!;
|
||||||
expect(elm.value).toBe("tomato");
|
expect(elm.value).toBe("tomato");
|
||||||
|
|
||||||
elm.value = "potato";
|
elm.value = "potato";
|
||||||
@@ -417,9 +418,8 @@ describe("special cases for some specific html attributes/properties", () => {
|
|||||||
|
|
||||||
// rerender with a different value, and patch actual dom, to check that
|
// rerender with a different value, and patch actual dom, to check that
|
||||||
// select value was properly reset by owl
|
// select value was properly reset by owl
|
||||||
const vnode3 = qweb.render("test", { value: "onion" });
|
const bnode2 = renderToBdom(template, { value: "onion" });
|
||||||
patch(vnode2, vnode3);
|
patch(bnode1, bnode2);
|
||||||
expect(elm.value).toBe("onion");
|
expect(elm.value).toBe("onion");
|
||||||
expect(qweb.templates.test.fn.toString()).toMatchSnapshot();*/
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user