mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] components: crash when using unknown suffix/modifiers
This commit is contained in:
@@ -142,17 +142,16 @@ describe("basics", () => {
|
||||
});
|
||||
|
||||
test("support prop names that aren't valid bare object property names", async () => {
|
||||
expect.assertions(4);
|
||||
expect.assertions(3);
|
||||
class Child extends Component {
|
||||
static template = xml`<button t-on-click="props.onClick"/>`;
|
||||
setup() {
|
||||
expect(this.props["some-dashed-prop"]).toBe(5);
|
||||
expect(this.props["a.b"]).toBe("keyword prop");
|
||||
}
|
||||
}
|
||||
|
||||
class Parent extends Component {
|
||||
static template = xml`<Child some-dashed-prop="5" a.b="'keyword prop'"/>`;
|
||||
static template = xml`<Child some-dashed-prop="5"/>`;
|
||||
static components = { Child };
|
||||
}
|
||||
await mount(Parent, fixture);
|
||||
@@ -225,3 +224,18 @@ test("bound functions is referentially equal after update", async () => {
|
||||
expect(fixture.innerHTML).toBe("3");
|
||||
expect(isEqual).toBe(true);
|
||||
});
|
||||
|
||||
test("throw if prop uses an unknown suffix", async () => {
|
||||
class Child extends Component {
|
||||
static template = xml`<t t-esc="props.val"/>`;
|
||||
}
|
||||
|
||||
class Parent extends Component {
|
||||
static template = xml`<Child val.somesuffix="state.val"/>`;
|
||||
static components = { Child };
|
||||
}
|
||||
|
||||
await expect(async () => {
|
||||
await mount(Parent, fixture);
|
||||
}).rejects.toThrowError("Invalid prop suffix");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user