From c71db28bc6248b612585b25e911a7990eb0c362f Mon Sep 17 00:00:00 2001 From: Bruno Boi Date: Mon, 25 Oct 2021 09:30:58 +0200 Subject: [PATCH] [FIX] qweb: reintroduce test on t-debug --- .../__snapshots__/t_debug_log.test.ts.snap | 31 +++++++++++++++++++ tests/qweb/t_debug_log.test.ts | 18 +++-------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/tests/qweb/__snapshots__/t_debug_log.test.ts.snap b/tests/qweb/__snapshots__/t_debug_log.test.ts.snap index a8287e96..c43d5a6e 100644 --- a/tests/qweb/__snapshots__/t_debug_log.test.ts.snap +++ b/tests/qweb/__snapshots__/t_debug_log.test.ts.snap @@ -21,6 +21,37 @@ exports[`debugging t-debug 1`] = ` }" `; +exports[`debugging t-debug on sub template 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 } = helpers; + + let block1 = createBlock(\`

coucou

\`); + + return function template(ctx, node, key = \\"\\") { + debugger; + return block1(); + } +}" +`; + +exports[`debugging t-debug on sub template 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 } = helpers; + const callTemplate_2 = getTemplate(\`sub\`); + + let block1 = createBlock(\`
\`); + + return function template(ctx, node, key = \\"\\") { + let b2 = callTemplate_2(ctx, node, key + \`__1\`); + return block1([], [b2]); + } +}" +`; + exports[`debugging t-log 1`] = ` "function anonymous(bdom, helpers ) { diff --git a/tests/qweb/t_debug_log.test.ts b/tests/qweb/t_debug_log.test.ts index 59c25b3b..5d44345e 100644 --- a/tests/qweb/t_debug_log.test.ts +++ b/tests/qweb/t_debug_log.test.ts @@ -14,19 +14,11 @@ describe("debugging", () => { console.log = consoleLog; }); - test.skip("t-debug on sub template", () => { - // const consoleLog = console.log; - // console.log = jest.fn(); - // qweb.addTemplates(` - // - //

coucou

- //
- // - //
- //
`); - // qweb.render("test"); - // expect(console.log).toHaveBeenCalledTimes(1); - // console.log = consoleLog; + test("t-debug on sub template", () => { + let template = `

coucou

`; + snapshotTemplateCode(template); + template = `
`; + snapshotTemplateCode(template); }); test("t-log", () => {