コード例 #1
0
    test('run once per test run', async function(assert) {
      let initializerCallCount = 0;
      isolatedApp.initializer({
        name: 'foo',
        initialize() {
          initializerCallCount += 1;
        },
      });

      await teardownContext(await setupContext({}));
      assert.equal(initializerCallCount, 1);

      await teardownContext(await setupContext({}));
      assert.equal(initializerCallCount, 1);
    });
コード例 #2
0
  hooks.afterEach(async function() {
    if (context.owner) {
      await teardownContext(context);
    }

    document.getElementById('ember-testing').innerHTML = '';
  });
コード例 #3
0
  hooks.afterEach(async function() {
    if (context) {
      await teardownContext(context);
      context = undefined;
    }

    setApplication(application);
    setResolver(resolver);
  });
コード例 #4
0
 hooks.afterEach(async function() {
   if (elementWithFocus) {
     elementWithFocus.parentNode.removeChild(elementWithFocus);
   }
   // only teardown if setupContext was called
   if (context.owner) {
     await teardownContext(context);
   }
   document.getElementById('ember-testing').innerHTML = '';
 });
コード例 #5
0
  hooks.afterEach(async function() {
    if (element.parentNode) {
      element.parentNode.removeChild(element);
    }
    if (context.owner) {
      await teardownContext(context);
    }

    document.getElementById('ember-testing').innerHTML = '';
  });
コード例 #6
0
  hooks.afterEach(async function() {
    element.setAttribute('data-skip-steps', true);

    if (element) {
      element.parentNode.removeChild(element);
    }
    if (context.owner) {
      await teardownContext(context);
    }

    document.getElementById('ember-testing').innerHTML = '';
  });
コード例 #7
0
    test('changes to the DOM persist across multiple setupContext() calls', async function(assert) {
      function rootEl() {
        return document.querySelector(isolatedApp.rootElement);
      }

      isolatedApp.initializer({
        name: 'foo',
        initialize() {
          let initializerDiv = document.createElement('div');
          initializerDiv.id = 'initializer';
          rootEl().appendChild(initializerDiv);
        },
      });

      try {
        let context = await setupContext({});
        try {
          assert.ok(rootEl().lastChild);
          assert.equal(rootEl().lastChild.id, 'initializer');
        } finally {
          await teardownContext(context);
        }

        context = await setupContext({});
        try {
          assert.ok(rootEl().lastChild);
          assert.equal(rootEl().lastChild.id, 'initializer');
        } finally {
          await teardownContext(context);
        }
      } finally {
        // Don't leave #ember-testing polluted for other tests
        if (rootEl().lastChild) {
          rootEl().lastChild.remove();
        }
      }
    });
コード例 #8
0
 hooks.afterEach(async function() {
   await teardownApplicationContext(this);
   await teardownContext(this);
 });