Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(`correctly executes 1-1 CustomElement+if lifecycles`, function () {
const {
lifecycle,
scheduler,
container,
host,
calls,
} = setup();
const flags = LF.none;
const ViewModel = createViewModel(
h(
'div',
null,
h('au-m', { class: 'au' }),
'',
h('au-m', { class: 'au' }),
),
[],
[
[
new TextBindingInstruction(parseExpression(`\${id&oneTime}`, BindingType.Interpolation)),
],
[
new HydrateTemplateController(
createDescription(
'if',
h('view-model', { class: 'au' }),
it(`correctly executes 1-1 CustomElement+if lifecycles`, function () {
const {
lifecycle,
scheduler,
container,
host,
calls,
} = setup();
const flags = LF.none;
const ViewModel = createViewModel(
h(
'div',
null,
h('au-m', { class: 'au' }),
'',
h('au-m', { class: 'au' }),
),
[],
[
[
new TextBindingInstruction(parseExpression(`\${id&oneTime}`, BindingType.Interpolation)),
],
[
new HydrateTemplateController(
createDescription(
'if',
h('view-model', { class: 'au' }),
[],
[
[new HydrateElementInstruction('view-model', [])],
it(`correctly executes 1 CustomElement lifecycles`, function () {
const {
lifecycle,
scheduler,
container,
host,
calls,
} = setup();
const flags = LF.none;
const ViewModel = createViewModel(
h(
'div',
null,
h('au-m', { class: 'au' }),
'',
),
[],
[
[
new TextBindingInstruction(
new Interpolation(['', ''], [new BindingBehaviorExpression(new AccessScopeExpression('id'), 'oneTime', PLATFORM.emptyArray)])
),
],
],
);
const viewModel = container.get(ViewModel);
lifecycle,
scheduler,
container,
host,
calls,
} = setup();
const flags = LF.none;
const ViewModel = createViewModel(
h(
'div',
null,
h('au-m', { class: 'au' }),
'',
h('au-m', { class: 'au' }),
),
[
'msg',
],
[
[
new TextBindingInstruction(parseExpression(`\${msg}`, BindingType.Interpolation)),
],
[
new HydrateTemplateController(
createDescription(
'if',
h('view-model', { class: 'au' }),
[],
[
[
return function(ctx: HTMLTestContext) {
return h('option', attributes);
};
}
function setup() {
resetId('au$component');
const ctx = TestContext.createHTMLTestContext();
const { container, lifecycle, dom, scheduler } = ctx;
const templateFactory = container.get(ITemplateFactory);
const renderContext = new RenderContext(dom, container, null);
const $loc = h('div');
const host = h('div', null, $loc);
const loc = dom.convertToRenderLocation($loc);
const calls = container.get(CallCollection);
recordCalls(Controller, calls);
recordCalls(If, calls);
return {
ctx,
calls,
container,
scheduler,
lifecycle,
dom,
templateFactory,
renderContext,
host,
return function(ctx: HTMLTestContext) {
return h(
'select',
{ multiple: true },
...options
);
};
}
'div',
null,
h('au-m', { class: 'au' }),
'',
h('au-m', { class: 'au' }),
),
[],
[
[
new TextBindingInstruction(parseExpression(`\${id&oneTime}`, BindingType.Interpolation)),
],
[
new HydrateTemplateController(
createDescription(
'if',
h('view-model', { class: 'au' }),
[],
[
[new HydrateElementInstruction('view-model', [])],
],
noHooks,
),
'if',
[new ToViewBindingInstruction(parseExpression('id===1&oneTime'), 'value')],
),
],
],
);
const viewModel = container.get(ViewModel);
const sut = Controller.forCustomElement(viewModel, container, host);