Sha256: f8484d103fa1445979e2701bd5378331cdcaf663f984c6842d68920de7b6faa7

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

import { OutletView } from 'ember-glimmer';
import { run, schedule } from '@ember/runloop';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'Glimmer OutletView',
  class extends AbstractTestCase {
    ['@test render in the render queue'](assert) {
      let didAppendOutletView = 0;
      let expectedOutlet = '#foo.bar';

      let renderer = {
        appendOutletView(view, target) {
          didAppendOutletView++;
          assert.equal(view, outletView);
          assert.equal(target, expectedOutlet);
        },
      };

      let outletView = new OutletView({}, renderer);

      run(() => {
        assert.equal(
          didAppendOutletView,
          0,
          'appendOutletView should not yet have been called (before appendTo)'
        );
        outletView.appendTo(expectedOutlet);
        assert.equal(
          didAppendOutletView,
          0,
          'appendOutletView should not yet have been called (sync after appendTo)'
        );

        schedule('actions', () =>
          assert.equal(
            didAppendOutletView,
            0,
            'appendOutletView should not yet have been called (in actions)'
          )
        );
        schedule('render', () =>
          assert.equal(didAppendOutletView, 1, 'appendOutletView should be invoked in render')
        );
      });
    }
  }
);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-glimmer/tests/unit/outlet-test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-glimmer/tests/unit/outlet-test.js