diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts index b9df5324..60ea6292 100644 --- a/src/compiler/code_generator.ts +++ b/src/compiler/code_generator.ts @@ -216,10 +216,7 @@ export class CodeGenerator { translateFn: (s: string) => string; translatableAttributes: string[] = TRANSLATABLE_ATTRS; ast: AST; - staticCalls: { id: string; template: string }[] = []; - // todo: merge with staticCalls - // todo: add a setCodeValue function => 2 args, call addLine, use it instead of addlin - eventCatchers: { id: string; expr: string }[] = []; + staticDefs: { id: string; expr: string }[] = []; helpers: Set = new Set(); constructor(ast: AST, options: CodeGenOptions) { @@ -265,10 +262,7 @@ export class CodeGenerator { mainCode.push(`// Template name: "${this.templateName}"`); } - for (let { id, template } of this.staticCalls) { - mainCode.push(`const ${id} = getTemplate(${template});`); - } - for (let { id, expr } of this.eventCatchers) { + for (let { id, expr } of this.staticDefs) { mainCode.push(`const ${id} = ${expr};`); } @@ -321,8 +315,12 @@ export class CodeGenerator { return name; } - addLine(line: string) { - this.target.addLine(line); + addLine(line: string, idx?: number) { + this.target.addLine(line, idx); + } + + define(varName: string, expr: string) { + this.addLine(`const ${varName} = ${expr};`); } generateId(prefix: string = ""): string { @@ -376,7 +374,7 @@ export class CodeGenerator { if (block.isRoot && !ctx.preventRoot) { this.addLine(`return ${blockExpr};`); } else { - this.addLine(`let ${block.varName} = ${blockExpr};`); + this.define(block.varName, blockExpr); } } @@ -405,7 +403,7 @@ export class CodeGenerator { if (!mapping.has(tok.varName)) { const varId = this.generateId("v"); mapping.set(tok.varName, varId); - this.addLine(`const ${varId} = ${tok.value};`); + this.define(varId, tok.value); } tok.value = mapping.get(tok.varName)!; } @@ -550,7 +548,7 @@ export class CodeGenerator { this.blocks.push(block); if (ast.dynamicTag) { const tagExpr = this.generateId("tag"); - this.addLine(`let ${tagExpr} = ${compileExpr(ast.dynamicTag)};`); + this.define(tagExpr, compileExpr(ast.dynamicTag)); block.dynamicTagName = tagExpr; } } @@ -645,11 +643,11 @@ export class CodeGenerator { const baseExpression = compileExpr(baseExpr); const bExprId = this.generateId("bExpr"); - this.addLine(`const ${bExprId} = ${baseExpression};`); + this.define(bExprId, baseExpression); const expression = compileExpr(expr); const exprId = this.generateId("expr"); - this.addLine(`const ${exprId} = ${expression};`); + this.define(exprId, expression); const fullExpression = `${bExprId}[${exprId}]`; @@ -660,7 +658,7 @@ export class CodeGenerator { } else if (hasDynamicChildren) { const bValueId = this.generateId("bValue"); tModelSelectedExpr = `${bValueId}`; - this.addLine(`let ${tModelSelectedExpr} = ${fullExpression}`); + this.define(tModelSelectedExpr, fullExpression); } else { idx = block!.insertData(`${fullExpression}`, "attr"); attrs[`block-attribute-${idx}`] = targetAttr; @@ -710,13 +708,13 @@ export class CodeGenerator { const children = block!.children.slice(); let current = children.shift(); for (let i = codeIdx; i < code.length; i++) { - if (code[i].trimStart().startsWith(`let ${current!.varName} `)) { - code[i] = code[i].replace(`let ${current!.varName}`, current!.varName); + if (code[i].trimStart().startsWith(`const ${current!.varName} `)) { + code[i] = code[i].replace(`const ${current!.varName}`, current!.varName); current = children.shift(); if (!current) break; } } - this.target.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx); + this.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx); } } } @@ -805,13 +803,13 @@ export class CodeGenerator { const children = block!.children.slice(); let current = children.shift(); for (let i = codeIdx; i < code.length; i++) { - if (code[i].trimStart().startsWith(`let ${current!.varName} `)) { - code[i] = code[i].replace(`let ${current!.varName}`, current!.varName); + if (code[i].trimStart().startsWith(`const ${current!.varName} `)) { + code[i] = code[i].replace(`const ${current!.varName}`, current!.varName); current = children.shift(); if (!current) break; } } - this.target.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx); + this.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx); } // note: this part is duplicated from end of compilemulti: @@ -834,12 +832,10 @@ export class CodeGenerator { const l = `l_block${block.id}`; const c = `c_block${block.id}`; this.helpers.add("prepareList"); - this.addLine( - `const [${keys}, ${vals}, ${l}, ${c}] = prepareList(${compileExpr(ast.collection)});` - ); + this.define(`[${keys}, ${vals}, ${l}, ${c}]`, `prepareList(${compileExpr(ast.collection)});`); // Throw errors on duplicate keys in dev mode if (this.dev) { - this.addLine(`const keys${block.id} = new Set();`); + this.define(`keys${block.id}`, `new Set()`); } this.addLine(`for (let ${loopVar} = 0; ${loopVar} < ${l}; ${loopVar}++) {`); this.target.indentLevel++; @@ -856,7 +852,7 @@ export class CodeGenerator { if (!ast.hasNoValue) { this.addLine(`ctx[\`${ast.elem}_value\`] = ${keys}[${loopVar}];`); } - this.addLine(`let key${this.target.loopLevel} = ${ast.key ? compileExpr(ast.key) : loopVar};`); + this.define(`key${this.target.loopLevel}`, ast.key ? compileExpr(ast.key) : loopVar); if (this.dev) { // Throw error on duplicate keys in dev mode this.addLine( @@ -868,8 +864,8 @@ export class CodeGenerator { if (ast.memo) { this.target.hasCache = true; id = this.generateId(); - this.addLine(`let memo${id} = ${compileExpr(ast.memo)}`); - this.addLine(`let vnode${id} = cache[key${this.target.loopLevel}];`); + this.define(`memo${id}`, compileExpr(ast.memo)); + this.define(`vnode${id}`, `cache[key${this.target.loopLevel}];`); this.addLine(`if (vnode${id}) {`); this.target.indentLevel++; this.addLine(`if (shallowEqual(vnode${id}.memo, memo${id})) {`); @@ -903,7 +899,7 @@ export class CodeGenerator { compileTKey(ast: ASTTKey, ctx: Context) { const tKeyExpr = this.generateId("tKey_"); - this.addLine(`const ${tKeyExpr} = ${compileExpr(ast.expr)};`); + this.define(tKeyExpr, compileExpr(ast.expr)); ctx = createContext(ctx, { tKeyExpr, block: ctx.block, @@ -949,13 +945,13 @@ export class CodeGenerator { const children = block!.children.slice(); let current = children.shift(); for (let i = codeIdx; i < code.length; i++) { - if (code[i].trimStart().startsWith(`let ${current!.varName} `)) { - code[i] = code[i].replace(`let ${current!.varName}`, current!.varName); + if (code[i].trimStart().startsWith(`const ${current!.varName} `)) { + code[i] = code[i].replace(`const ${current!.varName}`, current!.varName); current = children.shift(); if (!current) break; } } - this.target.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx); + this.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx); } } @@ -988,7 +984,7 @@ export class CodeGenerator { const key = `key + \`${this.generateComponentKey()}\``; if (isDynamic) { const templateVar = this.generateId("template"); - this.addLine(`const ${templateVar} = ${subTemplate};`); + this.define(templateVar, subTemplate); block = this.createBlock(block, "multi", ctx); this.helpers.add("call"); this.insertBlock(`call(this, ${templateVar}, ctx, node, ${key})`, block!, { @@ -998,7 +994,7 @@ export class CodeGenerator { } else { const id = this.generateId(`callTemplate_`); this.helpers.add("getTemplate"); - this.staticCalls.push({ id, template: subTemplate }); + this.staticDefs.push({ id, expr: `getTemplate(${subTemplate})` }); block = this.createBlock(block, "multi", ctx); this.insertBlock(`${id}.call(this, ctx, node, ${key})`, block!, { ...ctx, @@ -1110,7 +1106,7 @@ export class CodeGenerator { if (this.target.loopLevel || !this.hasSafeContext) { ctxStr = this.generateId("ctx"); this.helpers.add("capture"); - this.addLine(`const ${ctxStr} = capture(ctx);`); + this.define(ctxStr, `capture(ctx)`); } let slotStr: string[] = []; for (let slotName in ast.slots) { @@ -1147,7 +1143,7 @@ export class CodeGenerator { let propVar: string; if ((slotDef && (ast.dynamicProps || hasSlotsProp)) || this.dev) { propVar = this.generateId("props"); - this.addLine(`const ${propVar!} = ${propString};`); + this.define(propVar!, propString); propString = propVar!; } @@ -1161,7 +1157,7 @@ export class CodeGenerator { let expr: string; if (ast.isDynamic) { expr = this.generateId("Comp"); - this.addLine(`let ${expr} = ${compileExpr(ast.name)};`); + this.define(expr, compileExpr(ast.name)); } else { expr = `\`${ast.name}\``; } @@ -1196,10 +1192,10 @@ export class CodeGenerator { let idx = handlers.push(handlerId) - 1; spec[ev] = idx; const handler = this.generateHandlerCode(ev, ast.on[ev]); - this.addLine(`let ${handlerId} = ${handler};`); + this.define(handlerId, handler); } blockExpr = `${name}(${blockExpr}, [${handlers.join(",")}])`; - this.eventCatchers.push({ id: name, expr: `createCatcher(${JSON.stringify(spec)})` }); + this.staticDefs.push({ id: name, expr: `createCatcher(${JSON.stringify(spec)})` }); } block = this.createBlock(block, "multi", ctx); this.insertBlock(blockExpr, block, ctx); @@ -1225,7 +1221,7 @@ export class CodeGenerator { } else { if (dynamic) { let name = this.generateId("slot"); - this.addLine(`const ${name} = ${slotName};`); + this.define(name, slotName); blockString = `toggler(${name}, callSlot(ctx, node, key, ${name}), ${dynamic}, ${scope})`; } else { blockString = `callSlot(ctx, node, key, ${slotName}, ${dynamic}, ${scope})`; @@ -1253,7 +1249,7 @@ export class CodeGenerator { if (this.target.loopLevel || !this.hasSafeContext) { ctxStr = this.generateId("ctx"); this.helpers.add("capture"); - this.addLine(`const ${ctxStr} = capture(ctx);`); + this.define(ctxStr, `capture(ctx);`); } const blockString = `component(Portal, {target: ${ast.target},slots: {'default': {__render: ${name}, __ctx: ${ctxStr}}}}, key + \`${key}\`, node, ctx)`; if (block) { diff --git a/tests/__snapshots__/reactivity.test.ts.snap b/tests/__snapshots__/reactivity.test.ts.snap index 112efe77..64d37552 100644 --- a/tests/__snapshots__/reactivity.test.ts.snap +++ b/tests/__snapshots__/reactivity.test.ts.snap @@ -131,7 +131,7 @@ exports[`Reactivity: useState parent and children subscribed to same context 1`] let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); let txt1 = ctx['contextObj'].b; return block1([txt1], [b2]); } @@ -223,8 +223,8 @@ exports[`Reactivity: useState two components are updated in parallel 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); - let b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx); return block1([], [b2, b3]); } }" @@ -252,8 +252,8 @@ exports[`Reactivity: useState two components can subscribe to same context 1`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); - let b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx); return block1([], [b2, b3]); } }" @@ -281,8 +281,8 @@ exports[`Reactivity: useState two independent components on different levels are let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); - let b3 = component(\`Parent\`, {}, key + \`__2\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b3 = component(\`Parent\`, {}, key + \`__2\`, node, ctx); return block1([], [b2, b3]); } }" @@ -310,7 +310,7 @@ exports[`Reactivity: useState two independent components on different levels are let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -340,14 +340,14 @@ exports[`Reactivity: useState useless atoms should be deleted 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(Object.keys(ctx['state'])); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(Object.keys(ctx['state']));; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`id\`] = v_block2[i1]; - let key1 = ctx['id']; + const key1 = ctx['id']; c_block2[i1] = withKey(component(\`Quantity\`, {id: ctx['id']}, key + \`__1__\${key1}\`, node, ctx), key1); } ctx = ctx.__proto__; - let b2 = list(c_block2); + const b2 = list(c_block2); let txt1 = ctx['total']; let txt2 = Object.keys(ctx['state']).length; return block1([txt1, txt2], [b2]); diff --git a/tests/compiler/__snapshots__/event_handling.test.ts.snap b/tests/compiler/__snapshots__/event_handling.test.ts.snap index f1aba25b..cb43eb5d 100644 --- a/tests/compiler/__snapshots__/event_handling.test.ts.snap +++ b/tests/compiler/__snapshots__/event_handling.test.ts.snap @@ -70,17 +70,17 @@ exports[`t-on can bind handlers with empty object (with non empty inner string) return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(['someval']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(['someval']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`action\`] = v_block2[i1]; ctx[\`action_index\`] = i1; - let key1 = ctx['action_index']; + const key1 = ctx['action_index']; const v1 = ctx['activate']; const v2 = ctx['action']; let hdlr1 = [()=>v1(v2), ctx]; c_block2[i1] = withKey(block3([hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -140,10 +140,10 @@ exports[`t-on handler is bound to proper owner, part 2 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]); + const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`value\`] = v_block1[i1]; - let key1 = ctx['value']; + const key1 = ctx['value']; let hdlr1 = [ctx['add'], ctx]; c_block1[i1] = withKey(block2([hdlr1]), key1); } @@ -188,14 +188,14 @@ exports[`t-on handler is bound to proper owner, part 4 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]); + const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`value\`] = v_block1[i1]; ctx[\`value_first\`] = i1 === 0; ctx[\`value_last\`] = i1 === v_block1.length - 1; ctx[\`value_index\`] = i1; ctx[\`value_value\`] = k_block1[i1]; - let key1 = ctx['value']; + const key1 = ctx['value']; c_block1[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); } return list(c_block1); @@ -271,7 +271,7 @@ exports[`t-on t-on modifiers (native listener) t-on combined with t-out 1`] = ` return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['onClick'], ctx]; - let b2 = safeOutput(ctx['html']); + const b2 = safeOutput(ctx['html']); return block1([hdlr1], [b2]); } }" @@ -347,17 +347,17 @@ exports[`t-on t-on modifiers (native listener) t-on with prevent modifier in t-f return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`project\`] = v_block2[i1]; - let key1 = ctx['project']; + const key1 = ctx['project']; const v1 = ctx['onEdit']; const v2 = ctx['project']; let hdlr1 = [\\"prevent\\", _ev=>v1(v2.id,_ev), ctx]; let txt1 = ctx['project'].name; c_block2[i1] = withKey(block3([hdlr1, txt1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -478,7 +478,7 @@ exports[`t-on t-on with t-call 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -508,7 +508,7 @@ exports[`t-on t-on, with arguments and t-call 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/misc.test.ts.snap b/tests/compiler/__snapshots__/misc.test.ts.snap index 57fe3adc..7c414086 100644 --- a/tests/compiler/__snapshots__/misc.test.ts.snap +++ b/tests/compiler/__snapshots__/misc.test.ts.snap @@ -30,28 +30,28 @@ exports[`misc complex template 1`] = ` b3 = block3(); } ctx = Object.create(ctx); - const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['batch'].slot_ids.filter(_slot=>_slot.build_id.id&&!_slot.trigger_id.manual&&(ctx['options'].trigger_display[_slot.trigger_id.id]))); + const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['batch'].slot_ids.filter(_slot=>_slot.build_id.id&&!_slot.trigger_id.manual&&(ctx['options'].trigger_display[_slot.trigger_id.id])));; for (let i1 = 0; i1 < l_block4; i1++) { ctx[\`slot\`] = v_block4[i1]; - let key1 = ctx['slot'].id; + const key1 = ctx['slot'].id; c_block4[i1] = withKey(component(\`SlotButton\`, {class: ctx['slot_container'], slot: ctx['slot']}, key + \`__1__\${key1}\`, node, ctx), key1); } ctx = ctx.__proto__; b4 = list(c_block4); ctx = Object.create(ctx); - const [k_block6, v_block6, l_block6, c_block6] = prepareList([1,2,3,4]); + const [k_block6, v_block6, l_block6, c_block6] = prepareList([1,2,3,4]);; for (let i1 = 0; i1 < l_block6; i1++) { ctx[\`x\`] = v_block6[i1]; - let key1 = ctx['x']; + const key1 = ctx['x']; c_block6[i1] = withKey(block7(), key1); } ctx = ctx.__proto__; b6 = list(c_block6); ctx = Object.create(ctx); - const [k_block8, v_block8, l_block8, c_block8] = prepareList(ctx['commit_links']); + const [k_block8, v_block8, l_block8, c_block8] = prepareList(ctx['commit_links']);; for (let i1 = 0; i1 < l_block8; i1++) { ctx[\`commit_link\`] = v_block8[i1]; - let key1 = ctx['commit_link'].id; + const key1 = ctx['commit_link'].id; let b10,b11,b12,b13; let attr5 = \`/runbot/commit/\${ctx['commit_link'].commit_id}\`; let attr6 = \`badge badge-light batch_commit match_type_\${ctx['commit_link'].match_type}\`; @@ -96,35 +96,35 @@ exports[`misc global 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([4,5,6]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([4,5,6]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`value\`] = v_block2[i1]; ctx[\`value_first\`] = i1 === 0; ctx[\`value_last\`] = i1 === v_block2.length - 1; ctx[\`value_index\`] = i1; ctx[\`value_value\`] = k_block2[i1]; - let key1 = ctx['value']; + const key1 = ctx['value']; let txt1 = ctx['value']; - let b4 = block4([txt1]); + const b4 = block4([txt1]); ctx = Object.create(ctx); ctx[isBoundary] = 1; ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"foo\\", 'aaa'); - let b6 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`); + const b6 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`); ctx = ctx.__proto__; - let b7 = callTemplate_2.call(this, ctx, node, key + \`__2__\${key1}\`); + const b7 = callTemplate_2.call(this, ctx, node, key + \`__2__\${key1}\`); setContextValue(ctx, \\"foo\\", 'bbb'); - let b8 = callTemplate_3.call(this, ctx, node, key + \`__3__\${key1}\`); - let b5 = multi([b6, b7, b8]); + const b8 = callTemplate_3.call(this, ctx, node, key + \`__3__\${key1}\`); + const b5 = multi([b6, b7, b8]); ctx[zero] = b5; - let b9 = callTemplate_4.call(this, ctx, node, key + \`__4__\${key1}\`); + const b9 = callTemplate_4.call(this, ctx, node, key + \`__4__\${key1}\`); ctx = ctx.__proto__; c_block2[i1] = withKey(multi([b4, b9]), key1); } ctx = ctx.__proto__; - let b2 = list(c_block2); - let b10 = callTemplate_5.call(this, ctx, node, key + \`__5\`); + const b2 = list(c_block2); + const b10 = callTemplate_5.call(this, ctx, node, key + \`__5\`); return block1([], [b2, b10]); } }" @@ -155,7 +155,7 @@ exports[`misc global 3`] = ` return function template(ctx, node, key = \\"\\") { let attr1 = 'agüero'; - let b2 = ctx[zero]; + const b2 = ctx[zero]; return block1([attr1], [b2]); } }" @@ -170,8 +170,8 @@ exports[`misc global 4`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b3 = text(\`toto default\`); - let b2 = withDefault(safeOutput(ctx['toto']), b3); + const b3 = text(\`toto default\`); + const b2 = withDefault(safeOutput(ctx['toto']), b3); return block1([], [b2]); } }" @@ -221,10 +221,10 @@ exports[`misc other complex template 1`] = ` let attr1 = \`/runbot/\${ctx['project'].slug}\`; let txt1 = ctx['project'].name; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`project\`] = v_block2[i1]; - let key1 = ctx['project'].id; + const key1 = ctx['project'].id; let hdlr1 = [ctx['selectProject'](ctx['project']), ctx]; let txt2 = ctx['project'].name; c_block2[i1] = withKey(block3([hdlr1, txt2]), key1); @@ -241,12 +241,12 @@ exports[`misc other complex template 1`] = ` if (ctx['nb_assigned_errors']&&ctx['nb_assigned_errors']>0) { let attr3 = \`You have \${ctx['nb_assigned_errors']} random bug assigned\`; let txt3 = ctx['nb_assigned_errors']; - let b8 = block8([attr3, txt3]); - let b9 = block9(); + const b8 = block8([attr3, txt3]); + const b9 = block9(); b7 = multi([b8, b9]); } else if (ctx['nb_build_errors']&&ctx['nb_build_errors']>0) { - let b11 = block11(); - let b12 = block12(); + const b11 = block11(); + const b12 = block12(); b10 = multi([b11, b12]); } let txt4 = ctx['user'].name.length>25?ctx['user'].namesubstring(0,23)+'...':ctx['user'].name; @@ -261,17 +261,17 @@ exports[`misc other complex template 1`] = ` let hdlr3 = [ctx['toggleMore'], ctx]; if (ctx['categories']&&ctx['categories'].length>1) { ctx = Object.create(ctx); - const [k_block15, v_block15, l_block15, c_block15] = prepareList(ctx['categories']); + const [k_block15, v_block15, l_block15, c_block15] = prepareList(ctx['categories']);; for (let i1 = 0; i1 < l_block15; i1++) { ctx[\`category\`] = v_block15[i1]; - let key1 = ctx['category'].id; + const key1 = ctx['category'].id; let attr6 = ctx['category'].id; let attr7 = ctx['category'].id==ctx['options'].active_category_id; let txt5 = ctx['category'].name; c_block15[i1] = withKey(block16([attr6, attr7, txt5]), key1); } ctx = ctx.__proto__; - let b15 = list(c_block15); + const b15 = list(c_block15); b14 = block14([], [b15]); } let attr8 = ctx['search'].value; @@ -280,10 +280,10 @@ exports[`misc other complex template 1`] = ` let hdlr6 = [ctx['clearSearch'], ctx]; if (ctx['triggers']) { ctx = Object.create(ctx); - const [k_block18, v_block18, l_block18, c_block18] = prepareList(ctx['triggers']); + const [k_block18, v_block18, l_block18, c_block18] = prepareList(ctx['triggers']);; for (let i1 = 0; i1 < l_block18; i1++) { ctx[\`trigger\`] = v_block18[i1]; - let key1 = ctx['trigger'].id; + const key1 = ctx['trigger'].id; let b20; if (!ctx['trigger'].manual&&ctx['trigger'].project_id===ctx['project'].id&&ctx['trigger'].category_id===ctx['options'].active_category_id) { let attr9 = \`trigger_\${ctx['trigger'].id}\`; @@ -298,12 +298,12 @@ exports[`misc other complex template 1`] = ` c_block18[i1] = withKey(multi([b20]), key1); } ctx = ctx.__proto__; - let b18 = list(c_block18); + const b18 = list(c_block18); let hdlr8 = [ctx['triggerAll'], ctx]; let hdlr9 = [ctx['triggerNone'], ctx]; let hdlr10 = [ctx['triggerDefault'], ctx]; let hdlr11 = [ctx['toggleSettingsMenu'], ctx]; - let b21 = block21([hdlr8, hdlr9, hdlr10, hdlr11]); + const b21 = block21([hdlr8, hdlr9, hdlr10, hdlr11]); b17 = multi([b18, b21]); } if (ctx['load_infos']) { @@ -316,8 +316,8 @@ exports[`misc other complex template 1`] = ` if (!ctx['project']) { b24 = block24(); } else { - let b26 = component(\`BundlesList\`, {bundles: ctx['bundles'].sticky, category_custom_views: ctx['category_custom_views'], search: ctx['search']}, key + \`__2\`, node, ctx); - let b27 = component(\`BundlesList\`, {bundles: ctx['bundles'].dev, search: ctx['search']}, key + \`__3\`, node, ctx); + const b26 = component(\`BundlesList\`, {bundles: ctx['bundles'].sticky, category_custom_views: ctx['category_custom_views'], search: ctx['search']}, key + \`__2\`, node, ctx); + const b27 = component(\`BundlesList\`, {bundles: ctx['bundles'].dev, search: ctx['search']}, key + \`__3\`, node, ctx); b25 = block25([], [b26, b27]); } return block1([attr1, txt1, hdlr2, hdlr3, attr8, hdlr4, hdlr5, ref1, hdlr6, ref2], [b2, b4, b14, b17, b22, b23, b24, b25]); diff --git a/tests/compiler/__snapshots__/qweb_memory.test.ts.snap b/tests/compiler/__snapshots__/qweb_memory.test.ts.snap index fc769679..e5373afd 100644 --- a/tests/compiler/__snapshots__/qweb_memory.test.ts.snap +++ b/tests/compiler/__snapshots__/qweb_memory.test.ts.snap @@ -10,14 +10,14 @@ exports[`memory t-foreach does not leak stuff in global scope 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; ctx[\`item_index\`] = i1; - let key1 = ctx['item_index']; + const key1 = ctx['item_index']; c_block2[i1] = withKey(text(ctx['item']), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/simple_templates.test.ts.snap b/tests/compiler/__snapshots__/simple_templates.test.ts.snap index e1ecee37..ecfa4aeb 100644 --- a/tests/compiler/__snapshots__/simple_templates.test.ts.snap +++ b/tests/compiler/__snapshots__/simple_templates.test.ts.snap @@ -211,8 +211,8 @@ exports[`simple templates, mostly static multiple root nodes 1`] = ` let block3 = createBlock(\`hey\`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); - let b3 = block3(); + const b2 = block2(); + const b3 = block3(); return multi([b2, b3]); } }" @@ -246,8 +246,8 @@ exports[`simple templates, mostly static static text and dynamic text (no t tag) let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`hello \`); - let b3 = text(ctx['text']); + const b2 = text(\`hello \`); + const b3 = text(ctx['text']); return multi([b2, b3]); } }" @@ -259,8 +259,8 @@ exports[`simple templates, mostly static static text and dynamic text 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`hello \`); - let b3 = text(ctx['text']); + const b2 = text(\`hello \`); + const b3 = text(ctx['text']); return multi([b2, b3]); } }" @@ -347,8 +347,8 @@ exports[`simple templates, mostly static two t-escs next to each other 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['text1']); - let b3 = text(ctx['text2']); + const b2 = text(ctx['text1']); + const b3 = text(ctx['text2']); return multi([b2, b3]); } }" @@ -360,8 +360,8 @@ exports[`simple templates, mostly static two t-escs next to each other 2`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['text1']); - let b3 = text(ctx['text2']); + const b2 = text(ctx['text1']); + const b3 = text(ctx['text2']); return multi([b2, b3]); } }" diff --git a/tests/compiler/__snapshots__/svg.test.ts.snap b/tests/compiler/__snapshots__/svg.test.ts.snap index 44155ac4..0dc8d140 100644 --- a/tests/compiler/__snapshots__/svg.test.ts.snap +++ b/tests/compiler/__snapshots__/svg.test.ts.snap @@ -66,7 +66,7 @@ exports[`properly support svg svg creates new block if it is within html -- 2 1` if (ctx['hasPath']) { b3 = block3(); } - let b2 = block2([], [b3]); + const b2 = block2([], [b3]); return block1([], [b2]); } }" @@ -81,7 +81,7 @@ exports[`properly support svg svg creates new block if it is within html 1`] = ` let block2 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); + const b2 = block2(); return block1([], [b2]); } }" @@ -97,7 +97,7 @@ exports[`properly support svg svg namespace added to sub templates if root tag i let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_call.test.ts.snap b/tests/compiler/__snapshots__/t_call.test.ts.snap index a1dbd890..df7c7cdd 100644 --- a/tests/compiler/__snapshots__/t_call.test.ts.snap +++ b/tests/compiler/__snapshots__/t_call.test.ts.snap @@ -10,7 +10,7 @@ exports[`t-call (template calling) basic caller 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -69,12 +69,12 @@ exports[`t-call (template calling) call with several sub nodes on same line 1`] return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b3 = block3(); - let b4 = text(\` \`); - let b5 = block5(); - let b2 = multi([b3, b4, b5]); + const b3 = block3(); + const b4 = text(\` \`); + const b5 = block5(); + const b2 = multi([b3, b4, b5]); ctx[zero] = b2; - let b6 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b6 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b6]); } }" @@ -89,7 +89,7 @@ exports[`t-call (template calling) call with several sub nodes on same line 2`] let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = ctx[zero]; + const b2 = ctx[zero]; return block1([], [b2]); } }" @@ -109,12 +109,12 @@ exports[`t-call (template calling) cascading t-call t-out='0' 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b3 = block3(); - let b4 = text(\` \`); - let b5 = block5(); - let b2 = multi([b3, b4, b5]); + const b3 = block3(); + const b4 = text(\` \`); + const b5 = block5(); + const b2 = multi([b3, b4, b5]); ctx[zero] = b2; - let b6 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b6 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b6]); } }" @@ -133,11 +133,11 @@ exports[`t-call (template calling) cascading t-call t-out='0' 2`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b3 = block3(); - let b4 = ctx[zero]; - let b2 = multi([b3, b4]); + const b3 = block3(); + const b4 = ctx[zero]; + const b2 = multi([b3, b4]); ctx[zero] = b2; - let b5 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b5 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b5]); } }" @@ -156,11 +156,11 @@ exports[`t-call (template calling) cascading t-call t-out='0' 3`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b3 = block3(); - let b4 = ctx[zero]; - let b2 = multi([b3, b4]); + const b3 = block3(); + const b4 = ctx[zero]; + const b2 = multi([b3, b4]); ctx[zero] = b2; - let b5 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b5 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b5]); } }" @@ -175,7 +175,7 @@ exports[`t-call (template calling) cascading t-call t-out='0' 4`] = ` let block1 = createBlock(\`
cascade 2
\`); return function template(ctx, node, key = \\"\\") { - let b2 = ctx[zero]; + const b2 = ctx[zero]; return block1([], [b2]); } }" @@ -194,10 +194,10 @@ exports[`t-call (template calling) cascading t-call t-out='0', without external return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b2 = block2(); - let b3 = text(\` \`); - let b4 = block4(); - let b1 = multi([b2, b3, b4]); + const b2 = block2(); + const b3 = text(\` \`); + const b4 = block4(); + const b1 = multi([b2, b3, b4]); ctx[zero] = b1; return callTemplate_1.call(this, ctx, node, key + \`__1\`); } @@ -216,9 +216,9 @@ exports[`t-call (template calling) cascading t-call t-out='0', without external return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b2 = block2(); - let b3 = ctx[zero]; - let b1 = multi([b2, b3]); + const b2 = block2(); + const b3 = ctx[zero]; + const b1 = multi([b2, b3]); ctx[zero] = b1; return callTemplate_1.call(this, ctx, node, key + \`__1\`); } @@ -237,9 +237,9 @@ exports[`t-call (template calling) cascading t-call t-out='0', without external return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b2 = block2(); - let b3 = ctx[zero]; - let b1 = multi([b2, b3]); + const b2 = block2(); + const b3 = ctx[zero]; + const b1 = multi([b2, b3]); ctx[zero] = b1; return callTemplate_1.call(this, ctx, node, key + \`__1\`); } @@ -255,8 +255,8 @@ exports[`t-call (template calling) cascading t-call t-out='0', without external let block2 = createBlock(\`cascade 2\`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); - let b3 = ctx[zero]; + const b2 = block2(); + const b3 = ctx[zero]; return multi([b2, b3]); } }" @@ -272,7 +272,7 @@ exports[`t-call (template calling) dynamic t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const template1 = (ctx['template']); - let b2 = call(this, template1, ctx, node, key + \`__1\`); + const b2 = call(this, template1, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -319,7 +319,7 @@ exports[`t-call (template calling) inherit context 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"foo\\", 1); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -370,7 +370,7 @@ exports[`t-call (template calling) recursive template, part 2 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"node\\", ctx['root']); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -390,21 +390,21 @@ exports[`t-call (template calling) recursive template, part 2 2`] = ` ctx[isBoundary] = 1 let txt1 = ctx['node'].val; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`subtree\`] = v_block2[i1]; ctx[\`subtree_first\`] = i1 === 0; ctx[\`subtree_last\`] = i1 === v_block2.length - 1; ctx[\`subtree_index\`] = i1; ctx[\`subtree_value\`] = k_block2[i1]; - let key1 = ctx['subtree_index']; + const key1 = ctx['subtree_index']; ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"node\\", ctx['subtree']); c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); ctx = ctx.__proto__; } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([txt1], [b2]); } }" @@ -425,7 +425,7 @@ exports[`t-call (template calling) recursive template, part 3 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"node\\", ctx['root']); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -445,21 +445,21 @@ exports[`t-call (template calling) recursive template, part 3 2`] = ` ctx[isBoundary] = 1 let txt1 = ctx['node'].val; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`subtree\`] = v_block2[i1]; ctx[\`subtree_first\`] = i1 === 0; ctx[\`subtree_last\`] = i1 === v_block2.length - 1; ctx[\`subtree_index\`] = i1; ctx[\`subtree_value\`] = k_block2[i1]; - let key1 = ctx['subtree_index']; + const key1 = ctx['subtree_index']; ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"node\\", ctx['subtree']); c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); ctx = ctx.__proto__; } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([txt1], [b2]); } }" @@ -481,7 +481,7 @@ exports[`t-call (template calling) recursive template, part 4: with t-set recurs ctx[isBoundary] = 1; setContextValue(ctx, \\"recursive_idx\\", 1); setContextValue(ctx, \\"node\\", ctx['root']); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -503,21 +503,21 @@ exports[`t-call (template calling) recursive template, part 4: with t-set recurs let txt1 = ctx['node'].val; let txt2 = ctx['recursive_idx']; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`subtree\`] = v_block2[i1]; ctx[\`subtree_first\`] = i1 === 0; ctx[\`subtree_last\`] = i1 === v_block2.length - 1; ctx[\`subtree_index\`] = i1; ctx[\`subtree_value\`] = k_block2[i1]; - let key1 = ctx['subtree_index']; + const key1 = ctx['subtree_index']; ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"node\\", ctx['subtree']); c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); ctx = ctx.__proto__; } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([txt1, txt2], [b2]); } }" @@ -538,7 +538,7 @@ exports[`t-call (template calling) scoped parameters 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"foo\\", 42); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); ctx = ctx.__proto__; let txt1 = ctx['foo']; return block1([txt1], [b2]); @@ -573,7 +573,7 @@ exports[`t-call (template calling) scoped parameters, part 2 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"foo\\", 42); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); ctx = ctx.__proto__; let txt1 = ctx['foo']; return block1([txt1], [b2]); @@ -602,7 +602,7 @@ exports[`t-call (template calling) t-call allowed on a non t node 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -633,7 +633,7 @@ exports[`t-call (template calling) t-call with body content as root of a templat return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b1 = block1(); + const b1 = block1(); ctx[zero] = b1; return callTemplate_1.call(this, ctx, node, key + \`__1\`); } @@ -649,7 +649,7 @@ exports[`t-call (template calling) t-call with body content as root of a templat let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = ctx[zero]; + const b2 = ctx[zero]; return block1([], [b2]); } }" @@ -702,7 +702,7 @@ exports[`t-call (template calling) t-call with t-set inside and body text conten ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"val\\", \`yip yip\`); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -735,14 +735,14 @@ exports[`t-call (template calling) t-call with t-set inside and outside 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`v\`] = v_block2[i1]; ctx[\`v_first\`] = i1 === 0; ctx[\`v_last\`] = i1 === v_block2.length - 1; ctx[\`v_index\`] = i1; ctx[\`v_value\`] = k_block2[i1]; - let key1 = ctx['v_index']; + const key1 = ctx['v_index']; setContextValue(ctx, \\"val\\", ctx['v'].val); ctx = Object.create(ctx); ctx[isBoundary] = 1; @@ -750,7 +750,7 @@ exports[`t-call (template calling) t-call with t-set inside and outside 1`] = ` c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); ctx = ctx.__proto__; } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -783,7 +783,7 @@ exports[`t-call (template calling) t-call with t-set inside and outside. 2 1`] = ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"w\\", 'fromwrapper'); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -802,14 +802,14 @@ exports[`t-call (template calling) t-call with t-set inside and outside. 2 2`] = ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`v\`] = v_block2[i1]; ctx[\`v_first\`] = i1 === 0; ctx[\`v_last\`] = i1 === v_block2.length - 1; ctx[\`v_index\`] = i1; ctx[\`v_value\`] = k_block2[i1]; - let key1 = ctx['v_index']; + const key1 = ctx['v_index']; setContextValue(ctx, \\"val\\", ctx['v'].val); ctx = Object.create(ctx); ctx[isBoundary] = 1; @@ -817,7 +817,7 @@ exports[`t-call (template calling) t-call with t-set inside and outside. 2 2`] = c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); ctx = ctx.__proto__; } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -832,8 +832,8 @@ exports[`t-call (template calling) t-call with t-set inside and outside. 2 3`] = return function template(ctx, node, key = \\"\\") { let txt1 = ctx['val3']; - let b2 = block2([txt1]); - let b3 = text(ctx['w']); + const b2 = block2([txt1]); + const b3 = text(ctx['w']); return multi([b2, b3]); } }" @@ -908,7 +908,7 @@ exports[`t-call (template calling) t-esc inside t-call, with t-set outside 1`] = ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"v\\", \`Hi\`); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -938,7 +938,7 @@ exports[`t-call (template calling) with unused body 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b1 = text(\`WHEEE\`); + const b1 = text(\`WHEEE\`); ctx[zero] = b1; return callTemplate_1.call(this, ctx, node, key + \`__1\`); } @@ -999,7 +999,7 @@ exports[`t-call (template calling) with used body 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b1 = text(\`ok\`); + const b1 = text(\`ok\`); ctx[zero] = b1; return callTemplate_1.call(this, ctx, node, key + \`__1\`); } @@ -1036,7 +1036,7 @@ exports[`t-call (template calling) with used setbody 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"foo\\", 'ok'); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_debug_log.test.ts.snap b/tests/compiler/__snapshots__/t_debug_log.test.ts.snap index f3b72b95..71c5bd3a 100644 --- a/tests/compiler/__snapshots__/t_debug_log.test.ts.snap +++ b/tests/compiler/__snapshots__/t_debug_log.test.ts.snap @@ -44,7 +44,7 @@ exports[`debugging t-debug on sub template 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_esc.test.ts.snap b/tests/compiler/__snapshots__/t_esc.test.ts.snap index 844c33c5..945d489e 100644 --- a/tests/compiler/__snapshots__/t_esc.test.ts.snap +++ b/tests/compiler/__snapshots__/t_esc.test.ts.snap @@ -82,15 +82,15 @@ exports[`t-esc falsy values in text nodes 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['v1']); - let b3 = text(\`:\`); - let b4 = text(ctx['v2']); - let b5 = text(\`:\`); - let b6 = text(ctx['v3']); - let b7 = text(\`:\`); - let b8 = text(ctx['v4']); - let b9 = text(\`:\`); - let b10 = text(ctx['v5']); + const b2 = text(ctx['v1']); + const b3 = text(\`:\`); + const b4 = text(ctx['v2']); + const b5 = text(\`:\`); + const b6 = text(ctx['v3']); + const b7 = text(\`:\`); + const b8 = text(ctx['v4']); + const b9 = text(\`:\`); + const b10 = text(ctx['v5']); return multi([b2, b3, b4, b5, b6, b7, b8, b9, b10]); } }" @@ -160,9 +160,9 @@ exports[`t-esc t-esc=0 is escaped 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b2 = block2(); + const b2 = block2(); ctx[zero] = b2; - let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b3]); } }" diff --git a/tests/compiler/__snapshots__/t_foreach.test.ts.snap b/tests/compiler/__snapshots__/t_foreach.test.ts.snap index 088ebd27..db4d6a3a 100644 --- a/tests/compiler/__snapshots__/t_foreach.test.ts.snap +++ b/tests/compiler/__snapshots__/t_foreach.test.ts.snap @@ -10,13 +10,13 @@ exports[`t-foreach does not pollute the rendering context 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([1]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([1]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; c_block2[i1] = withKey(text(ctx['item']), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -33,14 +33,14 @@ exports[`t-foreach iterate on items (on a element node) 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([1,2]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([1,2]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; let txt1 = ctx['item']; c_block2[i1] = withKey(block3([txt1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -56,22 +56,22 @@ exports[`t-foreach iterate on items 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; ctx[\`item_index\`] = i1; ctx[\`item_value\`] = k_block2[i1]; - let key1 = ctx['item']; - let b4 = text(\` [\`); - let b5 = text(ctx['item_index']); - let b6 = text(\`: \`); - let b7 = text(ctx['item']); - let b8 = text(\` \`); - let b9 = text(ctx['item_value']); - let b10 = text(\`] \`); + const key1 = ctx['item']; + const b4 = text(\` [\`); + const b5 = text(ctx['item_index']); + const b6 = text(\`: \`); + const b7 = text(ctx['item']); + const b8 = text(\` \`); + const b9 = text(ctx['item_value']); + const b10 = text(\`] \`); c_block2[i1] = withKey(multi([b4, b5, b6, b7, b8, b9, b10]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -87,22 +87,22 @@ exports[`t-foreach iterate, dict param 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['value']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['value']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; ctx[\`item_index\`] = i1; ctx[\`item_value\`] = k_block2[i1]; - let key1 = ctx['item_index']; - let b4 = text(\` [\`); - let b5 = text(ctx['item_index']); - let b6 = text(\`: \`); - let b7 = text(ctx['item']); - let b8 = text(\` \`); - let b9 = text(ctx['item_value']); - let b10 = text(\`] \`); + const key1 = ctx['item_index']; + const b4 = text(\` [\`); + const b5 = text(ctx['item_index']); + const b6 = text(\`: \`); + const b7 = text(ctx['item']); + const b8 = text(\` \`); + const b9 = text(ctx['item_value']); + const b10 = text(\`] \`); c_block2[i1] = withKey(multi([b4, b5, b6, b7, b8, b9, b10]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -118,13 +118,13 @@ exports[`t-foreach iterate, position 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(5)); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(5));; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`elem\`] = v_block2[i1]; ctx[\`elem_first\`] = i1 === 0; ctx[\`elem_last\`] = i1 === v_block2.length - 1; ctx[\`elem_index\`] = i1; - let key1 = ctx['elem']; + const key1 = ctx['elem']; let b4,b5,b6,b7,b8,b9; b4 = text(\` -\`); if (ctx['elem_first']) { @@ -138,7 +138,7 @@ exports[`t-foreach iterate, position 1`] = ` b9 = text(\`) \`); c_block2[i1] = withKey(multi([b4, b5, b6, b7, b8, b9]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -154,13 +154,13 @@ exports[`t-foreach simple iteration (in a node) 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; c_block2[i1] = withKey(text(ctx['item']), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -174,10 +174,10 @@ exports[`t-foreach simple iteration 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]); + const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`item\`] = v_block1[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; c_block1[i1] = withKey(text(ctx['item']), key1); } return list(c_block1); @@ -196,14 +196,14 @@ exports[`t-foreach simple iteration with two nodes inside 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]); + const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`item\`] = v_block1[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; let txt1 = ctx['item']; - let b3 = block3([txt1]); + const b3 = block3([txt1]); let txt2 = ctx['item']; - let b4 = block4([txt2]); + const b4 = block4([txt2]); c_block1[i1] = withKey(multi([b3, b4]), key1); } return list(c_block1); @@ -225,23 +225,23 @@ exports[`t-foreach t-call with body in t-foreach in t-foreach 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`a\`] = v_block2[i1]; ctx[\`a_first\`] = i1 === 0; ctx[\`a_last\`] = i1 === v_block2.length - 1; ctx[\`a_index\`] = i1; ctx[\`a_value\`] = k_block2[i1]; - let key1 = ctx['a']; + const key1 = ctx['a']; ctx = Object.create(ctx); - const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']); + const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']);; for (let i2 = 0; i2 < l_block4; i2++) { ctx[\`b\`] = v_block4[i2]; ctx[\`b_first\`] = i2 === 0; ctx[\`b_last\`] = i2 === v_block4.length - 1; ctx[\`b_index\`] = i2; ctx[\`b_value\`] = k_block4[i2]; - let key2 = ctx['b']; + const key2 = ctx['b']; ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"c\\", 'x'+'_'+ctx['a']+'_'+ctx['b']); @@ -249,13 +249,13 @@ exports[`t-foreach t-call with body in t-foreach in t-foreach 1`] = ` ctx = ctx.__proto__; } ctx = ctx.__proto__; - let b4 = list(c_block4); + const b4 = list(c_block4); let txt1 = ctx['c']; - let b6 = block6([txt1]); + const b6 = block6([txt1]); c_block2[i1] = withKey(multi([b4, b6]), key1); } ctx = ctx.__proto__; - let b2 = list(c_block2); + const b2 = list(c_block2); let txt2 = ctx['a']; let txt3 = ctx['b']; let txt4 = ctx['c']; @@ -270,13 +270,13 @@ exports[`t-foreach t-call with body in t-foreach in t-foreach 2`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\` [\`); - let b3 = text(ctx['a']); - let b4 = text(\`] [\`); - let b5 = text(ctx['b']); - let b6 = text(\`] [\`); - let b7 = text(ctx['c']); - let b8 = text(\`] \`); + const b2 = text(\` [\`); + const b3 = text(ctx['a']); + const b4 = text(\`] [\`); + const b5 = text(ctx['b']); + const b6 = text(\`] [\`); + const b7 = text(ctx['c']); + const b8 = text(\`] \`); return multi([b2, b3, b4, b5, b6, b7, b8]); } }" @@ -294,33 +294,33 @@ exports[`t-foreach t-call without body in t-foreach in t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`a\`] = v_block2[i1]; ctx[\`a_first\`] = i1 === 0; ctx[\`a_last\`] = i1 === v_block2.length - 1; ctx[\`a_index\`] = i1; ctx[\`a_value\`] = k_block2[i1]; - let key1 = ctx['a']; + const key1 = ctx['a']; ctx = Object.create(ctx); - const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']); + const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']);; for (let i2 = 0; i2 < l_block4; i2++) { ctx[\`b\`] = v_block4[i2]; ctx[\`b_first\`] = i2 === 0; ctx[\`b_last\`] = i2 === v_block4.length - 1; ctx[\`b_index\`] = i2; ctx[\`b_value\`] = k_block4[i2]; - let key2 = ctx['b']; + const key2 = ctx['b']; c_block4[i2] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}__\${key2}\`), key2); } ctx = ctx.__proto__; - let b4 = list(c_block4); + const b4 = list(c_block4); let txt1 = ctx['c']; - let b6 = block6([txt1]); + const b6 = block6([txt1]); c_block2[i1] = withKey(multi([b4, b6]), key1); } ctx = ctx.__proto__; - let b2 = list(c_block2); + const b2 = list(c_block2); let txt2 = ctx['a']; let txt3 = ctx['b']; let txt4 = ctx['c']; @@ -339,13 +339,13 @@ exports[`t-foreach t-call without body in t-foreach in t-foreach 2`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"c\\", 'x'+'_'+ctx['a']+'_'+ctx['b']); - let b2 = text(\` [\`); - let b3 = text(ctx['a']); - let b4 = text(\`] [\`); - let b5 = text(ctx['b']); - let b6 = text(\`] [\`); - let b7 = text(ctx['c']); - let b8 = text(\`] \`); + const b2 = text(\` [\`); + const b3 = text(ctx['a']); + const b4 = text(\`] [\`); + const b5 = text(ctx['b']); + const b6 = text(\`] [\`); + const b7 = text(ctx['c']); + const b8 = text(\`] \`); return multi([b2, b3, b4, b5, b6, b7, b8]); } }" @@ -361,25 +361,25 @@ exports[`t-foreach t-foreach in t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`number\`] = v_block2[i1]; - let key1 = ctx['number']; + const key1 = ctx['number']; ctx = Object.create(ctx); - const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['letters']); + const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['letters']);; for (let i2 = 0; i2 < l_block3; i2++) { ctx[\`letter\`] = v_block3[i2]; - let key2 = ctx['letter']; - let b5 = text(\` [\`); - let b6 = text(ctx['number']); - let b7 = text(ctx['letter']); - let b8 = text(\`] \`); + const key2 = ctx['letter']; + const b5 = text(\` [\`); + const b6 = text(ctx['number']); + const b7 = text(ctx['letter']); + const b8 = text(\`] \`); c_block3[i2] = withKey(multi([b5, b6, b7, b8]), key2); } ctx = ctx.__proto__; c_block2[i1] = withKey(list(c_block3), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -395,10 +395,10 @@ exports[`t-foreach t-foreach with t-if inside (no external node) 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['elems']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['elems']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`elem\`] = v_block1[i1]; - let key1 = ctx['elem'].id; + const key1 = ctx['elem'].id; let b3; if (ctx['elem'].id<3) { let txt1 = ctx['elem'].text; @@ -422,10 +422,10 @@ exports[`t-foreach t-foreach with t-if inside 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['elems']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['elems']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`elem\`] = v_block2[i1]; - let key1 = ctx['elem'].id; + const key1 = ctx['elem'].id; let b4; if (ctx['elem'].id<3) { let txt1 = ctx['elem'].text; @@ -433,7 +433,7 @@ exports[`t-foreach t-foreach with t-if inside 1`] = ` } c_block2[i1] = withKey(multi([b4]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -450,13 +450,13 @@ exports[`t-foreach t-key on t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['things']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['things']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`thing\`] = v_block2[i1]; - let key1 = ctx['thing']; + const key1 = ctx['thing']; c_block2[i1] = withKey(block3(), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -473,15 +473,15 @@ exports[`t-foreach throws error if invalid loop expression 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['abc']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['abc']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; ctx[\`item_index\`] = i1; - let key1 = ctx['item']; + const key1 = ctx['item']; const tKey_1 = ctx['item_index']; c_block2[i1] = withKey(block3(), tKey_1 + key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -500,12 +500,12 @@ exports[`t-foreach with t-memo 1`] = ` let cache = ctx.cache || {}; let nextCache = ctx.cache = {}; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item'].id; - let memo1 = [ctx['item'].x] - let vnode1 = cache[key1]; + const key1 = ctx['item'].id; + const memo1 = [ctx['item'].x]; + const vnode1 = cache[key1];; if (vnode1) { if (shallowEqual(vnode1.memo, memo1)) { c_block2[i1] = vnode1; @@ -518,7 +518,7 @@ exports[`t-foreach with t-memo 1`] = ` c_block2[i1] = withKey(block3([txt1, txt2]), key1); nextCache[key1] = Object.assign(c_block2[i1], {memo: memo1}); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_if.test.ts.snap b/tests/compiler/__snapshots__/t_if.test.ts.snap index fabda634..ecba4bbd 100644 --- a/tests/compiler/__snapshots__/t_if.test.ts.snap +++ b/tests/compiler/__snapshots__/t_if.test.ts.snap @@ -29,8 +29,8 @@ exports[`t-if a t-if with two inner nodes 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['condition']) { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); b2 = multi([b3, b4]); } return multi([b2]); @@ -187,8 +187,8 @@ exports[`t-if div containing a t-if with two inner nodes 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['condition']) { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); b2 = multi([b3, b4]); } return block1([], [b2]); @@ -208,8 +208,8 @@ exports[`t-if dynamic content after t-if with two children nodes 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['condition']) { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); b2 = multi([b3, b4]); } let txt1 = ctx['text']; @@ -318,8 +318,8 @@ exports[`t-if t-if and t-else with two nodes 1`] = ` if (ctx['condition']) { b2 = text(\`1\`); } else { - let b4 = block4(); - let b5 = block5(); + const b4 = block4(); + const b5 = block5(); b3 = multi([b4, b5]); } return multi([b2, b3]); @@ -526,8 +526,8 @@ exports[`t-if two t-ifs next to each other 1`] = ` b2 = block2([txt1]); } if (ctx['condition']) { - let b4 = block4(); - let b5 = block5(); + const b4 = block4(); + const b5 = block5(); b3 = multi([b4, b5]); } return block1([], [b2, b3]); diff --git a/tests/compiler/__snapshots__/t_key.test.ts.snap b/tests/compiler/__snapshots__/t_key.test.ts.snap index 65bff25d..54c15b53 100644 --- a/tests/compiler/__snapshots__/t_key.test.ts.snap +++ b/tests/compiler/__snapshots__/t_key.test.ts.snap @@ -56,14 +56,14 @@ exports[`t-key t-key directive in a list 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['beers']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['beers']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`beer\`] = v_block2[i1]; - let key1 = ctx['beer'].id; + const key1 = ctx['beer'].id; let txt1 = ctx['beer'].name; c_block2[i1] = withKey(block3([txt1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_out.test.ts.snap b/tests/compiler/__snapshots__/t_out.test.ts.snap index e8e7ba51..ef913210 100644 --- a/tests/compiler/__snapshots__/t_out.test.ts.snap +++ b/tests/compiler/__snapshots__/t_out.test.ts.snap @@ -9,7 +9,7 @@ exports[`t-out literal 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput('ok'); + const b2 = safeOutput('ok'); return block1([], [b2]); } }" @@ -40,9 +40,9 @@ exports[`t-out multiple calls to t-out 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b2 = block2(); + const b2 = block2(); ctx[zero] = b2; - let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b3]); } }" @@ -57,8 +57,8 @@ exports[`t-out multiple calls to t-out 2`] = ` let block1 = createBlock(\`
Greeter
\`); return function template(ctx, node, key = \\"\\") { - let b2 = ctx[zero]; - let b3 = ctx[zero]; + const b2 = ctx[zero]; + const b3 = ctx[zero]; return block1([], [b2, b3]); } }" @@ -73,7 +73,7 @@ exports[`t-out not escaping 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -92,9 +92,9 @@ exports[`t-out t-out 0 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b2 = block2(); + const b2 = block2(); ctx[zero] = b2; - let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b3]); } }" @@ -109,7 +109,7 @@ exports[`t-out t-out 0 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = ctx[zero]; + const b2 = ctx[zero]; return block1([], [b2]); } }" @@ -124,7 +124,7 @@ exports[`t-out t-out and another sibling node 1`] = ` let block1 = createBlock(\`hello\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -147,7 +147,7 @@ exports[`t-out t-out bdom 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx[\`var\`] = new LazyValue(value1, ctx, node); - let b3 = safeOutput(ctx['var']); + const b3 = safeOutput(ctx['var']); return block1([], [b3]); } }" @@ -162,7 +162,7 @@ exports[`t-out t-out block 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['bdom']); + const b2 = safeOutput(ctx['bdom']); return block1([], [b2]); } }" @@ -177,7 +177,7 @@ exports[`t-out t-out escaped 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -192,7 +192,7 @@ exports[`t-out t-out markedup 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -207,8 +207,8 @@ exports[`t-out t-out on a node with a body, as a default 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b3 = text(\`nope\`); - let b2 = withDefault(safeOutput(ctx['var']), b3); + const b3 = text(\`nope\`); + const b2 = withDefault(safeOutput(ctx['var']), b3); return block1([], [b2]); } }" @@ -224,8 +224,8 @@ exports[`t-out t-out on a node with a dom node in body, as a default 1`] = ` let block3 = createBlock(\`
nope
\`); return function template(ctx, node, key = \\"\\") { - let b3 = block3(); - let b2 = withDefault(safeOutput(ctx['var']), b3); + const b3 = block3(); + const b2 = withDefault(safeOutput(ctx['var']), b3); return block1([], [b2]); } }" @@ -240,7 +240,7 @@ exports[`t-out t-out switch escaped 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -255,7 +255,7 @@ exports[`t-out t-out switch escaped on markup 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -270,7 +270,7 @@ exports[`t-out t-out switch markup 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -297,10 +297,10 @@ exports[`t-out t-out switch markup on bdom 1`] = ` let b3,b5; ctx[\`bdom\`] = new LazyValue(value1, ctx, node); if (ctx['hasBdom']) { - let b4 = safeOutput(ctx['bdom']); + const b4 = safeOutput(ctx['bdom']); b3 = block3([], [b4]); } else { - let b6 = safeOutput(ctx['var']); + const b6 = safeOutput(ctx['var']); b5 = block5([], [b6]); } return block1([], [b3, b5]); @@ -317,7 +317,7 @@ exports[`t-out t-out switch markup on escaped 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -344,7 +344,7 @@ exports[`t-out t-out with arbitrary object 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -359,7 +359,7 @@ exports[`t-out t-out with arbitrary object 2 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -374,7 +374,7 @@ exports[`t-out t-out with comment 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -401,7 +401,7 @@ exports[`t-out variable 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -416,7 +416,7 @@ exports[`t-out with a String class 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -431,7 +431,7 @@ exports[`t-out with an extended String class 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -446,7 +446,7 @@ exports[`t-raw is deprecated should warn 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" @@ -461,7 +461,7 @@ exports[`t-raw is deprecated t-out is actually called in t-raw's place 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['var']); + const b2 = safeOutput(ctx['var']); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_ref.test.ts.snap b/tests/compiler/__snapshots__/t_ref.test.ts.snap index 6ce46863..1caf8269 100644 --- a/tests/compiler/__snapshots__/t_ref.test.ts.snap +++ b/tests/compiler/__snapshots__/t_ref.test.ts.snap @@ -41,7 +41,7 @@ exports[`t-ref ref in a t-call 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -94,17 +94,17 @@ exports[`t-ref refs in a loop 1`] = ` return function template(ctx, node, key = \\"\\") { const refs = ctx.__owl__.refs; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; const tKey_1 = ctx['item']; const v1 = ctx['item']; let ref1 = (el) => refs[\`\${v1}\`] = el; let txt1 = ctx['item']; c_block2[i1] = withKey(block3([ref1, txt1]), tKey_1 + key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/compiler/__snapshots__/t_set.test.ts.snap b/tests/compiler/__snapshots__/t_set.test.ts.snap index 72f3f9f4..b6424f9a 100644 --- a/tests/compiler/__snapshots__/t_set.test.ts.snap +++ b/tests/compiler/__snapshots__/t_set.test.ts.snap @@ -208,7 +208,7 @@ exports[`t-set t-set body is evaluated immediately 1`] = ` setContextValue(ctx, \\"v1\\", 'before'); ctx[\`v2\`] = new LazyValue(value1, ctx, node); setContextValue(ctx, \\"v1\\", 'after'); - let b3 = safeOutput(ctx['v2']); + const b3 = safeOutput(ctx['v2']); return block1([], [b3]); } }" @@ -228,7 +228,7 @@ exports[`t-set t-set can't alter from within callee 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 'source'); let txt1 = ctx['iter']; - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); let txt2 = ctx['iter']; return block1([txt1, txt2], [b2]); } @@ -271,7 +271,7 @@ exports[`t-set t-set can't alter in t-call body 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"iter\\", 'inCall'); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); ctx = ctx.__proto__; let txt2 = ctx['iter']; return block1([txt1, txt2], [b2]); @@ -349,16 +349,16 @@ exports[`t-set t-set outside modified in t-foreach 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 0); ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; - let key1 = ctx['val']; + const key1 = ctx['val']; let txt1 = ctx['iter']; c_block2[i1] = withKey(block3([txt1]), key1); setContextValue(ctx, \\"iter\\", ctx['iter']+1); } ctx = ctx.__proto__; - let b2 = list(c_block2); + const b2 = list(c_block2); let txt2 = ctx['iter']; return block1([txt2], [b2]); } @@ -379,16 +379,16 @@ exports[`t-set t-set outside modified in t-foreach increment-after operator 1`] ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 0); ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; - let key1 = ctx['val']; + const key1 = ctx['val']; let txt1 = ctx['iter']; c_block2[i1] = withKey(block3([txt1]), key1); setContextValue(ctx, \\"iter\\", ctx['iter']++); } ctx = ctx.__proto__; - let b2 = list(c_block2); + const b2 = list(c_block2); let txt2 = ctx['iter']; return block1([txt2], [b2]); } @@ -409,16 +409,16 @@ exports[`t-set t-set outside modified in t-foreach increment-before operator 1`] ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 0); ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; - let key1 = ctx['val']; + const key1 = ctx['val']; let txt1 = ctx['iter']; c_block2[i1] = withKey(block3([txt1]), key1); setContextValue(ctx, \\"iter\\", ++ctx['iter']); } ctx = ctx.__proto__; - let b2 = list(c_block2); + const b2 = list(c_block2); let txt2 = ctx['iter']; return block1([txt2], [b2]); } @@ -439,16 +439,16 @@ exports[`t-set t-set should reuse variable if possible 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"v\\", 1); ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`elem\`] = v_block2[i1]; ctx[\`elem_index\`] = i1; - let key1 = ctx['elem_index']; + const key1 = ctx['elem_index']; let txt1 = ctx['v']; setContextValue(ctx, \\"v\\", ctx['elem']); c_block2[i1] = withKey(block3([txt1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -463,8 +463,8 @@ exports[`t-set t-set with content and sub t-esc 1`] = ` let block1 = createBlock(\`
\`); function value1(ctx, node, key = \\"\\") { - let b3 = text(ctx['beep']); - let b4 = text(\` boop\`); + const b3 = text(ctx['beep']); + const b4 = text(\` boop\`); return multi([b3, b4]); } @@ -500,7 +500,7 @@ exports[`t-set t-set with t-value (falsy) and body 1`] = ` ctx[\`v2\`] = withDefault(ctx['v3'], new LazyValue(value1, ctx, node)); setContextValue(ctx, \\"v1\\", 'after'); setContextValue(ctx, \\"v3\\", true); - let b3 = safeOutput(ctx['v2']); + const b3 = safeOutput(ctx['v2']); return block1([], [b3]); } }" @@ -528,7 +528,7 @@ exports[`t-set t-set with t-value (truthy) and body 1`] = ` ctx[\`v2\`] = withDefault(ctx['v3'], new LazyValue(value1, ctx, node)); setContextValue(ctx, \\"v1\\", 'after'); setContextValue(ctx, \\"v3\\", false); - let b3 = safeOutput(ctx['v2']); + const b3 = safeOutput(ctx['v2']); return block1([], [b3]); } }" diff --git a/tests/compiler/__snapshots__/t_tag.test.ts.snap b/tests/compiler/__snapshots__/t_tag.test.ts.snap index 011fe2a7..dc8dec2e 100644 --- a/tests/compiler/__snapshots__/t_tag.test.ts.snap +++ b/tests/compiler/__snapshots__/t_tag.test.ts.snap @@ -8,7 +8,7 @@ exports[`qweb t-tag can fallback if falsy tag 1`] = ` let block1 = tag => createBlock(\`<\${tag || 'fallback'}/>\`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['tag']; + const tag1 = ctx['tag']; return toggler(tag1, block1(tag1)()); } }" @@ -22,7 +22,7 @@ exports[`qweb t-tag can update 1`] = ` let block1 = tag => createBlock(\`<\${tag || 't'}/>\`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['tag']; + const tag1 = ctx['tag']; return toggler(tag1, block1(tag1)()); } }" @@ -36,7 +36,7 @@ exports[`qweb t-tag simple usecases 1`] = ` let block1 = tag => createBlock(\`<\${tag || 't'}/>\`); return function template(ctx, node, key = \\"\\") { - let tag1 = 'div'; + const tag1 = 'div'; return toggler(tag1, block1(tag1)()); } }" @@ -50,7 +50,7 @@ exports[`qweb t-tag simple usecases 2`] = ` let block1 = tag => createBlock(\`<\${tag || 't'}>text\`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['tag']; + const tag1 = ctx['tag']; return toggler(tag1, block1(tag1)()); } }" @@ -64,7 +64,7 @@ exports[`qweb t-tag with multiple attributes 1`] = ` let block1 = tag => createBlock(\`<\${tag || 't'} class=\\"blueberry\\" taste=\\"raspberry\\">gooseberry\`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['tag']; + const tag1 = ctx['tag']; return toggler(tag1, block1(tag1)()); } }" @@ -78,7 +78,7 @@ exports[`qweb t-tag with multiple child nodes 1`] = ` let block1 = tag => createBlock(\`<\${tag || 't'}> pear apple strawberry \`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['tag']; + const tag1 = ctx['tag']; return toggler(tag1, block1(tag1)()); } }" @@ -93,9 +93,9 @@ exports[`qweb t-tag with multiple t-tag in same template 1`] = ` let block2 = tag => createBlock(\`<\${tag || 't'}>baz\`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['outer']; - let tag2 = ctx['inner']; - let b2 = toggler(tag2, block2(tag2)()); + const tag1 = ctx['outer']; + const tag2 = ctx['inner']; + const b2 = toggler(tag2, block2(tag2)()); return toggler(tag1, block1(tag1)([], [b2])); } }" @@ -110,10 +110,10 @@ exports[`qweb t-tag with multiple t-tag in same template, part 2 1`] = ` let block3 = tag => createBlock(\`<\${tag || 't'}>baz\`); return function template(ctx, node, key = \\"\\") { - let tag1 = ctx['brother']; - let b2 = toggler(tag1, block2(tag1)()); - let tag2 = ctx['brother']; - let b3 = toggler(tag2, block3(tag2)()); + const tag1 = ctx['brother']; + const b2 = toggler(tag1, block2(tag1)()); + const tag2 = ctx['brother']; + const b3 = toggler(tag2, block3(tag2)()); return multi([b2, b3]); } }" diff --git a/tests/compiler/__snapshots__/template_set.test.ts.snap b/tests/compiler/__snapshots__/template_set.test.ts.snap index f20fa6a7..7a3581cd 100644 --- a/tests/compiler/__snapshots__/template_set.test.ts.snap +++ b/tests/compiler/__snapshots__/template_set.test.ts.snap @@ -50,7 +50,7 @@ exports[`loading templates can load a few templates from a xml string 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -65,8 +65,8 @@ exports[`loading templates can load a few templates from a xml string 2`] = ` let block3 = createBlock(\`
  • foo
  • \`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); - let b3 = block3(); + const b2 = block2(); + const b3 = block3(); return multi([b2, b3]); } }" @@ -82,7 +82,7 @@ exports[`loading templates can load a few templates from an XMLDocument 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -97,8 +97,8 @@ exports[`loading templates can load a few templates from an XMLDocument 2`] = ` let block3 = createBlock(\`
  • foo
  • \`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); - let b3 = block3(); + const b2 = block2(); + const b3 = block3(); return multi([b2, b3]); } }" diff --git a/tests/components/__snapshots__/basics.test.ts.snap b/tests/components/__snapshots__/basics.test.ts.snap index 6d2bc63f..1b03db79 100644 --- a/tests/components/__snapshots__/basics.test.ts.snap +++ b/tests/components/__snapshots__/basics.test.ts.snap @@ -6,7 +6,7 @@ exports[`basics GrandChild display is controlled by its GrandParent 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let Comp1 = ctx['myComp']; + const Comp1 = ctx['myComp']; return toggler(Comp1, component(Comp1, {displayGrandChild: ctx['displayGrandChild']}, key + \`__1\`, node, ctx)); } }" @@ -49,9 +49,9 @@ exports[`basics Multi root component 1`] = ` let block4 = createBlock(\`2\`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); - let b3 = text(\`text\`); - let b4 = block4(); + const b2 = block2(); + const b3 = text(\`text\`); + const b4 = block4(); return multi([b2, b3, b4]); } }" @@ -102,7 +102,7 @@ exports[`basics a component inside a component 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -145,7 +145,7 @@ exports[`basics can handle empty props 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {val: undefined}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {val: undefined}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -236,8 +236,8 @@ exports[`basics can mount a simple component with multiple roots 1`] = ` let block3 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); - let b3 = block3(); + const b2 = block2(); + const b3 = block3(); return multi([b2, b3]); } }" @@ -477,15 +477,15 @@ exports[`basics list of two sub components inside other nodes 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`blip\`] = v_block2[i1]; - let key1 = ctx['blip'].id; - let b4 = component(\`SubWidget\`, {}, key + \`__1__\${key1}\`, node, ctx); - let b5 = component(\`SubWidget\`, {}, key + \`__2__\${key1}\`, node, ctx); + const key1 = ctx['blip'].id; + const b4 = component(\`SubWidget\`, {}, key + \`__1__\${key1}\`, node, ctx); + const b5 = component(\`SubWidget\`, {}, key + \`__2__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([], [b4, b5]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -560,9 +560,9 @@ exports[`basics reconciliation alg is not confused in some specific situation 1` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); const tKey_1 = 4; - let b3 = toggler(tKey_1, component(\`Child\`, {}, tKey_1 + key + \`__2\`, node, ctx)); + const b3 = toggler(tKey_1, component(\`Child\`, {}, tKey_1 + key + \`__2\`, node, ctx)); return block1([], [b2, b3]); } }" @@ -617,9 +617,9 @@ exports[`basics same t-keys in two different places 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = 1; - let b2 = toggler(tKey_1, component(\`Child\`, {blip: '1'}, tKey_1 + key + \`__1\`, node, ctx)); + const b2 = toggler(tKey_1, component(\`Child\`, {blip: '1'}, tKey_1 + key + \`__1\`, node, ctx)); const tKey_2 = 1; - let b3 = toggler(tKey_2, component(\`Child\`, {blip: '2'}, tKey_2 + key + \`__2\`, node, ctx)); + const b3 = toggler(tKey_2, component(\`Child\`, {blip: '2'}, tKey_2 + key + \`__2\`, node, ctx)); return block1([], [b2, b3]); } }" @@ -952,8 +952,8 @@ exports[`basics two child components 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); - let b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx); return multi([b2, b3]); } }" @@ -981,7 +981,7 @@ exports[`basics update props of component without concrete own node 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['childProps'].key; - let b2 = toggler(tKey_1, component(\`Child\`, Object.assign({}, ctx['childProps']), tKey_1 + key + \`__1\`, node, ctx)); + const b2 = toggler(tKey_1, component(\`Child\`, Object.assign({}, ctx['childProps']), tKey_1 + key + \`__1\`, node, ctx)); return block1([], [b2]); } }" @@ -1022,10 +1022,10 @@ exports[`basics updating a component with t-foreach as root 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`item\`] = v_block1[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; c_block1[i1] = withKey(text(ctx['item']), key1); } return list(c_block1); @@ -1071,16 +1071,16 @@ exports[`basics widget after a t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2)); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`elem\`] = v_block2[i1]; ctx[\`elem_index\`] = i1; - let key1 = ctx['elem_index']; + const key1 = ctx['elem_index']; c_block2[i1] = withKey(text(\`txt\`), key1); } ctx = ctx.__proto__; - let b2 = list(c_block2); - let b4 = component(\`SomeComponent\`, {}, key + \`__1\`, node, ctx); + const b2 = list(c_block2); + const b4 = component(\`SomeComponent\`, {}, key + \`__1\`, node, ctx); return block1([], [b2, b4]); } }" @@ -1187,7 +1187,7 @@ exports[`support svg components add proper namespace to svg 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`GComp\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`GComp\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1216,15 +1216,15 @@ exports[`t-out in components can render list of t-out 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].items); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].items);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; - let b4 = text(ctx['item']); - let b5 = safeOutput(ctx['item']); + const key1 = ctx['item']; + const b4 = text(ctx['item']); + const b5 = safeOutput(ctx['item']); c_block2[i1] = withKey(multi([b4, b5]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -1237,8 +1237,8 @@ exports[`t-out in components can switch the contents of two t-out repeatedly 1`] let { safeOutput } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['state'].a); - let b3 = safeOutput(ctx['state'].b); + const b2 = safeOutput(ctx['state'].a); + const b3 = safeOutput(ctx['state'].b); return multi([b2, b3]); } }" @@ -1253,7 +1253,7 @@ exports[`t-out in components update properly on state changes 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = safeOutput(ctx['state'].value); + const b2 = safeOutput(ctx['state'].value); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/concurrency.test.ts.snap b/tests/components/__snapshots__/concurrency.test.ts.snap index 6aefcdcd..a64aee4e 100644 --- a/tests/components/__snapshots__/concurrency.test.ts.snap +++ b/tests/components/__snapshots__/concurrency.test.ts.snap @@ -7,16 +7,16 @@ exports[`Cascading renders after microtaskTick 1`] = ` let { prepareList, withKey } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); - let b3 = text(\` _ \`); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b3 = text(\` _ \`); ctx = Object.create(ctx); - const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state']); + const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state']);; for (let i1 = 0; i1 < l_block4; i1++) { ctx[\`elem\`] = v_block4[i1]; - let key1 = ctx['elem'].id; + const key1 = ctx['elem'].id; c_block4[i1] = withKey(text(ctx['elem'].id), key1); } - let b4 = list(c_block4); + const b4 = list(c_block4); return multi([b2, b3, b4]); } }" @@ -30,10 +30,10 @@ exports[`Cascading renders after microtaskTick 2`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`elem\`] = v_block1[i1]; - let key1 = ctx['elem'].id; + const key1 = ctx['elem'].id; c_block1[i1] = withKey(component(\`Element\`, {id: ctx['elem'].id}, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1); @@ -169,7 +169,7 @@ exports[`concurrent renderings scenario 1 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -183,7 +183,7 @@ exports[`concurrent renderings scenario 1 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA, fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA, fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -213,7 +213,7 @@ exports[`concurrent renderings scenario 2 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].fromA; - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([txt1], [b2]); } }" @@ -227,7 +227,7 @@ exports[`concurrent renderings scenario 2 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA, fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA, fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -256,7 +256,7 @@ exports[`concurrent renderings scenario 2bis 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -270,7 +270,7 @@ exports[`concurrent renderings scenario 2bis 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA, fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA, fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -299,7 +299,7 @@ exports[`concurrent renderings scenario 3 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -313,7 +313,7 @@ exports[`concurrent renderings scenario 3 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -327,7 +327,7 @@ exports[`concurrent renderings scenario 3 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentD\`, {fromA: ctx['props'].fromA, fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentD\`, {fromA: ctx['props'].fromA, fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -356,7 +356,7 @@ exports[`concurrent renderings scenario 4 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -370,7 +370,7 @@ exports[`concurrent renderings scenario 4 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentC\`, {fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -384,7 +384,7 @@ exports[`concurrent renderings scenario 4 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentD\`, {fromA: ctx['props'].fromA, fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentD\`, {fromA: ctx['props'].fromA, fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -413,7 +413,7 @@ exports[`concurrent renderings scenario 5 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -441,7 +441,7 @@ exports[`concurrent renderings scenario 6 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -469,7 +469,7 @@ exports[`concurrent renderings scenario 7 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -498,7 +498,7 @@ exports[`concurrent renderings scenario 8 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -528,8 +528,8 @@ exports[`concurrent renderings scenario 9 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].fromA; - let b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); - let b3 = component(\`ComponentC\`, {fromA: ctx['state'].fromA}, key + \`__2\`, node, ctx); + const b2 = component(\`ComponentB\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b3 = component(\`ComponentC\`, {fromA: ctx['state'].fromA}, key + \`__2\`, node, ctx); return block1([txt1], [b2, b3]); } }" @@ -557,7 +557,7 @@ exports[`concurrent renderings scenario 9 3`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentD\`, {fromA: ctx['props'].fromA, fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentD\`, {fromA: ctx['props'].fromA, fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -586,7 +586,7 @@ exports[`concurrent renderings scenario 10 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -631,7 +631,7 @@ exports[`concurrent renderings scenario 11 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {val: ctx['state'].valA}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {val: ctx['state'].valA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -660,7 +660,7 @@ exports[`concurrent renderings scenario 12 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {val: ctx['val']}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {val: ctx['val']}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -720,7 +720,7 @@ exports[`concurrent renderings scenario 14 1`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`B\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`B\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -734,7 +734,7 @@ exports[`concurrent renderings scenario 14 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`C\`, {fromB: ctx['state'].fromB, fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`C\`, {fromB: ctx['state'].fromB, fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -764,7 +764,7 @@ exports[`concurrent renderings scenario 15 1`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`B\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`B\`, {fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -778,7 +778,7 @@ exports[`concurrent renderings scenario 15 2`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`C\`, {fromB: ctx['state'].fromB, fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); + const b2 = component(\`C\`, {fromB: ctx['state'].fromB, fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1008,9 +1008,9 @@ exports[`delay willUpdateProps 2`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['props'].value); - let b3 = text(\`_\`); - let b4 = text(ctx['state'].int); + const b2 = text(ctx['props'].value); + const b3 = text(\`_\`); + const b4 = text(ctx['state'].int); return multi([b2, b3, b4]); } }" @@ -1033,8 +1033,8 @@ exports[`delay willUpdateProps with rendering grandchild 2`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`DelayedChild\`, {value: ctx['props'].state.value}, key + \`__1\`, node, ctx); - let b3 = component(\`ReactiveChild\`, {}, key + \`__2\`, node, ctx); + const b2 = component(\`DelayedChild\`, {value: ctx['props'].state.value}, key + \`__1\`, node, ctx); + const b3 = component(\`ReactiveChild\`, {}, key + \`__2\`, node, ctx); return multi([b2, b3]); } }" @@ -1046,9 +1046,9 @@ exports[`delay willUpdateProps with rendering grandchild 3`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['props'].value); - let b3 = text(\`_\`); - let b4 = text(ctx['state'].int); + const b2 = text(ctx['props'].value); + const b3 = text(\`_\`); + const b4 = text(ctx['state'].int); return multi([b2, b3, b4]); } }" @@ -1172,7 +1172,7 @@ exports[`properly behave when destroyed/unmounted while rendering 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`SubChild\`, {val: ctx['props'].val}, key + \`__1\`, node, ctx); + const b2 = component(\`SubChild\`, {val: ctx['props'].val}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1252,14 +1252,14 @@ exports[`t-foreach with dynamic async component 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['list']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['list']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`arr\`] = v_block1[i1]; ctx[\`arr_index\`] = i1; - let key1 = ctx['arr_index']; + const key1 = ctx['arr_index']; let b3; if (ctx['arr']) { - let Comp1 = ctx['myComp']; + const Comp1 = ctx['myComp']; b3 = toggler(Comp1, component(Comp1, {key: ctx['arr'][0]}, key + \`__1__\${key1}\`, node, ctx)); } c_block1[i1] = withKey(multi([b3]), key1); @@ -1292,8 +1292,8 @@ exports[`t-key on dom node having a component 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - let Comp1 = ctx['myComp']; - let b2 = toggler(tKey_1, toggler(Comp1, component(Comp1, {key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx))); + const Comp1 = ctx['myComp']; + const b2 = toggler(tKey_1, toggler(Comp1, component(Comp1, {key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx))); return toggler(tKey_1, block1([], [b2])); } }" @@ -1317,7 +1317,7 @@ exports[`t-key on dynamic async component (toggler is never patched) 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - let Comp1 = ctx['myComp']; + const Comp1 = ctx['myComp']; return toggler(tKey_1, toggler(Comp1, component(Comp1, {key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx))); } }" @@ -1400,7 +1400,7 @@ exports[`update a sub-component twice in the same frame 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ChildA\`, {val: ctx['state'].valA}, key + \`__1\`, node, ctx); + const b2 = component(\`ChildA\`, {val: ctx['state'].valA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1428,7 +1428,7 @@ exports[`update a sub-component twice in the same frame, 2 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ChildA\`, {val: ctx['state'].valA}, key + \`__1\`, node, ctx); + const b2 = component(\`ChildA\`, {val: ctx['state'].valA}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/error_handling.test.ts.snap b/tests/components/__snapshots__/error_handling.test.ts.snap index 36f9bf47..3080db75 100644 --- a/tests/components/__snapshots__/error_handling.test.ts.snap +++ b/tests/components/__snapshots__/error_handling.test.ts.snap @@ -32,7 +32,7 @@ exports[`basics no component catching error lead to full app destruction 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ErrorComponent\`, {flag: ctx['state'].flag}, key + \`__1\`, node, ctx); + const b2 = component(\`ErrorComponent\`, {flag: ctx['state'].flag}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -109,7 +109,7 @@ exports[`can catch errors can catch an error in a component render function 1`] } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -162,7 +162,7 @@ exports[`can catch errors can catch an error in the constructor call of a compon } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -197,13 +197,13 @@ exports[`can catch errors can catch an error in the constructor call of a compon let block1 = createBlock(\`
    \`); function slot1(ctx, node, key = \\"\\") { - let b3 = component(\`ClassicCompoent\`, {}, key + \`__1\`, node, ctx); - let b4 = component(\`ErrorComponent\`, {}, key + \`__2\`, node, ctx); + const b3 = component(\`ClassicCompoent\`, {}, key + \`__1\`, node, ctx); + const b4 = component(\`ErrorComponent\`, {}, key + \`__2\`, node, ctx); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { - let b5 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); + const b5 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); return block1([], [b5]); } }" @@ -281,7 +281,7 @@ exports[`can catch errors can catch an error in the initial call of a component } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -396,7 +396,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`C\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`C\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -479,7 +479,7 @@ exports[`can catch errors can catch an error in the mounted call 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -532,7 +532,7 @@ exports[`can catch errors can catch an error in the willPatch call 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].message; - let b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([txt1], [b3]); } }" @@ -585,7 +585,7 @@ exports[`can catch errors can catch an error in the willStart call 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -633,13 +633,13 @@ exports[`can catch errors can catch an error origination from a child's willStar let block1 = createBlock(\`
    \`); function slot1(ctx, node, key = \\"\\") { - let b3 = component(\`ClassicCompoent\`, {}, key + \`__1\`, node, ctx); - let b4 = component(\`ErrorComponent\`, {}, key + \`__2\`, node, ctx); + const b3 = component(\`ClassicCompoent\`, {}, key + \`__1\`, node, ctx); + const b4 = component(\`ErrorComponent\`, {}, key + \`__2\`, node, ctx); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { - let b5 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); + const b5 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); return block1([], [b5]); } }" @@ -718,7 +718,7 @@ exports[`can catch errors catchError in catchError 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Boom\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Boom\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -745,16 +745,16 @@ exports[`can catch errors catching error, rethrow, render parent -- a main comp let { prepareList, capture, markRaw, withKey } = helpers; function slot1(ctx, node, key = \\"\\") { - let Comp1 = ctx['cp'].Comp; + const Comp1 = ctx['cp'].Comp; return toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(Object.values(ctx['state'].cps)); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(Object.values(ctx['state'].cps));; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`cp\`] = v_block1[i1]; - let key1 = ctx['cp'].id; + const key1 = ctx['cp'].id; const v1 = ctx['cp']; const ctx1 = capture(ctx); c_block1[i1] = withKey(component(\`ErrorHandler\`, {onError: ()=>this.cleanUp(v1.id),slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2__\${key1}\`, node, ctx), key1); @@ -820,16 +820,16 @@ exports[`can catch errors catching in child makes parent render 1`] = ` let { prepareList, capture, markRaw, withKey } = helpers; function slot1(ctx, node, key = \\"\\") { - let Comp1 = ctx['elem'][1]; + const Comp1 = ctx['elem'][1]; return toggler(Comp1, component(Comp1, {id: ctx['elem'][0]}, key + \`__1\`, node, ctx)); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(Object.entries(this.elements)); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(Object.entries(this.elements));; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`elem\`] = v_block1[i1]; - let key1 = ctx['elem'][0]; + const key1 = ctx['elem'][0]; const v1 = ctx['elem']; const ctx1 = capture(ctx); c_block1[i1] = withKey(component(\`Catch\`, {onError: (_error)=>this.onError(v1[0],_error),slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2__\${key1}\`, node, ctx), key1); @@ -891,8 +891,8 @@ exports[`can catch errors error in mounted on a component with a sibling (proper } return function template(ctx, node, key = \\"\\") { - let b2 = component(\`OK\`, {}, key + \`__1\`, node, ctx); - let b4 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); + const b2 = component(\`OK\`, {}, key + \`__1\`, node, ctx); + const b4 = component(\`ErrorBoundary\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); return block1([], [b2, b4]); } }" @@ -1010,7 +1010,7 @@ exports[`errors and promises a rendering error in a sub component will reject th let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1052,7 +1052,7 @@ exports[`errors and promises a rendering error will reject the render promise (w let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); let txt1 = ctx['x'].y; return block1([txt1], [b2]); } diff --git a/tests/components/__snapshots__/event_handling.test.ts.snap b/tests/components/__snapshots__/event_handling.test.ts.snap index ad9b407a..0cb9dc4e 100644 --- a/tests/components/__snapshots__/event_handling.test.ts.snap +++ b/tests/components/__snapshots__/event_handling.test.ts.snap @@ -37,7 +37,7 @@ exports[`event handling handler receive the event as argument 1`] = ` return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['inc'], ctx]; - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); let txt1 = ctx['state'].value; return block1([hdlr1, txt1], [b2]); } @@ -99,16 +99,16 @@ exports[`event handling objects from scope are properly captured by t-on 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; const v1 = ctx['onClick']; const v2 = ctx['item']; let hdlr1 = [_ev=>v1(v2.val,_ev), ctx]; c_block2[i1] = withKey(block3([hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -140,16 +140,16 @@ exports[`event handling t-on with handler bound to dynamic argument on a t-forea return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = ctx['item']; + const key1 = ctx['item']; const v1 = ctx['onClick']; const v2 = ctx['item']; let hdlr1 = [_ev=>v1(v2,_ev), ctx]; c_block2[i1] = withKey(block3([hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/higher_order_component.test.ts.snap b/tests/components/__snapshots__/higher_order_component.test.ts.snap index 0d4b5afe..4724513c 100644 --- a/tests/components/__snapshots__/higher_order_component.test.ts.snap +++ b/tests/components/__snapshots__/higher_order_component.test.ts.snap @@ -147,7 +147,7 @@ exports[`basics top level sub widget with a parent 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ComponentB\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`ComponentB\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/hooks.test.ts.snap b/tests/components/__snapshots__/hooks.test.ts.snap index 2f610f5c..7c98c2d7 100644 --- a/tests/components/__snapshots__/hooks.test.ts.snap +++ b/tests/components/__snapshots__/hooks.test.ts.snap @@ -109,8 +109,8 @@ exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['env'].val); - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = text(ctx['env'].val); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" @@ -140,8 +140,8 @@ exports[`hooks parent and child env (with useChildSubEnv) 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['env'].val); - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = text(ctx['env'].val); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" @@ -167,8 +167,8 @@ exports[`hooks parent and child env (with useSubEnv) 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['env'].val); - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = text(ctx['env'].val); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" diff --git a/tests/components/__snapshots__/lifecycle.test.ts.snap b/tests/components/__snapshots__/lifecycle.test.ts.snap index ccc0413c..71d5c43d 100644 --- a/tests/components/__snapshots__/lifecycle.test.ts.snap +++ b/tests/components/__snapshots__/lifecycle.test.ts.snap @@ -21,8 +21,8 @@ exports[`lifecycle hooks component semantics 1`] = ` let block1 = createBlock(\`
    A
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`B\`, {}, key + \`__1\`, node, ctx); - let b3 = component(\`C\`, {}, key + \`__2\`, node, ctx); + const b2 = component(\`B\`, {}, key + \`__1\`, node, ctx); + const b3 = component(\`C\`, {}, key + \`__2\`, node, ctx); return block1([], [b2, b3]); } }" @@ -110,7 +110,7 @@ exports[`lifecycle hooks components are unmounted and destroyed if no longer in return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - let b3 = component(\`Child\`, {n: ctx['state'].n}, key + \`__1\`, node, ctx); + const b3 = component(\`Child\`, {n: ctx['state'].n}, key + \`__1\`, node, ctx); b2 = block2([], [b3]); } return multi([b2]); @@ -196,7 +196,7 @@ exports[`lifecycle hooks hooks are called in proper order in widget creation/des let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -245,7 +245,7 @@ exports[`lifecycle hooks lifecycle semantics 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {a: ctx['state'].a}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {a: ctx['state'].a}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -458,7 +458,7 @@ exports[`lifecycle hooks mounted hook is called on subcomponents, in proper orde let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -502,7 +502,7 @@ exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper o let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ChildChild\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`ChildChild\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -555,7 +555,7 @@ exports[`lifecycle hooks patched hook is called after updateProps 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {a: ctx['state'].a}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {a: ctx['state'].a}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -666,7 +666,7 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {n: ctx['state'].n}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {n: ctx['state'].n}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -680,7 +680,7 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`ChildChild\`, {n: ctx['props'].n}, key + \`__1\`, node, ctx); + const b2 = component(\`ChildChild\`, {n: ctx['props'].n}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/props.test.ts.snap b/tests/components/__snapshots__/props.test.ts.snap index 3d97985c..75b6c87f 100644 --- a/tests/components/__snapshots__/props.test.ts.snap +++ b/tests/components/__snapshots__/props.test.ts.snap @@ -8,7 +8,7 @@ exports[`basics accept ES6-like syntax for props (with getters) 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {greetings: ctx['greetings']}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {greetings: ctx['greetings']}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -36,10 +36,10 @@ exports[`basics arrow functions as prop correctly capture their scope 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`item\`] = v_block1[i1]; - let key1 = ctx['item'].val; + const key1 = ctx['item'].val; const v1 = ctx['onClick']; const v2 = ctx['item']; c_block1[i1] = withKey(component(\`Child\`, {onClick: _ev=>v1(v2.val,_ev)}, key + \`__1__\${key1}\`, node, ctx), key1); @@ -71,7 +71,7 @@ exports[`basics explicit object prop 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {value: ctx['state'].val}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {value: ctx['state'].val}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -158,7 +158,7 @@ exports[`basics t-set with a body expression can be passed in props, and then t- ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx[\`abc\`] = new LazyValue(value1, ctx, node); - let b3 = component(\`Child\`, {val: ctx['abc']}, key + \`__1\`, node, ctx); + const b3 = component(\`Child\`, {val: ctx['abc']}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -174,7 +174,7 @@ exports[`basics t-set with a body expression can be passed in props, and then t- return function template(ctx, node, key = \\"\\") { let txt1 = ctx['props'].val; - let b2 = safeOutput(ctx['props'].val); + const b2 = safeOutput(ctx['props'].val); return block1([txt1], [b2]); } }" @@ -192,7 +192,7 @@ exports[`basics t-set with a body expression can be used as textual prop 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"abc\\", \`42\`); - let b2 = component(\`Child\`, {val: ctx['abc']}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {val: ctx['abc']}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -224,7 +224,7 @@ exports[`basics t-set works 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"val\\", 42); - let b2 = component(\`Child\`, {val: ctx['val']}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {val: ctx['val']}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/props_validation.test.ts.snap b/tests/components/__snapshots__/props_validation.test.ts.snap index 4a106a16..976ae949 100644 --- a/tests/components/__snapshots__/props_validation.test.ts.snap +++ b/tests/components/__snapshots__/props_validation.test.ts.snap @@ -23,7 +23,7 @@ exports[`default props can set default boolean values 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -59,7 +59,7 @@ exports[`default props can set default values 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -89,7 +89,7 @@ exports[`default props default values are also set whenever component is updated return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['state'].p}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -171,7 +171,7 @@ exports[`props validation can validate a prop with multiple types 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -200,7 +200,7 @@ exports[`props validation can validate a prop with multiple types 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -229,7 +229,7 @@ exports[`props validation can validate a prop with multiple types 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -245,7 +245,7 @@ exports[`props validation can validate an array with given primitive type 1`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -274,7 +274,7 @@ exports[`props validation can validate an array with given primitive type 3`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -303,7 +303,7 @@ exports[`props validation can validate an array with given primitive type 5`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -319,7 +319,7 @@ exports[`props validation can validate an array with given primitive type 6`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -335,7 +335,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -364,7 +364,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -393,7 +393,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -422,7 +422,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -438,7 +438,7 @@ exports[`props validation can validate an object with simple shape 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -467,7 +467,7 @@ exports[`props validation can validate an object with simple shape 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -483,7 +483,7 @@ exports[`props validation can validate an object with simple shape 4`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -499,7 +499,7 @@ exports[`props validation can validate an object with simple shape 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -515,7 +515,7 @@ exports[`props validation can validate an optional props 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -544,7 +544,7 @@ exports[`props validation can validate an optional props 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -573,7 +573,7 @@ exports[`props validation can validate an optional props 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -589,7 +589,7 @@ exports[`props validation can validate recursively complicated prop def 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -618,7 +618,7 @@ exports[`props validation can validate recursively complicated prop def 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -647,7 +647,7 @@ exports[`props validation can validate recursively complicated prop def 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -663,7 +663,7 @@ exports[`props validation default values are applied before validating props at return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['state'].p}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -693,7 +693,7 @@ exports[`props validation missing required boolean prop causes an error 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -709,7 +709,7 @@ exports[`props validation mix of optional and mandatory 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`Child\`, props1, ctx); - let b2 = component(\`Child\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -725,7 +725,7 @@ exports[`props validation props are validated in dev mode (code snapshot) 1`] = return function template(ctx, node, key = \\"\\") { const props1 = {message: 1}; helpers.validateProps(\`Child\`, props1, ctx); - let b2 = component(\`Child\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -755,7 +755,7 @@ exports[`props validation props are validated whenever component is updated 1`] return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['state'].p}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -785,7 +785,7 @@ exports[`props validation props: list of strings 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -801,7 +801,7 @@ exports[`props validation validate simple types 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -817,7 +817,7 @@ exports[`props validation validate simple types 2`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -846,7 +846,7 @@ exports[`props validation validate simple types 4`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -862,7 +862,7 @@ exports[`props validation validate simple types 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -878,7 +878,7 @@ exports[`props validation validate simple types 6`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -907,7 +907,7 @@ exports[`props validation validate simple types 8`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -923,7 +923,7 @@ exports[`props validation validate simple types 9`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -939,7 +939,7 @@ exports[`props validation validate simple types 10`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -968,7 +968,7 @@ exports[`props validation validate simple types 12`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -984,7 +984,7 @@ exports[`props validation validate simple types 13`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1000,7 +1000,7 @@ exports[`props validation validate simple types 14`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1029,7 +1029,7 @@ exports[`props validation validate simple types 16`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1045,7 +1045,7 @@ exports[`props validation validate simple types 17`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1061,7 +1061,7 @@ exports[`props validation validate simple types 18`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1090,7 +1090,7 @@ exports[`props validation validate simple types 20`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1106,7 +1106,7 @@ exports[`props validation validate simple types 21`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1122,7 +1122,7 @@ exports[`props validation validate simple types 22`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1151,7 +1151,7 @@ exports[`props validation validate simple types 24`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1167,7 +1167,7 @@ exports[`props validation validate simple types, alternate form 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1183,7 +1183,7 @@ exports[`props validation validate simple types, alternate form 2`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1212,7 +1212,7 @@ exports[`props validation validate simple types, alternate form 4`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1228,7 +1228,7 @@ exports[`props validation validate simple types, alternate form 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1244,7 +1244,7 @@ exports[`props validation validate simple types, alternate form 6`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1273,7 +1273,7 @@ exports[`props validation validate simple types, alternate form 8`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1289,7 +1289,7 @@ exports[`props validation validate simple types, alternate form 9`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1305,7 +1305,7 @@ exports[`props validation validate simple types, alternate form 10`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1334,7 +1334,7 @@ exports[`props validation validate simple types, alternate form 12`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1350,7 +1350,7 @@ exports[`props validation validate simple types, alternate form 13`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1366,7 +1366,7 @@ exports[`props validation validate simple types, alternate form 14`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1395,7 +1395,7 @@ exports[`props validation validate simple types, alternate form 16`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1411,7 +1411,7 @@ exports[`props validation validate simple types, alternate form 17`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1427,7 +1427,7 @@ exports[`props validation validate simple types, alternate form 18`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1456,7 +1456,7 @@ exports[`props validation validate simple types, alternate form 20`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1472,7 +1472,7 @@ exports[`props validation validate simple types, alternate form 21`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1488,7 +1488,7 @@ exports[`props validation validate simple types, alternate form 22`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1517,7 +1517,7 @@ exports[`props validation validate simple types, alternate form 24`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1533,7 +1533,7 @@ exports[`props validation validation is only done in dev mode 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - let b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, props1, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1547,7 +1547,7 @@ exports[`props validation validation is only done in dev mode 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`SubComp\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`SubComp\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/refs.test.ts.snap b/tests/components/__snapshots__/refs.test.ts.snap index bb44afbe..545acfda 100644 --- a/tests/components/__snapshots__/refs.test.ts.snap +++ b/tests/components/__snapshots__/refs.test.ts.snap @@ -77,7 +77,7 @@ exports[`refs refs are properly bound in slots 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].val; const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([txt1], [b3]); } }" @@ -92,7 +92,7 @@ exports[`refs refs are properly bound in slots 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'footer', false, {}); + const b2 = callSlot(ctx, node, key, 'footer', false, {}); return block1([], [b2]); } }" @@ -110,8 +110,8 @@ exports[`refs throws if there are 2 same refs at the same time 1`] = ` return function template(ctx, node, key = \\"\\") { const refs = ctx.__owl__.refs; const ref1 = multiRefSetter(refs, \`coucou\`); - let b2 = block2([ref1]); - let b3 = block3([ref1]); + const b2 = block2([ref1]); + const b3 = block3([ref1]); return multi([b2, b3]); } }" diff --git a/tests/components/__snapshots__/rendering.test.ts.snap b/tests/components/__snapshots__/rendering.test.ts.snap index 70dc1975..a953fc24 100644 --- a/tests/components/__snapshots__/rendering.test.ts.snap +++ b/tests/components/__snapshots__/rendering.test.ts.snap @@ -17,8 +17,8 @@ exports[`force render in case of existing render 2`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`C\`, {}, key + \`__1\`, node, ctx); - let b3 = text(ctx['props'].val); + const b2 = component(\`C\`, {}, key + \`__1\`, node, ctx); + const b3 = text(ctx['props'].val); return multi([b2, b3]); } }" @@ -41,8 +41,8 @@ exports[`rendering semantics can force a render to update sub tree 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['state'].value); - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = text(ctx['state'].value); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" @@ -65,8 +65,8 @@ exports[`rendering semantics can render a parent without rendering child 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['state'].value); - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = text(ctx['state'].value); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" @@ -133,9 +133,9 @@ exports[`rendering semantics render with deep=true followed by render with deep= let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`parent\`); - let b3 = text(ctx['state'].value); - let b4 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = text(\`parent\`); + const b3 = text(ctx['state'].value); + const b4 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3, b4]); } }" @@ -147,8 +147,8 @@ exports[`rendering semantics render with deep=true followed by render with deep= let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`child\`); - let b3 = text(ctx['env'].getValue()); + const b2 = text(\`child\`); + const b3 = text(ctx['env'].getValue()); return multi([b2, b3]); } }" @@ -160,8 +160,8 @@ exports[`rendering semantics rendering is atomic (for one subtree) 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(ctx['state'].obj.val); - let b3 = component(\`B\`, {obj: ctx['state'].obj}, key + \`__1\`, node, ctx); + const b2 = text(ctx['state'].obj.val); + const b3 = component(\`B\`, {obj: ctx['state'].obj}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" diff --git a/tests/components/__snapshots__/slots.test.ts.snap b/tests/components/__snapshots__/slots.test.ts.snap index ccd3616d..82666569 100644 --- a/tests/components/__snapshots__/slots.test.ts.snap +++ b/tests/components/__snapshots__/slots.test.ts.snap @@ -8,7 +8,7 @@ exports[`slots can define a default content 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Dialog\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Dialog\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -27,7 +27,7 @@ exports[`slots can define a default content 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1); + const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1); return block1([], [b3]); } }" @@ -53,7 +53,7 @@ exports[`slots can define and call slots 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b4 = component(\`Dialog\`, {slots: markRaw({'header': {__render: slot1, __ctx: ctx1}, 'footer': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b4 = component(\`Dialog\`, {slots: markRaw({'header': {__render: slot1, __ctx: ctx1}, 'footer': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b4]); } }" @@ -68,8 +68,8 @@ exports[`slots can define and call slots 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'header', false, {}); - let b3 = callSlot(ctx, node, key, 'footer', false, {}); + const b2 = callSlot(ctx, node, key, 'header', false, {}); + const b3 = callSlot(ctx, node, key, 'footer', false, {}); return block1([], [b2, b3]); } }" @@ -99,8 +99,8 @@ exports[`slots can define and call slots with bound params 2`] = ` let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'abc', false, {}); - let b3 = text(ctx['props'].slots['abc'].getValue()); + const b2 = callSlot(ctx, node, key, 'abc', false, {}); + const b3 = text(ctx['props'].slots['abc'].getValue()); return multi([b2, b3]); } }" @@ -126,7 +126,7 @@ exports[`slots can define and call slots with params 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b4 = component(\`Dialog\`, {slots: markRaw({'header': {__render: slot1, __ctx: ctx1, param: ctx['var']}, 'footer': {__render: slot2, __ctx: ctx1, param: '5'}})}, key + \`__1\`, node, ctx); + const b4 = component(\`Dialog\`, {slots: markRaw({'header': {__render: slot1, __ctx: ctx1, param: ctx['var']}, 'footer': {__render: slot2, __ctx: ctx1, param: '5'}})}, key + \`__1\`, node, ctx); return block1([], [b4]); } }" @@ -142,9 +142,9 @@ exports[`slots can define and call slots with params 2`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['props'].slots['header'].param; - let b2 = callSlot(ctx, node, key, 'header', false, {}); + const b2 = callSlot(ctx, node, key, 'header', false, {}); let txt2 = ctx['props'].slots['footer'].param; - let b3 = callSlot(ctx, node, key, 'footer', false, {}); + const b3 = callSlot(ctx, node, key, 'footer', false, {}); return block1([txt1, txt2], [b2, b3]); } }" @@ -161,8 +161,8 @@ exports[`slots can render node with t-ref and Component in same slot 1`] = ` function slot1(ctx, node, key = \\"\\") { const refs = ctx.__owl__.refs; const ref1 = (el) => refs[\`div\`] = el; - let b2 = block2([ref1]); - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = block2([ref1]); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return multi([b2, b3]); } @@ -317,7 +317,7 @@ exports[`slots content is the default slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -332,7 +332,7 @@ exports[`slots content is the default slot 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -352,7 +352,7 @@ exports[`slots default content is not rendered if named slot is provided 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'header': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'header': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -371,7 +371,7 @@ exports[`slots default content is not rendered if named slot is provided 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1); + const b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1); return block1([], [b3]); } }" @@ -390,7 +390,7 @@ exports[`slots default content is not rendered if slot is provided 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -409,7 +409,7 @@ exports[`slots default content is not rendered if slot is provided 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1); + const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1); return block1([], [b3]); } }" @@ -429,7 +429,7 @@ exports[`slots default slot next to named slot, with default content 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -452,8 +452,8 @@ exports[`slots default slot next to named slot, with default content 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1); - let b5 = callSlot(ctx, node, key, 'footer', false, {}, defaultContent2); + const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1); + const b5 = callSlot(ctx, node, key, 'footer', false, {}, defaultContent2); return block1([], [b3, b5]); } }" @@ -518,7 +518,7 @@ exports[`slots default slot with slot scope: shorthand syntax 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {bool: ctx['state'].bool}); + const b2 = callSlot(ctx, node, key, 'default', false, {bool: ctx['state'].bool}); return block1([], [b2]); } }" @@ -565,7 +565,7 @@ exports[`slots default slot work with text nodes 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -580,7 +580,7 @@ exports[`slots default slot work with text nodes 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -598,8 +598,8 @@ exports[`slots dynamic t-slot call 1`] = ` let block5 = createBlock(\`

    slot2

    \`); function slot1(ctx, node, key = \\"\\") { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); return multi([b3, b4]); } @@ -609,7 +609,7 @@ exports[`slots dynamic t-slot call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b6 = component(\`Toggler\`, {slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b6 = component(\`Toggler\`, {slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b6]); } }" @@ -626,7 +626,7 @@ exports[`slots dynamic t-slot call 2`] = ` return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['toggle'], ctx]; const slot1 = (ctx['current'].slot); - let b2 = toggler(slot1, callSlot(ctx, node, key, slot1), true, {}); + const b2 = toggler(slot1, callSlot(ctx, node, key, slot1), true, {}); return block1([hdlr1], [b2]); } }" @@ -644,8 +644,8 @@ exports[`slots dynamic t-slot call with default 1`] = ` let block5 = createBlock(\`

    slot2

    \`); function slot1(ctx, node, key = \\"\\") { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); return multi([b3, b4]); } @@ -655,7 +655,7 @@ exports[`slots dynamic t-slot call with default 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b6 = component(\`Toggler\`, {slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b6 = component(\`Toggler\`, {slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b6]); } }" @@ -675,7 +675,7 @@ exports[`slots dynamic t-slot call with default 2`] = ` return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['toggle'], ctx]; - let b3 = callSlot(ctx, node, key, (ctx['current'].slot), true, {}, defaultContent1); + const b3 = callSlot(ctx, node, key, (ctx['current'].slot), true, {}, defaultContent1); return block1([hdlr1], [b3]); } }" @@ -704,8 +704,8 @@ exports[`slots fun: two calls to the same slot 2`] = ` let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } }" @@ -719,7 +719,7 @@ exports[`slots missing slots are ignored 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Dialog\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Dialog\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -734,8 +734,8 @@ exports[`slots missing slots are ignored 2`] = ` let block1 = createBlock(\`some content\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); - let b3 = callSlot(ctx, node, key, 'footer', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); + const b3 = callSlot(ctx, node, key, 'footer', false, {}); return block1([], [b2, b3]); } }" @@ -761,8 +761,8 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['inc'], ctx]; - let b2 = block2([hdlr1]); - let b3 = component(\`A\`, {number: ctx['state'].number}, key + \`__1\`, node, ctx); + const b2 = block2([hdlr1]); + const b3 = component(\`A\`, {number: ctx['state'].number}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" @@ -776,8 +776,8 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil const callTemplate_1 = getTemplate(\`__template__1002\`); function slot1(ctx, node, key = \\"\\") { - let b2 = text(\`[A]\`); - let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = text(\`[A]\`); + const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return multi([b2, b3]); } @@ -798,12 +798,12 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - let b2 = text(\`[sub1] \`); + const b2 = text(\`[sub1] \`); setContextValue(ctx, \\"dummy\\", ctx['validate']); ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"v\\", ctx['props'].number); - let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return multi([b2, b3]); } }" @@ -815,9 +815,9 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`[sub2\`); - let b3 = text(ctx['v']); - let b4 = text(\`]\`); + const b2 = text(\`[sub2\`); + const b3 = text(ctx['v']); + const b4 = text(\`]\`); return multi([b2, b3, b4]); } }" @@ -829,8 +829,8 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`[B]\`); - let b3 = component(\`C\`, {slots: ctx['props'].slots}, key + \`__1\`, node, ctx); + const b2 = text(\`[B]\`); + const b3 = component(\`C\`, {slots: ctx['props'].slots}, key + \`__1\`, node, ctx); return multi([b2, b3]); } }" @@ -843,8 +843,8 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`[C]\`); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = text(\`[C]\`); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } }" @@ -861,13 +861,13 @@ exports[`slots multiple roots are allowed in a default slot 1`] = ` let block4 = createBlock(\`rocks\`); function slot1(ctx, node, key = \\"\\") { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { - let b5 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); + const b5 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); return block1([], [b5]); } }" @@ -882,7 +882,7 @@ exports[`slots multiple roots are allowed in a default slot 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -899,14 +899,14 @@ exports[`slots multiple roots are allowed in a named slot 1`] = ` let block4 = createBlock(\`rocks\`); function slot1(ctx, node, key = \\"\\") { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b5 = component(\`Dialog\`, {slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b5 = component(\`Dialog\`, {slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b5]); } }" @@ -921,7 +921,7 @@ exports[`slots multiple roots are allowed in a named slot 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'content', false, {}); + const b2 = callSlot(ctx, node, key, 'content', false, {}); return block1([], [b2]); } }" @@ -957,8 +957,8 @@ exports[`slots multiple slots containing components 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 's1', false, {}); - let b3 = callSlot(ctx, node, key, 's2', false, {}); + const b2 = callSlot(ctx, node, key, 's1', false, {}); + const b3 = callSlot(ctx, node, key, 's2', false, {}); return block1([], [b2, b3]); } }" @@ -1005,7 +1005,7 @@ exports[`slots named slot inside slot 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b5 = component(\`Child\`, {slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b5 = component(\`Child\`, {slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b5]); } }" @@ -1020,8 +1020,8 @@ exports[`slots named slot inside slot 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'brol', false, {}); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'brol', false, {}); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2, b3]); } }" @@ -1054,7 +1054,7 @@ exports[`slots named slot inside slot, part 3 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b5 = component(\`Child\`, {slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b5 = component(\`Child\`, {slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b5]); } }" @@ -1069,8 +1069,8 @@ exports[`slots named slot inside slot, part 3 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'brol', false, {}); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'brol', false, {}); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2, b3]); } }" @@ -1084,7 +1084,7 @@ exports[`slots named slots can define a default content 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Dialog\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Dialog\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -1103,7 +1103,7 @@ exports[`slots named slots can define a default content 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1); + const b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1); return block1([], [b3]); } }" @@ -1136,7 +1136,7 @@ exports[`slots named slots inside slot, again 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b5 = component(\`Child\`, {slots: markRaw({'brol1': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b5 = component(\`Child\`, {slots: markRaw({'brol1': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b5]); } }" @@ -1159,9 +1159,9 @@ exports[`slots named slots inside slot, again 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = callSlot(ctx, node, key, 'brol1', false, {}, defaultContent1); - let b5 = callSlot(ctx, node, key, 'brol2', false, {}, defaultContent2); - let b6 = callSlot(ctx, node, key, 'default', false, {}); + const b3 = callSlot(ctx, node, key, 'brol1', false, {}, defaultContent1); + const b5 = callSlot(ctx, node, key, 'brol2', false, {}, defaultContent2); + const b6 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b3, b5, b6]); } }" @@ -1184,7 +1184,7 @@ exports[`slots nested slots in same template 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b4 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); + const b4 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx); return block1([], [b4]); } }" @@ -1199,7 +1199,7 @@ exports[`slots nested slots in same template 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1214,7 +1214,7 @@ exports[`slots nested slots in same template 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1274,7 +1274,7 @@ exports[`slots nested slots: evaluation context and parented relationship 3`] = let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1314,7 +1314,7 @@ exports[`slots no named slot content => just no children 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'header', false, {}); + const b2 = callSlot(ctx, node, key, 'header', false, {}); return block1([], [b2]); } }" @@ -1345,7 +1345,7 @@ exports[`slots simple default slot 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1382,7 +1382,7 @@ exports[`slots simple default slot with params 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {bool: ctx['state'].bool}); + const b2 = callSlot(ctx, node, key, 'default', false, {bool: ctx['state'].bool}); return block1([], [b2]); } }" @@ -1476,7 +1476,7 @@ exports[`slots simple slot with slot scope 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'slotName', false, {bool: ctx['state'].bool}); + const b2 = callSlot(ctx, node, key, 'slotName', false, {bool: ctx['state'].bool}); return block1([], [b2]); } }" @@ -1497,7 +1497,7 @@ exports[`slots slot and (inline) t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -1525,7 +1525,7 @@ exports[`slots slot and (inline) t-call 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1546,7 +1546,7 @@ exports[`slots slot and t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -1574,7 +1574,7 @@ exports[`slots slot and t-call 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1593,7 +1593,7 @@ exports[`slots slot and t-esc 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -1608,7 +1608,7 @@ exports[`slots slot and t-esc 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1629,7 +1629,7 @@ exports[`slots slot are properly rendered if inner props are changed 1`] = ` return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['inc'], ctx]; let txt1 = ctx['state'].val; - let b3 = component(\`GenericComponent\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`GenericComponent\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([hdlr1, txt1], [b3]); } }" @@ -1644,7 +1644,7 @@ exports[`slots slot are properly rendered if inner props are changed 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1687,9 +1687,9 @@ exports[`slots slot content has different key from other content -- dynamic slot let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {parent: 'SlotDisplay'}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {parent: 'SlotDisplay'}, key + \`__1\`, node, ctx); const slot1 = (ctx['slotName']); - let b3 = toggler(slot1, callSlot(ctx, node, key, slot1), true, {}); + const b3 = toggler(slot1, callSlot(ctx, node, key, slot1), true, {}); return multi([b2, b3]); } }" @@ -1732,8 +1732,8 @@ exports[`slots slot content has different key from other content -- static slot let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {parent: 'SlotDisplay'}, key + \`__1\`, node, ctx); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = component(\`Child\`, {parent: 'SlotDisplay'}, key + \`__1\`, node, ctx); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } }" @@ -1785,7 +1785,7 @@ exports[`slots slot content is bound to caller (variation) 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1819,7 +1819,7 @@ exports[`slots slot content is bound to caller 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -1838,7 +1838,7 @@ exports[`slots slot preserves properly parented relationship 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -1882,7 +1882,7 @@ exports[`slots slot preserves properly parented relationship, even through t-cal return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -1947,7 +1947,7 @@ exports[`slots slots and wrapper components 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2004,7 +2004,7 @@ exports[`slots slots are rendered with proper context 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].val; const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([txt1], [b3]); } }" @@ -2019,7 +2019,7 @@ exports[`slots slots are rendered with proper context 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'footer', false, {}); + const b2 = callSlot(ctx, node, key, 'footer', false, {}); return block1([], [b2]); } }" @@ -2035,22 +2035,22 @@ exports[`slots slots are rendered with proper context, part 2 1`] = ` let block3 = createBlock(\`
  • \`); function slot1(ctx, node, key = \\"\\") { - let b5 = text(\`User \`); - let b6 = text(ctx['user'].name); + const b5 = text(\`User \`); + const b6 = text(ctx['user'].name); return multi([b5, b6]); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`user\`] = v_block2[i1]; - let key1 = ctx['user'].id; + const key1 = ctx['user'].id; const ctx1 = capture(ctx); - let b7 = component(\`Link\`, {to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx); + const b7 = component(\`Link\`, {to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([], [b7]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -2066,7 +2066,7 @@ exports[`slots slots are rendered with proper context, part 2 2`] = ` return function template(ctx, node, key = \\"\\") { let attr1 = ctx['props'].to; - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([attr1], [b2]); } }" @@ -2089,16 +2089,16 @@ exports[`slots slots are rendered with proper context, part 3 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`user\`] = v_block2[i1]; - let key1 = ctx['user'].id; + const key1 = ctx['user'].id; setContextValue(ctx, \\"userdescr\\", 'User '+ctx['user'].name); const ctx1 = capture(ctx); - let b5 = component(\`Link\`, {to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx); + const b5 = component(\`Link\`, {to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([], [b5]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -2114,7 +2114,7 @@ exports[`slots slots are rendered with proper context, part 3 2`] = ` return function template(ctx, node, key = \\"\\") { let attr1 = ctx['props'].to; - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([attr1], [b2]); } }" @@ -2137,7 +2137,7 @@ exports[`slots slots are rendered with proper context, part 4 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"userdescr\\", 'User '+ctx['state'].user.name); const ctx1 = capture(ctx); - let b3 = component(\`Link\`, {to: '/user/'+ctx['state'].user.id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Link\`, {to: '/user/'+ctx['state'].user.id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -2153,7 +2153,7 @@ exports[`slots slots are rendered with proper context, part 4 2`] = ` return function template(ctx, node, key = \\"\\") { let attr1 = ctx['props'].to; - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([attr1], [b2]); } }" @@ -2178,7 +2178,7 @@ exports[`slots slots in slots, with vars 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"test\\", ctx['state'].name); const ctx1 = capture(ctx); - let b3 = component(\`A\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`A\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -2197,7 +2197,7 @@ exports[`slots slots in slots, with vars 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`B\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); + const b3 = component(\`B\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -2212,7 +2212,7 @@ exports[`slots slots in slots, with vars 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2232,15 +2232,15 @@ exports[`slots slots in t-foreach and re-rendering 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2)); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`n\`] = v_block2[i1]; ctx[\`n_index\`] = i1; - let key1 = ctx['n_index']; + const key1 = ctx['n_index']; const ctx1 = capture(ctx); c_block2[i1] = withKey(component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -2256,7 +2256,7 @@ exports[`slots slots in t-foreach and re-rendering 2`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].val; - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([txt1], [b2]); } }" @@ -2280,26 +2280,26 @@ exports[`slots slots in t-foreach in t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['tree']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['tree']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`node1\`] = v_block2[i1]; - let key1 = ctx['node1'].key; + const key1 = ctx['node1'].key; let txt1 = ctx['node1'].value; - let b4 = block4([txt1]); + const b4 = block4([txt1]); ctx = Object.create(ctx); - const [k_block6, v_block6, l_block6, c_block6] = prepareList(ctx['node1'].nodes); + const [k_block6, v_block6, l_block6, c_block6] = prepareList(ctx['node1'].nodes);; for (let i2 = 0; i2 < l_block6; i2++) { ctx[\`node2\`] = v_block6[i2]; - let key2 = ctx['node2'].key; + const key2 = ctx['node2'].key; const ctx1 = capture(ctx); c_block6[i2] = withKey(component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}__\${key2}\`, node, ctx), key2); } ctx = ctx.__proto__; - let b6 = list(c_block6); - let b5 = block5([], [b6]); + const b6 = list(c_block6); + const b5 = block5([], [b6]); c_block2[i1] = withKey(multi([b4, b5]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -2314,7 +2314,7 @@ exports[`slots slots in t-foreach in t-foreach 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2336,16 +2336,16 @@ exports[`slots slots in t-foreach with t-set and re-rendering 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2)); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`n\`] = v_block2[i1]; ctx[\`n_index\`] = i1; - let key1 = ctx['n_index']; + const key1 = ctx['n_index']; setContextValue(ctx, \\"dummy\\", ctx['n_index']); const ctx1 = capture(ctx); c_block2[i1] = withKey(component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -2361,7 +2361,7 @@ exports[`slots slots in t-foreach with t-set and re-rendering 2`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].val; - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([txt1], [b2]); } }" @@ -2382,7 +2382,7 @@ exports[`slots t-debug on a t-set-slot (defining a slot) 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -2397,7 +2397,7 @@ exports[`slots t-debug on a t-set-slot (defining a slot) 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'content', false, {}); + const b2 = callSlot(ctx, node, key, 'content', false, {}); return block1([], [b2]); } }" @@ -2420,7 +2420,7 @@ exports[`slots t-set t-value in a slot 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -2435,7 +2435,7 @@ exports[`slots t-set t-value in a slot 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2451,16 +2451,16 @@ exports[`slots t-slot in recursive templates 1`] = ` function slot1(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - let b2 = text(ctx['name']); + const b2 = text(ctx['name']); ctx = Object.create(ctx); - const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['items']); + const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block3; i1++) { ctx[\`item\`] = v_block3[i1]; ctx[\`item_first\`] = i1 === 0; ctx[\`item_last\`] = i1 === v_block3.length - 1; ctx[\`item_index\`] = i1; ctx[\`item_value\`] = k_block3[i1]; - let key1 = ctx['item'].name; + const key1 = ctx['item'].name; let b5,b6; if (!ctx['item'].children.length) { b5 = text(ctx['item'].name); @@ -2475,7 +2475,7 @@ exports[`slots t-slot in recursive templates 1`] = ` c_block3[i1] = withKey(multi([b5, b6]), key1); } ctx = ctx.__proto__; - let b3 = list(c_block3); + const b3 = list(c_block3); return multi([b2, b3]); } @@ -2495,7 +2495,7 @@ exports[`slots t-slot in recursive templates 2`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2514,7 +2514,7 @@ exports[`slots t-slot nested within another slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Dialog\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -2537,7 +2537,7 @@ exports[`slots t-slot nested within another slot 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b4 = component(\`Modal\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b4 = component(\`Modal\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b4]); } }" @@ -2552,7 +2552,7 @@ exports[`slots t-slot nested within another slot 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2567,7 +2567,7 @@ exports[`slots t-slot nested within another slot 4`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2614,7 +2614,7 @@ exports[`slots t-slot scope context 2`] = ` function slot1(ctx, node, key = \\"\\") { let hdlr1 = [ctx['onClick'], ctx]; - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([hdlr1], [b2]); } @@ -2651,7 +2651,7 @@ exports[`slots t-slot within dynamic t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - let b3 = component(\`Slotted\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Slotted\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -2666,7 +2666,7 @@ exports[`slots t-slot within dynamic t-call 2`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = callSlot(ctx, node, key, 'default', false, {}); return block1([], [b2]); } }" @@ -2680,7 +2680,7 @@ exports[`slots t-slot within dynamic t-call 3`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -2712,7 +2712,7 @@ exports[`slots template can just return a slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`SlotComponent\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`SlotComponent\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" diff --git a/tests/components/__snapshots__/style_class.test.ts.snap b/tests/components/__snapshots__/style_class.test.ts.snap index 7273b3a7..9ec8c482 100644 --- a/tests/components/__snapshots__/style_class.test.ts.snap +++ b/tests/components/__snapshots__/style_class.test.ts.snap @@ -20,9 +20,9 @@ exports[`style and class handling can set class on multi root component 2`] = ` let block3 = createBlock(\`b\`); return function template(ctx, node, key = \\"\\") { - let b2 = block2(); + const b2 = block2(); let attr1 = ctx['props'].class; - let b3 = block3([attr1]); + const b3 = block3([attr1]); return multi([b2, b3]); } }" @@ -205,7 +205,7 @@ exports[`style and class handling class with extra whitespaces (variation) 1`] = let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {class: 'a b c d'}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {class: 'a b c d'}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -310,7 +310,7 @@ exports[`style and class handling empty class attribute is not added on widget r let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {class: undefined}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {class: undefined}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -438,7 +438,7 @@ exports[`style and class handling t-att-class is properly added/removed on widge let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {class: {b:ctx['state'].b}}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {class: {b:ctx['state'].b}}, key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_call.test.ts.snap b/tests/components/__snapshots__/t_call.test.ts.snap index ec9ca4c4..9d94e182 100644 --- a/tests/components/__snapshots__/t_call.test.ts.snap +++ b/tests/components/__snapshots__/t_call.test.ts.snap @@ -9,7 +9,7 @@ exports[`t-call dynamic t-call 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1; - let b1 = text(\` owl \`); + const b1 = text(\` owl \`); ctx[zero] = b1; const template1 = (ctx['current'].template); return call(this, template1, ctx, node, key + \`__1\`); @@ -48,9 +48,9 @@ exports[`t-call dynamic t-call: key is propagated 1`] = ` let { call } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx); const template1 = (ctx['sub']); - let b3 = call(this, template1, ctx, node, key + \`__2\`); + const b3 = call(this, template1, ctx, node, key + \`__2\`); return multi([b2, b3]); } }" @@ -91,7 +91,7 @@ exports[`t-call handlers are properly bound through a dynamic t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const template1 = ('__template__999'); - let b2 = call(this, template1, ctx, node, key + \`__1\`); + const b2 = call(this, template1, ctx, node, key + \`__1\`); let txt1 = ctx['counter']; return block1([txt1], [b2]); } @@ -122,7 +122,7 @@ exports[`t-call handlers are properly bound through a t-call 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); let txt1 = ctx['counter']; return block1([txt1], [b2]); } @@ -153,7 +153,7 @@ exports[`t-call handlers with arguments are properly bound through a t-call 1`] let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -184,7 +184,7 @@ exports[`t-call parent is set within t-call 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -266,7 +266,7 @@ exports[`t-call recursive t-call binding this -- static t-call 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"level\\", 0); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -288,11 +288,11 @@ exports[`t-call recursive t-call binding this -- static t-call 2`] = ` if (ctx['level']<2) { let hdlr1 = [\\"stop\\", ctx['onClicked'].bind(this), ctx]; let txt1 = ctx['level']; - let b3 = block3([hdlr1, txt1]); + const b3 = block3([hdlr1, txt1]); ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"level\\", ctx['level']+1); - let b4 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b4 = callTemplate_1.call(this, ctx, node, key + \`__1\`); ctx = ctx.__proto__; b2 = multi([b3, b4]); } @@ -316,7 +316,7 @@ exports[`t-call sub components in two t-calls 1`] = ` if (ctx['state'].val===1) { b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); } else { - let b4 = callTemplate_2.call(this, ctx, node, key + \`__2\`); + const b4 = callTemplate_2.call(this, ctx, node, key + \`__2\`); b3 = block3([], [b4]); } return multi([b2, b3]); @@ -360,17 +360,17 @@ exports[`t-call t-call in t-foreach and children component 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b','c']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b','c']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; ctx[\`val_first\`] = i1 === 0; ctx[\`val_last\`] = i1 === v_block2.length - 1; ctx[\`val_index\`] = i1; ctx[\`val_value\`] = k_block2[i1]; - let key1 = ctx['val']; + const key1 = ctx['val']; c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_call_block.test.ts.snap b/tests/components/__snapshots__/t_call_block.test.ts.snap index bf91e479..827d52d6 100644 --- a/tests/components/__snapshots__/t_call_block.test.ts.snap +++ b/tests/components/__snapshots__/t_call_block.test.ts.snap @@ -8,7 +8,7 @@ exports[`t-call-block simple t-call-block with static text 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = ctx['myBlock'](); + const b2 = ctx['myBlock'](); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_component.test.ts.snap b/tests/components/__snapshots__/t_component.test.ts.snap index a1cc1155..790c3d03 100644 --- a/tests/components/__snapshots__/t_component.test.ts.snap +++ b/tests/components/__snapshots__/t_component.test.ts.snap @@ -8,8 +8,8 @@ exports[`t-component can switch between dynamic components without the need for let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let Comp1 = ctx['constructor'].components[ctx['state'].child]; - let b2 = toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); + const Comp1 = ctx['constructor'].components[ctx['state'].child]; + const b2 = toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); return block1([], [b2]); } }" @@ -48,7 +48,7 @@ exports[`t-component can use dynamic components (the class) if given (with diffe return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['state'].child; - let Comp1 = ctx['myComponent']; + const Comp1 = ctx['myComponent']; return toggler(tKey_1, toggler(Comp1, component(Comp1, {}, tKey_1 + key + \`__1\`, node, ctx))); } }" @@ -87,7 +87,7 @@ exports[`t-component can use dynamic components (the class) if given 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['state'].child; - let Comp1 = ctx['myComponent']; + const Comp1 = ctx['myComponent']; return toggler(tKey_1, toggler(Comp1, component(Comp1, {}, tKey_1 + key + \`__1\`, node, ctx))); } }" @@ -127,8 +127,8 @@ exports[`t-component modifying a sub widget 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let Comp1 = ctx['Counter']; - let b2 = toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); + const Comp1 = ctx['Counter']; + const b2 = toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); return block1([], [b2]); } }" @@ -156,7 +156,7 @@ exports[`t-component switching dynamic component 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let Comp1 = ctx['Child']; + const Comp1 = ctx['Child']; return toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); } }" @@ -192,7 +192,7 @@ exports[`t-component t-component works in simple case 1`] = ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; return function template(ctx, node, key = \\"\\") { - let Comp1 = ctx['Child']; + const Comp1 = ctx['Child']; return toggler(Comp1, component(Comp1, {}, key + \`__1\`, node, ctx)); } }" diff --git a/tests/components/__snapshots__/t_foreach.test.ts.snap b/tests/components/__snapshots__/t_foreach.test.ts.snap index 955f3375..77a7d152 100644 --- a/tests/components/__snapshots__/t_foreach.test.ts.snap +++ b/tests/components/__snapshots__/t_foreach.test.ts.snap @@ -11,14 +11,14 @@ exports[`list of components components in a node in a t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; - let key1 = 'li_'+ctx['item']; - let b4 = component(\`Child\`, {item: ctx['item']}, key + \`__1__\${key1}\`, node, ctx); + const key1 = 'li_'+ctx['item']; + const b4 = component(\`Child\`, {item: ctx['item']}, key + \`__1__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([], [b4]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -46,11 +46,11 @@ exports[`list of components crash on duplicate key in dev mode 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList([1,2]); + const [k_block1, v_block1, l_block1, c_block1] = prepareList([1,2]);; const keys1 = new Set(); for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`item\`] = v_block1[i1]; - let key1 = 'child'; + const key1 = 'child'; if (keys1.has(key1)) { throw new Error(\`Got duplicate key in t-foreach: \${key1}\`)} keys1.add(key1); const props1 = {}; @@ -84,14 +84,14 @@ exports[`list of components list of sub components inside other nodes 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`blip\`] = v_block2[i1]; - let key1 = ctx['blip'].id; - let b4 = component(\`SubComponent\`, {}, key + \`__1__\${key1}\`, node, ctx); + const key1 = ctx['blip'].id; + const b4 = component(\`SubComponent\`, {}, key + \`__1__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([], [b4]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -120,23 +120,23 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].s); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].s);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`section\`] = v_block2[i1]; ctx[\`section_index\`] = i1; - let key1 = ctx['section_index']; + const key1 = ctx['section_index']; ctx = Object.create(ctx); - const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['section'].blips); + const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['section'].blips);; for (let i2 = 0; i2 < l_block3; i2++) { ctx[\`blip\`] = v_block3[i2]; ctx[\`blip_index\`] = i2; - let key2 = ctx['blip_index']; + const key2 = ctx['blip_index']; c_block3[i2] = withKey(component(\`Child\`, {blip: ctx['blip']}, key + \`__1__\${key1}__\${key2}\`, node, ctx), key2); } ctx = ctx.__proto__; c_block2[i1] = withKey(list(c_block3), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -168,23 +168,23 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach, return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].rows); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].rows);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`row\`] = v_block2[i1]; - let key1 = ctx['row']; + const key1 = ctx['row']; ctx = Object.create(ctx); - const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].cols); + const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].cols);; for (let i2 = 0; i2 < l_block4; i2++) { ctx[\`col\`] = v_block4[i2]; - let key2 = ctx['col']; - let b6 = component(\`Child\`, {row: ctx['row'], col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, ctx); + const key2 = ctx['col']; + const b6 = component(\`Child\`, {row: ctx['row'], col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, ctx); c_block4[i2] = withKey(block5([], [b6]), key2); } ctx = ctx.__proto__; - let b4 = list(c_block4); + const b4 = list(c_block4); c_block2[i1] = withKey(block3([], [b4]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -212,10 +212,10 @@ exports[`list of components simple list 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state'].elems); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state'].elems);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`elem\`] = v_block1[i1]; - let key1 = ctx['elem'].id; + const key1 = ctx['elem'].id; c_block1[i1] = withKey(component(\`Child\`, {value: ctx['elem'].value}, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1); @@ -247,13 +247,13 @@ exports[`list of components sub components rendered in a loop 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`number\`] = v_block2[i1]; - let key1 = ctx['number']; + const key1 = ctx['number']; c_block2[i1] = withKey(component(\`Child\`, {n: ctx['number']}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -283,13 +283,13 @@ exports[`list of components sub components with some state rendered in a loop 1` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`number\`] = v_block2[i1]; - let key1 = ctx['number']; + const key1 = ctx['number']; c_block2[i1] = withKey(component(\`Child\`, {}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -319,13 +319,13 @@ exports[`list of components switch component position 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['clist']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['clist']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`c\`] = v_block2[i1]; - let key1 = ctx['c']; + const key1 = ctx['c']; c_block2[i1] = withKey(component(\`Child\`, {key: ctx['c']}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -355,14 +355,14 @@ exports[`list of components t-foreach with t-component, and update 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2)); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`n\`] = v_block2[i1]; ctx[\`n_index\`] = i1; - let key1 = ctx['n_index']; + const key1 = ctx['n_index']; c_block2[i1] = withKey(component(\`Child\`, {val: ctx['n_index']}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_key.test.ts.snap b/tests/components/__snapshots__/t_key.test.ts.snap index 990a85cf..bbb6a9ff 100644 --- a/tests/components/__snapshots__/t_key.test.ts.snap +++ b/tests/components/__snapshots__/t_key.test.ts.snap @@ -10,14 +10,14 @@ exports[`t-key t-foreach with t-key switch component position 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['clist']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['clist']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`c\`] = v_block2[i1]; - let key1 = ctx['c']; + const key1 = ctx['c']; const tKey_1 = ctx['key1']; c_block2[i1] = withKey(component(\`Child\`, {key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, ctx), tKey_1 + key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -72,7 +72,7 @@ exports[`t-key t-key on Component as a function 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - let b2 = toggler(tKey_1, component(\`Child\`, {key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx)); + const b2 = toggler(tKey_1, component(\`Child\`, {key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx)); return block1([], [b2]); } }" @@ -101,9 +101,9 @@ exports[`t-key t-key on multiple Components 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key1']; - let b2 = toggler(tKey_1, component(\`Child\`, {key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx)); + const b2 = toggler(tKey_1, component(\`Child\`, {key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx)); const tKey_2 = ctx['key2']; - let b3 = toggler(tKey_2, component(\`Child\`, {key: ctx['key2']}, tKey_2 + key + \`__2\`, node, ctx)); + const b3 = toggler(tKey_2, component(\`Child\`, {key: ctx['key2']}, tKey_2 + key + \`__2\`, node, ctx)); return block1([], [b2, b3]); } }" @@ -139,12 +139,12 @@ exports[`t-key t-key on multiple Components with t-call 1 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"key\\", ctx['key1']); - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); ctx = ctx.__proto__; ctx = Object.create(ctx); ctx[isBoundary] = 1; setContextValue(ctx, \\"key\\", ctx['key2']); - let b3 = callTemplate_2.call(this, ctx, node, key + \`__2\`); + const b3 = callTemplate_2.call(this, ctx, node, key + \`__2\`); return block1([], [b2, b3]); } }" @@ -186,7 +186,7 @@ exports[`t-key t-key on multiple Components with t-call 2 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); + const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`); return block1([], [b2]); } }" @@ -199,9 +199,9 @@ exports[`t-key t-key on multiple Components with t-call 2 2`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key1']; - let b2 = toggler(tKey_1, component(\`Child\`, {key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx)); + const b2 = toggler(tKey_1, component(\`Child\`, {key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx)); const tKey_2 = ctx['key2']; - let b3 = toggler(tKey_2, component(\`Child\`, {key: ctx['key2']}, tKey_2 + key + \`__2\`, node, ctx)); + const b3 = toggler(tKey_2, component(\`Child\`, {key: ctx['key2']}, tKey_2 + key + \`__2\`, node, ctx)); return multi([b2, b3]); } }" diff --git a/tests/components/__snapshots__/t_model.test.ts.snap b/tests/components/__snapshots__/t_model.test.ts.snap index af4e6182..48afad5e 100644 --- a/tests/components/__snapshots__/t_model.test.ts.snap +++ b/tests/components/__snapshots__/t_model.test.ts.snap @@ -194,17 +194,17 @@ exports[`t-model directive in a t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`thing\`] = v_block2[i1]; - let key1 = ctx['thing'].id; + const key1 = ctx['thing'].id; const bExpr1 = ctx['thing']; const expr1 = 'f'; let attr1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.checked; }]; c_block2[i1] = withKey(block3([attr1, hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -221,18 +221,18 @@ exports[`t-model directive in a t-foreach, part 2 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`thing\`] = v_block2[i1]; ctx[\`thing_index\`] = i1; - let key1 = ctx['thing_index']; + const key1 = ctx['thing_index']; const bExpr1 = ctx['state']; const expr1 = ctx['thing_index']; let attr1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }]; c_block2[i1] = withKey(block3([attr1, hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -249,18 +249,18 @@ exports[`t-model directive in a t-foreach, part 3 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['names']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['names']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`name\`] = v_block2[i1]; ctx[\`name_index\`] = i1; - let key1 = ctx['name_index']; + const key1 = ctx['name_index']; const bExpr1 = ctx['state'].values; const expr1 = ctx['name']; let attr1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }]; c_block2[i1] = withKey(block3([attr1, hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -460,7 +460,7 @@ exports[`t-model directive t-model with dynamic values on select options -- 2 1` return function template(ctx, node, key = \\"\\") { const bExpr1 = ctx['state']; const expr1 = 'model'; - let bValue1 = bExpr1[expr1] + const bValue1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }]; let attr1 = ctx['options'][0]; let attr2 = bValue1 === ctx['options'][0]; @@ -484,7 +484,7 @@ exports[`t-model directive t-model with dynamic values on select options -- 3 1` return function template(ctx, node, key = \\"\\") { const bExpr1 = ctx['state']; const expr1 = 'model'; - let bValue1 = bExpr1[expr1] + const bValue1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }]; let attr1 = ctx['options'][0]; let attr2 = bValue1 === ctx['options'][0]; @@ -507,7 +507,7 @@ exports[`t-model directive t-model with dynamic values on select options 1`] = ` return function template(ctx, node, key = \\"\\") { const bExpr1 = ctx['state']; const expr1 = 'model'; - let bValue1 = bExpr1[expr1] + const bValue1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }]; let attr1 = ctx['options'][0]; let attr2 = bValue1 === ctx['options'][0]; @@ -532,19 +532,19 @@ exports[`t-model directive t-model with dynamic values on select options in fore return function template(ctx, node, key = \\"\\") { const bExpr1 = ctx['state']; const expr1 = 'model'; - let bValue1 = bExpr1[expr1] + const bValue1 = bExpr1[expr1]; let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }]; ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['options']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['options']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`v\`] = v_block2[i1]; - let key1 = ctx['v']; + const key1 = ctx['v']; let attr1 = ctx['v']; let attr2 = bValue1 === ctx['v']; let txt1 = ctx['v']; c_block2[i1] = withKey(block3([attr1, attr2, txt1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([hdlr1], [b2]); } }" diff --git a/tests/components/__snapshots__/t_on.test.ts.snap b/tests/components/__snapshots__/t_on.test.ts.snap index c2dee374..f359030c 100644 --- a/tests/components/__snapshots__/t_on.test.ts.snap +++ b/tests/components/__snapshots__/t_on.test.ts.snap @@ -14,17 +14,17 @@ exports[`t-on t-on expression captured in t-foreach 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 0); ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['arr']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['arr']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; - let key1 = ctx['val']; + const key1 = ctx['val']; const v1 = ctx['otherState']; const v2 = ctx['iter']; let hdlr1 = [()=>v1.vals.push(v2+'_'+v2), ctx]; setContextValue(ctx, \\"iter\\", ctx['iter']+1); c_block2[i1] = withKey(block3([hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -41,11 +41,11 @@ exports[`t-on t-on expression in t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; ctx[\`val_index\`] = i1; - let key1 = ctx['val']; + const key1 = ctx['val']; let txt1 = ctx['val_index']; let txt2 = ctx['val']+''; const v1 = ctx['otherState']; @@ -53,7 +53,7 @@ exports[`t-on t-on expression in t-foreach 1`] = ` let hdlr1 = [()=>v1.vals.push(v2), ctx]; c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -73,11 +73,11 @@ exports[`t-on t-on expression in t-foreach with t-set 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"bossa\\", 'nova'); ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; ctx[\`val_index\`] = i1; - let key1 = ctx['val']; + const key1 = ctx['val']; setContextValue(ctx, \\"bossa\\", ctx['bossa']+'_'+ctx['val_index']); let txt1 = ctx['val_index']; let txt2 = ctx['val']+''; @@ -87,7 +87,7 @@ exports[`t-on t-on expression in t-foreach with t-set 1`] = ` let hdlr1 = [()=>v1.vals.push(v2+'_'+v3), ctx]; c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -104,18 +104,18 @@ exports[`t-on t-on method call in t-foreach 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`val\`] = v_block2[i1]; ctx[\`val_index\`] = i1; - let key1 = ctx['val']; + const key1 = ctx['val']; let txt1 = ctx['val_index']; let txt2 = ctx['val']+''; const v1 = ctx['val']; let hdlr1 = [()=>this.addVal(v1), ctx]; c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -129,7 +129,7 @@ exports[`t-on t-on on components 1`] = ` const catcher1 = createCatcher({\\"click\\":0}); return function template(ctx, node, key = \\"\\") { - let hdlr1 = [ctx['increment'], ctx]; + const hdlr1 = [ctx['increment'], ctx]; return catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]); } }" @@ -159,8 +159,8 @@ exports[`t-on t-on on components, variation 1`] = ` let block1 = createBlock(\`

    \`); return function template(ctx, node, key = \\"\\") { - let hdlr1 = [ctx['increment'], ctx]; - let b2 = catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]); + const hdlr1 = [ctx['increment'], ctx]; + const b2 = catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_props.test.ts.snap b/tests/components/__snapshots__/t_props.test.ts.snap index c588fe42..c638645c 100644 --- a/tests/components/__snapshots__/t_props.test.ts.snap +++ b/tests/components/__snapshots__/t_props.test.ts.snap @@ -8,7 +8,7 @@ exports[`t-props basic use 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, Object.assign({}, ctx['some'].obj), key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, Object.assign({}, ctx['some'].obj), key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -60,7 +60,7 @@ exports[`t-props t-props and other props 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Comp\`, Object.assign({}, ctx['state1'], {a: ctx['a']}), key + \`__1\`, node, ctx); + const b2 = component(\`Comp\`, Object.assign({}, ctx['state1'], {a: ctx['a']}), key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -89,7 +89,7 @@ exports[`t-props t-props only 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Comp\`, Object.assign({}, ctx['state']), key + \`__1\`, node, ctx); + const b2 = component(\`Comp\`, Object.assign({}, ctx['state']), key + \`__1\`, node, ctx); return block1([], [b2]); } }" @@ -117,7 +117,7 @@ exports[`t-props t-props with props 1`] = ` let block1 = createBlock(\`
    \`); return function template(ctx, node, key = \\"\\") { - let b2 = component(\`Child\`, Object.assign({}, ctx['childProps'], {a: 1, b: 2}), key + \`__1\`, node, ctx); + const b2 = component(\`Child\`, Object.assign({}, ctx['childProps'], {a: 1, b: 2}), key + \`__1\`, node, ctx); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_set.test.ts.snap b/tests/components/__snapshots__/t_set.test.ts.snap index 3f84d47a..ba3ebf35 100644 --- a/tests/components/__snapshots__/t_set.test.ts.snap +++ b/tests/components/__snapshots__/t_set.test.ts.snap @@ -21,7 +21,7 @@ exports[`t-set slot setted value (with t-set) not accessible with t-esc 1`] = ` setContextValue(ctx, \\"iter\\", 'source'); let txt1 = ctx['iter']; const ctx1 = capture(ctx); - let b2 = component(\`Childcomp\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); + const b2 = component(\`Childcomp\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx); let txt2 = ctx['iter']; return block1([txt1, txt2], [b2]); } @@ -57,8 +57,8 @@ exports[`t-set slots with a t-set with a component in body 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx[\`v\`] = new LazyValue(value1, ctx, node); - let b3 = text(\` in slot \`); - let b4 = safeOutput(ctx['v']); + const b3 = text(\` in slot \`); + const b4 = safeOutput(ctx['v']); return multi([b3, b4]); } @@ -80,8 +80,8 @@ exports[`t-set slots with a t-set with a component in body 2`] = ` let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`Child \`); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = text(\`Child \`); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } }" @@ -110,14 +110,14 @@ exports[`t-set slots with an t-set with a component in body 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx[\`v\`] = new LazyValue(value1, ctx, node); - let b5 = text(\` tea \`); - let b6 = safeOutput(ctx['v']); + const b5 = text(\` tea \`); + const b6 = safeOutput(ctx['v']); return multi([b5, b6]); } function value1(ctx, node, key = \\"\\") { - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); - let b4 = block4(); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b4 = block4(); return multi([b3, b4]); } @@ -135,8 +135,8 @@ exports[`t-set slots with an t-set with a component in body 2`] = ` let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`Blorg \`); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = text(\`Blorg \`); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } }" @@ -184,8 +184,8 @@ exports[`t-set slots with an unused t-set with a component in body 2`] = ` let { callSlot } = helpers; return function template(ctx, node, key = \\"\\") { - let b2 = text(\`Child \`); - let b3 = callSlot(ctx, node, key, 'default', false, {}); + const b2 = text(\`Child \`); + const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } }" @@ -267,7 +267,7 @@ exports[`t-set t-set not altered by child comp 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 'source'); let txt1 = ctx['iter']; - let b2 = component(\`Childcomp\`, {}, key + \`__1\`, node, ctx); + const b2 = component(\`Childcomp\`, {}, key + \`__1\`, node, ctx); let txt2 = ctx['iter']; return block1([txt1, txt2], [b2]); } @@ -335,7 +335,7 @@ exports[`t-set t-set with a component in body 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx[\`v\`] = new LazyValue(value1, ctx, node); - let b3 = safeOutput(ctx['v']); + const b3 = safeOutput(ctx['v']); return block1([], [b3]); } }" @@ -369,7 +369,7 @@ exports[`t-set t-set with something in body 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 ctx[\`v\`] = new LazyValue(value1, ctx, node); - let b3 = safeOutput(ctx['v']); + const b3 = safeOutput(ctx['v']); return block1([], [b3]); } }" diff --git a/tests/misc/__snapshots__/portal.test.ts.snap b/tests/misc/__snapshots__/portal.test.ts.snap index 4e3e798a..e999c9fe 100644 --- a/tests/misc/__snapshots__/portal.test.ts.snap +++ b/tests/misc/__snapshots__/portal.test.ts.snap @@ -7,18 +7,18 @@ exports[`Portal Add and remove portals 1`] = ` let { prepareList, Portal, capture, withKey } = helpers; function slot1(ctx, node, key = \\"\\") { - let b3 = text(\` Portal\`); - let b4 = text(ctx['portalId']); + const b3 = text(\` Portal\`); + const b4 = text(ctx['portalId']); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`portalId\`] = v_block1[i1]; - let key1 = ctx['portalId']; - const ctx1 = capture(ctx); + const key1 = ctx['portalId']; + const ctx1 = capture(ctx);; c_block1[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1); @@ -41,11 +41,11 @@ exports[`Portal Add and remove portals on div 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`portalId\`] = v_block1[i1]; - let key1 = ctx['portalId']; - const ctx1 = capture(ctx); + const key1 = ctx['portalId']; + const ctx1 = capture(ctx);; c_block1[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1); @@ -62,20 +62,20 @@ exports[`Portal Add and remove portals with t-foreach 1`] = ` let block2 = createBlock(\`
    \`); function slot1(ctx, node, key = \\"\\") { - let b4 = text(\` Portal\`); - let b5 = text(ctx['portalId']); + const b4 = text(\` Portal\`); + const b5 = text(ctx['portalId']); return multi([b4, b5]); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`portalId\`] = v_block1[i1]; - let key1 = ctx['portalId']; + const key1 = ctx['portalId']; let txt1 = ctx['portalId']; - const ctx1 = capture(ctx); - let b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); + const ctx1 = capture(ctx);; + const b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); c_block1[i1] = withKey(block2([txt1], [b6]), key1); } return list(c_block1); @@ -92,20 +92,20 @@ exports[`Portal Add and remove portals with t-foreach and destroy 1`] = ` let block2 = createBlock(\`
    \`); function slot1(ctx, node, key = \\"\\") { - let b4 = text(\` Portal\`); - let b5 = text(ctx['portalId']); + const b4 = text(\` Portal\`); + const b5 = text(ctx['portalId']); return multi([b4, b5]); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']); + const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);; for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`portalId\`] = v_block1[i1]; - let key1 = ctx['portalId']; + const key1 = ctx['portalId']; let txt1 = ctx['portalId']; - const ctx1 = capture(ctx); - let b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); + const ctx1 = capture(ctx);; + const b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); c_block1[i1] = withKey(block2([txt1], [b6]), key1); } return list(c_block1); @@ -123,23 +123,23 @@ exports[`Portal Add and remove portals with t-foreach inside div 1`] = ` let block3 = createBlock(\`
    \`); function slot1(ctx, node, key = \\"\\") { - let b5 = text(\` Portal\`); - let b6 = text(ctx['portalId']); + const b5 = text(\` Portal\`); + const b6 = text(ctx['portalId']); return multi([b5, b6]); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['portalIds']); + const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['portalIds']);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`portalId\`] = v_block2[i1]; - let key1 = ctx['portalId']; + const key1 = ctx['portalId']; let txt1 = ctx['portalId']; - const ctx1 = capture(ctx); - let b7 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); + const ctx1 = capture(ctx);; + const b7 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([txt1], [b7]), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -158,7 +158,7 @@ exports[`Portal Portal composed with t-slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); + const b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -208,7 +208,7 @@ exports[`Portal basic use of portal 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -228,7 +228,7 @@ exports[`Portal basic use of portal in dev mode 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -248,7 +248,7 @@ exports[`Portal basic use of portal on div 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -345,14 +345,14 @@ exports[`Portal conditional use of Portal with child and div 2`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); - const [k_block2, v_block2, l_block2, c_block2] = prepareList([1]); + const [k_block2, v_block2, l_block2, c_block2] = prepareList([1]);; for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`elem\`] = v_block2[i1]; - let key1 = ctx['elem']; - const ctx1 = capture(ctx); + const key1 = ctx['elem']; + const ctx1 = capture(ctx);; c_block2[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b2 = list(c_block2); + const b2 = list(c_block2); return block1([], [b2]); } }" @@ -368,7 +368,7 @@ exports[`Portal conditional use of Portal with child and div, variation 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasPortal) { - let b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); + const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx); b2 = block2([], [b3]); } return multi([b2]); @@ -390,16 +390,16 @@ exports[`Portal conditional use of Portal with child and div, variation 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b2 = block2(); + const b2 = block2(); ctx = Object.create(ctx); - const [k_block3, v_block3, l_block3, c_block3] = prepareList([1]); + const [k_block3, v_block3, l_block3, c_block3] = prepareList([1]);; for (let i1 = 0; i1 < l_block3; i1++) { ctx[\`elem\`] = v_block3[i1]; - let key1 = ctx['elem']; - const ctx1 = capture(ctx); + const key1 = ctx['elem']; + const ctx1 = capture(ctx);; c_block3[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } - let b3 = list(c_block3); + const b3 = list(c_block3); return multi([b2, b3]); } }" @@ -421,7 +421,7 @@ exports[`Portal conditional use of Portal with div 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasPortal) { - let b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); b2 = block2([], [b4]); } return multi([b2]); @@ -484,7 +484,7 @@ exports[`Portal portal could have dynamically no content 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b4]); } }" @@ -503,7 +503,7 @@ exports[`Portal portal destroys on crash 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -536,7 +536,7 @@ exports[`Portal portal with child and props 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -578,7 +578,7 @@ exports[`Portal portal with dynamic body 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b5 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b5 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b5]); } }" @@ -595,13 +595,13 @@ exports[`Portal portal with many children 1`] = ` let block4 = createBlock(\`

    2

    \`); function slot1(ctx, node, key = \\"\\") { - let b3 = block3(); - let b4 = block4(); + const b3 = block3(); + const b4 = block4(); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { - let b5 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b5 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b5]); } }" @@ -624,7 +624,7 @@ exports[`Portal portal with no content 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b4]); } }" @@ -643,7 +643,7 @@ exports[`Portal portal with only text as content 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -663,7 +663,7 @@ exports[`Portal portal with target not in dom 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#does-not-exist',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#does-not-exist',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -682,7 +682,7 @@ exports[`Portal portal's parent's env is not polluted 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); return block1([], [b3]); } }" @@ -735,7 +735,7 @@ exports[`Portal simple catchError with portal 2`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -755,7 +755,7 @@ exports[`Portal with target in template (after portal) 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -775,7 +775,7 @@ exports[`Portal with target in template (before portal) 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -795,7 +795,7 @@ exports[`Portal: Props validation target must be a valid selector 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: ' ',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: ' ',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -815,7 +815,7 @@ exports[`Portal: Props validation target must be a valid selector 2 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: 'aa',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); + const b3 = component(Portal, {target: 'aa',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx); return block1([], [b3]); } }" @@ -834,7 +834,7 @@ exports[`Portal: UI/UX focus is kept across re-renders 1`] = ` } return function template(ctx, node, key = \\"\\") { - let b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); + const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx); return block1([], [b3]); } }"