Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[
[
TargetedInstructionType.callBinding,
TargetedInstructionType.hydrateAttribute,
TargetedInstructionType.hydrateElement,
TargetedInstructionType.hydrateLetElement,
TargetedInstructionType.hydrateTemplateController,
TargetedInstructionType.interpolation,
TargetedInstructionType.iteratorBinding,
TargetedInstructionType.letBinding,
TargetedInstructionType.propertyBinding,
TargetedInstructionType.refBinding,
TargetedInstructionType.setProperty,
HTMLTargetedInstructionType.listenerBinding,
HTMLTargetedInstructionType.setAttribute,
HTMLTargetedInstructionType.stylePropertyBinding,
HTMLTargetedInstructionType.textBinding
]
],
t => {
it(`understands targeted instruction type=${t}`, function () {
const ctx = TestContext.createHTMLTestContext();
//@ts-ignore
const actual = sut(ctx.dom, tag, { prop: { type: t }});
const instruction = actual['instructions'][0][0] as TargetedInstruction;
const node = actual['node'] as Element;
assert.strictEqual(actual['instructions'].length, 1, `actual['instructions'].length`);
assert.strictEqual(actual['instructions'][0].length, 1, `actual['instructions'][0].length`);
assert.strictEqual(instruction.type, t, `instruction.type`);
assert.strictEqual(node.getAttribute('class'), 'au', `node.getAttribute('class')`);
switch (type) {
case HTMLTargetedInstructionType.textBinding:
return 'textBinding';
case TargetedInstructionType.interpolation:
return 'interpolation';
case TargetedInstructionType.propertyBinding:
return 'propertyBinding';
case TargetedInstructionType.iteratorBinding:
return 'iteratorBinding';
case HTMLTargetedInstructionType.listenerBinding:
return 'listenerBinding';
case TargetedInstructionType.callBinding:
return 'callBinding';
case TargetedInstructionType.refBinding:
return 'refBinding';
case HTMLTargetedInstructionType.stylePropertyBinding:
return 'stylePropertyBinding';
case TargetedInstructionType.setProperty:
return 'setProperty';
case HTMLTargetedInstructionType.setAttribute:
return 'setAttribute';
case TargetedInstructionType.hydrateElement:
return 'hydrateElement';
case TargetedInstructionType.hydrateAttribute:
return 'hydrateAttribute';
case TargetedInstructionType.hydrateTemplateController:
return 'hydrateTemplateController';
case TargetedInstructionType.hydrateLetElement:
return 'hydrateLetElement';
case TargetedInstructionType.letBinding:
return 'letBinding';
default:
case TargetedInstructionType.callBinding:
output += 'callBinding\n';
break;
case TargetedInstructionType.iteratorBinding:
output += 'iteratorBinding\n';
break;
case HTMLTargetedInstructionType.listenerBinding:
output += 'listenerBinding\n';
break;
case TargetedInstructionType.propertyBinding:
output += 'propertyBinding\n';
break;
case TargetedInstructionType.refBinding:
output += 'refBinding\n';
break;
case HTMLTargetedInstructionType.stylePropertyBinding:
output += 'stylePropertyBinding\n';
break;
case TargetedInstructionType.setProperty:
output += 'setProperty\n';
break;
case HTMLTargetedInstructionType.setAttribute:
output += 'setAttribute\n';
break;
case TargetedInstructionType.interpolation:
output += 'interpolation\n';
break;
case TargetedInstructionType.hydrateLetElement:
output += 'hydrateLetElement\n';
instruction.instructions.forEach(i => {
output += stringifyInstructions(i, depth + 1);
});
case TargetedInstructionType.callBinding:
output += 'callBinding\n';
break;
case TargetedInstructionType.iteratorBinding:
output += 'iteratorBinding\n';
break;
case HTMLTargetedInstructionType.listenerBinding:
output += 'listenerBinding\n';
break;
case TargetedInstructionType.propertyBinding:
output += 'propertyBinding\n';
break;
case TargetedInstructionType.refBinding:
output += 'refBinding\n';
break;
case HTMLTargetedInstructionType.stylePropertyBinding:
output += 'stylePropertyBinding\n';
break;
case TargetedInstructionType.setProperty:
output += 'setProperty\n';
break;
case HTMLTargetedInstructionType.setAttribute:
output += 'setAttribute\n';
break;
case TargetedInstructionType.interpolation:
output += 'interpolation\n';
break;
case TargetedInstructionType.hydrateLetElement:
output += 'hydrateLetElement\n';
instruction.instructions.forEach(i => {
output += stringifyInstructions(i, depth + 1);
});