How to use the @aurelia/testing.h function in @aurelia/testing

To help you get started, we’ve selected a few @aurelia/testing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
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' }),
github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
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', [])],
github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
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);
github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
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' }),
                [],
                [
                  [
github aurelia / aurelia / packages / __tests__ / runtime-html / select-value-observer.spec.ts View on Github external
return function(ctx: HTMLTestContext) {
      return h('option', attributes);
    };
  }
github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
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,
github aurelia / aurelia / packages / __tests__ / runtime-html / select-value-observer.spec.ts View on Github external
return function(ctx: HTMLTestContext) {
          return h(
            'select',
            { multiple: true },
            ...options
          );
        };
      }
github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
'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);