diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 64515576..2c9ae62c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -405,18 +405,15 @@ function parseTEscNode(node: Element, ctx: ParsingContext): AST | null { if (!ast) { return tesc; } - if (ast && ast.type === ASTType.DomNode) { + if (ast.type === ASTType.DomNode) { return { ...ast, ref, content: [tesc], }; } - if (ast && ast.type === ASTType.TComponent) { - return { - ...ast, - slots: { default: tesc }, - }; + if (ast.type === ASTType.TComponent) { + throw new Error("t-esc is not supported on Component nodes"); } return tesc; } diff --git a/tests/compiler/parser.test.ts b/tests/compiler/parser.test.ts index 1b8f3b5d..bfc42348 100644 --- a/tests/compiler/parser.test.ts +++ b/tests/compiler/parser.test.ts @@ -1082,14 +1082,7 @@ describe("qweb parser", () => { }); test("component with t-esc", async () => { - expect(parse(``)).toEqual({ - type: ASTType.TComponent, - name: "MyComponent", - dynamicProps: null, - props: {}, - isDynamic: false, - slots: { default: { defaultValue: "", expr: "someValue", type: ASTType.TEsc } }, - }); + expect(() => parse(``)).toThrow("t-esc is not supported on Component nodes"); }); test("component with t-call", async () => { diff --git a/tests/components/__snapshots__/slots.test.ts.snap b/tests/components/__snapshots__/slots.test.ts.snap index f718c7fc..9498795c 100644 --- a/tests/components/__snapshots__/slots.test.ts.snap +++ b/tests/components/__snapshots__/slots.test.ts.snap @@ -1137,41 +1137,6 @@ exports[`slots slot and (inline) t-call 3`] = ` }" `; -exports[`slots slot and (inline) t-esc 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(\`\`); - - return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default'); - return block1([], [b2]); - } -}" -`; - -exports[`slots slot and (inline) t-esc 2`] = ` -"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 assign = Object.assign; - - let block1 = createBlock(\`
\`); - - const slot2 = ctx => (node, key) => { - return text('toph'); - } - - return function template(ctx, node, key = \\"\\") { - let b3 = assign(component(\`Dialog\`, {}, key + \`__1\`, node, ctx), {slots: {'default': slot2(ctx)}}); - return block1([], [b3]); - } -}" -`; - exports[`slots slot and t-call 1`] = ` "function anonymous(bdom, helpers ) { diff --git a/tests/components/slots.test.ts b/tests/components/slots.test.ts index 65c5b0ab..4db78079 100644 --- a/tests/components/slots.test.ts +++ b/tests/components/slots.test.ts @@ -1162,19 +1162,6 @@ describe("slots", () => { expect(fixture.innerHTML).toBe("
toph
"); }); - test("slot and (inline) t-esc", async () => { - class Dialog extends Component { - static template = xml``; - } - class Parent extends Component { - static template = xml`
`; - static components = { Dialog }; - } - await mount(Parent, fixture); - - expect(fixture.innerHTML).toBe("
toph
"); - }); - test("slot and t-call", async () => { let sokka = xml`

sokka

`; class Dialog extends Component {