How to use the @aurelia/runtime.LifecycleFlags.none function in @aurelia/runtime

To help you get started, we’ve selected a few @aurelia/runtime 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__ / runtime / custom-element.$bind.spec.ts View on Github external
it(`${psSpec.expectation} if ${psSpec.description} AND ${hooksSpec.expectation} if ${hooksSpec.description} AND ${flagsSpec.expectation} if ${flagsSpec.description}`, function () {
        // Arrange
        const { sut } = createCustomElement('foo');
        psSpec.setProps(sut);
        sut.$scope = Scope.create(LF.none, sut, null);
        sut.$bindingHead = sut.$bindingTail = null;
        sut.$componentHead = sut.$componentTail = null;
        sut.$componentHead = sut.$componentTail = null;
        sut.$hooks = hooksSpec.getHooks();
        const expectedFlags = flagsSpec.getExpectedFlags();
        const flags = flagsSpec.getFlags();

        // Act
        sut.$unbind(flags);

        // Assert
        if (psSpec.callsBehaviors) {
          hooksSpec.verifyBehaviorInvocation(sut, expectedFlags);
        } else {
          sut.verifyNoFurtherCalls();
        }
github aurelia / aurelia / packages / __tests__ / 2-runtime / controller.spec.ts View on Github external
// ce #1 controller
          .addCall(2, 'bound', LF.fromBind)

          // ce #1
          .addCall(1, 'bound', LF.fromBind),
        '2',
      );

      sut.attach(flags);

      assert.deepStrictEqual(
        calls,
        expectedCalls
          // ce #1 controller
          .addCall(2, 'attach', LF.none)
          .addCall(2, 'attachCustomElement', LF.fromAttach)

          // ce #1
          .addCall(1, 'attaching', LF.fromAttach)

          // ce #1 controller
          .addCall(2, 'attachControllers', LF.fromAttach)

          // if #1 controller
          .addCall(4, 'attach', LF.fromAttach)
          .addCall(4, 'attachCustomAttribute', LF.fromAttach)

          // if #1
          .addCall(3, 'attaching', LF.fromAttach)
          .addCall(3, 'attachView', LF.fromAttach)
github aurelia / aurelia / packages / validation / src / implementation / standard-validator.ts View on Github external
}
    const overrideContext = {
      ...OverrideContext.create(LF.none, object, null),
      $displayName: displayName,
      $propertyName: propertyName,
      $value: value,
      $object: object,
      $config: rule.config,
      // returns the name of a given property, given just the property name (irrespective of the property's displayName)
      // split on capital letters, first letter ensured to be capitalized
      $getDisplayName: this.getDisplayName
    };
    return expression.evaluate(
      LF.none,
      // TODO: fix these types in the runtime so this silly cast is not needed
      Scope.create(LF.none, object, overrideContext as unknown as IOverrideContext),
      this.locator
    ) as string;
  }
github aurelia / aurelia / packages / __tests__ / jit-html / if-else.spec.ts View on Github external
it('01.', function () {
    const { au, lifecycle, host, component } = setupAndStart(ctx, `<template><div>bar</div></template>`, null);
    component.foo = true;
    lifecycle.processFlushQueue(LifecycleFlags.none);
    expect(host.textContent).to.equal('bar');
    component.foo = false;
    lifecycle.processFlushQueue(LifecycleFlags.none);
    expect(host.textContent).to.equal('');
    tearDown(au, lifecycle, host);
  });
github aurelia / aurelia / packages / __tests__ / 3-runtime-html / observer-locator.spec.ts View on Github external
it(_`getObserver() - Map.foo - returns MapObserver`, function () {
    const { sut } = setup();
    const obj = new Map();
    const actual = sut.getObserver(LF.none, obj, 'foo');
    assert.strictEqual(actual.constructor.name, DirtyCheckProperty.name, `actual.constructor.name`);
    assert.instanceOf(actual, DirtyCheckProperty, `actual`);
  });
github aurelia / aurelia / packages / __tests__ / runtime-html / select-value-observer.spec.ts View on Github external
function createFixture(initialValue: Anything = '', options = [], multiple = false) {
    const ctx = TestContext.createHTMLTestContext();
    const { dom, lifecycle, observerLocator } = ctx;

    const optionElements = options.map(o =&gt; `<option value="${o}">${o}</option>`).join('\n');
    const markup = `<select>\n${optionElements}\n</select>`;
    const el = ctx.createElementFromMarkup(markup) as HTMLSelectElement;
    const sut = observerLocator.getObserver(LF.none, el, 'value') as SelectValueObserver;
    sut.setValue(initialValue, LF.fromBind);

    return { ctx, lifecycle, el, sut, dom };
  }
github aurelia / aurelia / packages / __tests__ / runtime / au-dom.spec.ts View on Github external
);

    class App {
      public items = ['1', '2', '3'];
    }
    CustomElementResource.define(definition, App);
    const component = new App();

    au.app({ host, component });
    au.start();

    expect(host.textContent).to.equal('123');

    component.items.splice(1, 1, '5', '6', '7');

    lifecycle.processFlushQueue(LifecycleFlags.none);

    expect(host.textContent).to.equal('15673');

    component.items.pop();

    lifecycle.processFlushQueue(LifecycleFlags.none);

    expect(host.textContent).to.equal('1567');

  });
});
github aurelia / aurelia / packages / testing / src / test-builder.ts View on Github external
export function createScopeForTest(bindingContext: any = {}, parentBindingContext?: any): IScope {
  if (parentBindingContext) {
    return Scope.create(LF.none, bindingContext, OverrideContext.create(LF.none, bindingContext, OverrideContext.create(LF.none, parentBindingContext, null)));
  }
  return Scope.create(LF.none, bindingContext, OverrideContext.create(LF.none, bindingContext, null));
}
github aurelia / aurelia / packages / __tests__ / runtime-html / compose.spec.ts View on Github external
function runAttachLifecycle(ctx: HTMLTestContext, item: IComponent) {
    ctx.lifecycle.beginAttach();
    item.$attach(LifecycleFlags.none);
    ctx.lifecycle.endAttach(LifecycleFlags.none);
  }
github aurelia / aurelia / packages / __tests__ / 3-runtime-html / array-index-observer.spec.ts View on Github external
function createFixture() {
    const ctx = TestContext.createHTMLTestContext();
    const { container, lifecycle, observerLocator, scheduler } = ctx;
    const el = ctx.createElementFromMarkup(`<input>`) as IInputElement;
    ctx.doc.body.appendChild(el);

    const sut = ctx.observerLocator.getObserver(LifecycleFlags.none, el, 'value') as ValueAttributeObserver;
    ctx.observerLocator.getObserver(LifecycleFlags.none, el, 'value');

    return { ctx, container, lifecycle, observerLocator, el, sut, scheduler };
  }
});