[IMP] qweb: add indeterminate to special input properties

Input with type="checkbox" have a special property (indeterminate) to
visually display the fact that the input value is non determinate (in my
chrome browser, the checkbox is then drawn with a simple - inside). It
does not actually modify the value of the input, only the way it is
displayed.

So, with this commit, owl will properly set the property, as expected.

closes #713
This commit is contained in:
Géry Debongnie
2020-09-17 17:26:19 +02:00
committed by aab-odoo
parent e032314739
commit d0c76c5854
3 changed files with 34 additions and 22 deletions
+2 -2
View File
@@ -1059,7 +1059,7 @@ exports[`properly support svg add proper namespace to svg 1`] = `
}"
`;
exports[`special cases for some boolean html attributes/properties input type= checkbox, with t-att-checked 1`] = `
exports[`special cases for some specific html attributes/properties input type= checkbox, with t-att-checked 1`] = `
"function anonymous(context, extra
) {
// Template name: \\"test\\"
@@ -1073,7 +1073,7 @@ exports[`special cases for some boolean html attributes/properties input type= c
}"
`;
exports[`special cases for some boolean html attributes/properties various boolean html attributes 1`] = `
exports[`special cases for some specific html attributes/properties various boolean html attributes 1`] = `
"function anonymous(context, extra
) {
// Template name: \\"test\\"
+9 -1
View File
@@ -1850,7 +1850,7 @@ describe("loading templates", () => {
});
});
describe("special cases for some boolean html attributes/properties", () => {
describe("special cases for some specific html attributes/properties", () => {
test("input type= checkbox, with t-att-checked", () => {
qweb.addTemplate("test", `<input type="checkbox" t-att-checked="flag"/>`);
const result = renderToString(qweb, "test", { flag: true });
@@ -1896,6 +1896,14 @@ describe("special cases for some boolean html attributes/properties", () => {
patch(vnode2, vnode3);
expect(elm.value).toBe("potato");
});
test("input of type checkbox with t-att-indeterminate", () => {
qweb.addTemplate("test", `<input type="checkbox" t-att-indeterminate="v"/>`);
const vnode1 = qweb.render("test", { v: true });
const vnode2 = patch(document.createElement("input"), vnode1);
let elm = vnode2.elm as HTMLInputElement;
expect(elm.indeterminate).toBe(true);
});
});
describe("whitespace handling", () => {