[IMP] parser: throw when using unsupported directive on component

This commit is contained in:
Samuel Degueldre
2021-11-24 08:06:07 +01:00
committed by Aaron Bohy
parent 93b88cad8d
commit 4866ed8e8a
2 changed files with 42 additions and 5 deletions
+25 -1
View File
@@ -1069,7 +1069,31 @@ describe("qweb parser", () => {
test("component with event handler", async () => {
expect(() => parse(`<MyComponent t-on-click="someMethod"/>`)).toThrow(
"t-on is no longer supported on Component node. Consider passing a callback in props."
"t-on is no longer supported on components. Consider passing a callback in props."
);
});
test("component with t-ref", async () => {
expect(() => parse(`<MyComponent t-ref="something"/>`)).toThrow(
"t-ref is no longer supported on components. Consider exposing only the public part of the component's API through a callback prop."
);
});
test("component with t-att", async () => {
expect(() => parse(`<MyComponent t-att="something"/>`)).toThrow(
"t-att makes no sense on component: props are already treated as expressions"
);
});
test("component with t-attf", async () => {
expect(() => parse(`<MyComponent t-attf="something"/>`)).toThrow(
"t-attf is not supported on components: use template strings for string interpolation in props"
);
});
test("component with other unsupported directive", async () => {
expect(() => parse(`<MyComponent t-something="5"/>`)).toThrow(
"unsupported directive on Component: t-something"
);
});