How to use the @aurelia/testing.setup 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__ / 5-jit-html / custom-attributes.spec.ts View on Github external
it('does not invoke change handler when starts with two-way usage', async function () {
        const template = `<div></div>`;
        const options = setup(
          template,
          class {
            public prop: string = 'prop';
          },
          [Foo1]
        );

        const fooEl = options.appHost.querySelector('div') as INode;
        const foo1Vm = CustomAttribute.for(fooEl, 'foo1').viewModel as Foo1;

        assert.strictEqual(foo1Vm.propChangedCallCount, 0, `#1 Foo1 count`);
        assert.strictEqual(foo1Vm.propertyChangedCallCount, 0, `#2 Foo1 count`);
        assert.strictEqual(foo1Vm.prop, `prop`);

        const rootVm = options.au.root.viewModel;
        // changing source value should trigger the change handler
github aurelia / aurelia / packages / __tests__ / 5-jit-html / binding-behaviors.spec.ts View on Github external
it('Simple Alias (1st position) works on binding behavior', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt1');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / value-converters.spec.ts View on Github external
it('Simple Alias (2nd position) works on value converter', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt1');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / custom-attributes.spec.ts View on Github external
it('Simple spread Alias (2nd position) works on custom attribute', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / binding-commands.spec.ts View on Github external
it('Simple Alias (2nd position) works on binding command', async function () {
      const options = setup('<template> <a></a> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('href'), 'wOOt');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / value-converters.spec.ts View on Github external
it('Simple Alias (1st position) works on value converter', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt1');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / custom-attributes.spec.ts View on Github external
it('2 aliases and attribute alias original works', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / custom-attributes.spec.ts View on Github external
it('Simple Alias doesn\'t break original custom attribute', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / value-converters.spec.ts View on Github external
it('Simple spread Alias (1st position) works on value converter', async function () {
      const options = setup('<template> <div></div> </template>', app, resources);
      assert.strictEqual(options.appHost.firstElementChild.getAttribute('test'), 'wOOt1');
      await options.tearDown();
    });
github aurelia / aurelia / packages / __tests__ / 5-jit-html / custom-attributes.spec.ts View on Github external
function setupChangeHandlerTest(template: string) {
      const options = setup(template, class {}, [Foo]);
      const fooEl = options.appHost.querySelector('div') as INode;
      const fooVm = CustomAttribute.for(fooEl, 'foo').viewModel as Foo;
      return {
        fooVm: fooVm,
        tearDown: () => options.tearDown()
      };
    }
  });