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`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
|
||||
@@ -380,12 +380,13 @@ describe("special cases for some specific html attributes/properties", () => {
|
||||
expect(input.indeterminate).toBe(true);
|
||||
});
|
||||
|
||||
test.skip("textarea with t-att-value", () => {
|
||||
// render input with initial value
|
||||
/* qweb.addTemplate("test", `<textarea t-att-value="v"/>`);
|
||||
const vnode1 = qweb.render("test", { v: "zucchini" });
|
||||
const vnode2 = patch(document.createElement("textarea"), vnode1);
|
||||
let elm = vnode2.elm as HTMLInputElement;
|
||||
test("textarea with t-att-value", () => {
|
||||
// render textarea with initial value
|
||||
const template = `<textarea t-att-value="v"/>`;
|
||||
const bnode1 = renderToBdom(template, { v: "zucchini" });
|
||||
const fixture = makeTestFixture();
|
||||
mount(bnode1, fixture);
|
||||
const elm = fixture.querySelector("textarea")!;
|
||||
expect(elm.value).toBe("zucchini");
|
||||
|
||||
// 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
|
||||
// textarea value was properly reset by owl
|
||||
const vnode3 = qweb.render("test", { v: "potato" });
|
||||
patch(vnode2, vnode3);
|
||||
expect(elm.value).toBe("potato");*/
|
||||
const bnode2 = renderToBdom(template, { v: "potato" });
|
||||
patch(bnode1, bnode2);
|
||||
expect(elm.value).toBe("potato");
|
||||
});
|
||||
|
||||
test.skip("select with t-att-value", () => {
|
||||
/* const template = `
|
||||
test("select with t-att-value", () => {
|
||||
const template = `
|
||||
<select t-att-value="value">
|
||||
<option value="potato">Potato</option>
|
||||
<option value="tomato">Tomato</option>
|
||||
<option value="onion">Onion</option>
|
||||
</select>`;
|
||||
qweb.addTemplate("test", template);
|
||||
const vnode1 = qweb.render("test", { value: "tomato" });
|
||||
const vnode2 = patch(document.createElement("select"), vnode1);
|
||||
let elm = vnode2.elm as HTMLSelectElement;
|
||||
const bnode1 = renderToBdom(template, { value: "tomato" });
|
||||
const fixture = makeTestFixture();
|
||||
mount(bnode1, fixture);
|
||||
const elm = fixture.querySelector("select")!;
|
||||
expect(elm.value).toBe("tomato");
|
||||
|
||||
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
|
||||
// select value was properly reset by owl
|
||||
const vnode3 = qweb.render("test", { value: "onion" });
|
||||
patch(vnode2, vnode3);
|
||||
const bnode2 = renderToBdom(template, { value: "onion" });
|
||||
patch(bnode1, bnode2);
|
||||
expect(elm.value).toBe("onion");
|
||||
expect(qweb.templates.test.fn.toString()).toMatchSnapshot();*/
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user