Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('instantiated with instruction type', function () {
const container = setup();
const sut: IInstructionRenderer = new TranslationBindBindingRenderer(container.get(IExpressionParser), {} as unknown as IObserverLocator);
assert.equal(sut.instructionType, TranslationBindInstructionType);
});
it('#render adds expr to the existing TranslationBinding for the target element', function () {
const container = setup();
const sut: IInstructionRenderer = new TranslationBindBindingRenderer(container.get(IExpressionParser), {} as unknown as IObserverLocator);
const expressionParser = container.get(IExpressionParser);
const targetElement = DOM.createElement('span');
const binding = new TranslationBinding(targetElement, {} as unknown as IObserverLocator, container);
const renderable = ({ bindings: [binding] } as unknown as IController);
const from = expressionParser.parse('simple.key', BindingType.BindCommand);
const callBindingInstruction: ICallBindingInstruction = { from, to: '.bind' } as unknown as ICallBindingInstruction;
sut.render(
LifecycleFlags.none,
DOM,
container as unknown as IRenderContext,
renderable,
targetElement,
callBindingInstruction);
assert.equal(binding.expr, from);