mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: add support for t-att-value on textareas
The code did not treat textareas in the same way as inputs. As a result, using t-att-value on a textarea did not work. closes #872
This commit is contained in:
+1
-1
@@ -705,7 +705,7 @@ export class QWeb extends EventBus {
|
||||
isProp = key === "selected" || key === "disabled";
|
||||
break;
|
||||
case "textarea":
|
||||
isProp = key === "readonly" || key === "disabled";
|
||||
isProp = key === "readonly" || key === "disabled" || key === "value";
|
||||
break;
|
||||
case "button":
|
||||
case "select":
|
||||
|
||||
@@ -1931,6 +1931,25 @@ describe("special cases for some specific html attributes/properties", () => {
|
||||
let elm = vnode2.elm as HTMLInputElement;
|
||||
expect(elm.indeterminate).toBe(true);
|
||||
});
|
||||
|
||||
test("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;
|
||||
expect(elm.value).toBe("zucchini");
|
||||
|
||||
// change value manually in textarea, to simulate user textarea
|
||||
elm.value = "tomato";
|
||||
expect(elm.value).toBe("tomato");
|
||||
|
||||
// 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");
|
||||
});
|
||||
});
|
||||
|
||||
describe("whitespace handling", () => {
|
||||
|
||||
Reference in New Issue
Block a user