Sha256: 501702d3272fbabf0494396b42845e282a262acbffedc3912b846beb983c4083

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

import { set } from 'ember-metal';
import { Component } from '../../utils/helpers';
import { moduleFor, RenderingTest } from '../../utils/test-case';

moduleFor(
  'Component destroy',
  class extends RenderingTest {
    ['@test it correctly releases the destroyed components'](assert) {
      let FooBarComponent = Component.extend({});

      this.registerComponent('foo-bar', {
        ComponentClass: FooBarComponent,
        template: 'hello',
      });

      this.render('{{#if switch}}{{#foo-bar}}{{foo-bar}}{{/foo-bar}}{{/if}}', {
        switch: true,
      });

      this.assertComponentElement(this.firstChild, { content: 'hello' });

      this.runTask(() => set(this.context, 'switch', false));

      this.assertText('');

      assert.equal(
        this.env.destroyedComponents.length,
        0,
        'environment.destroyedComponents should be empty'
      );
    }
  }
);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-glimmer/tests/integration/components/destroy-test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-glimmer/tests/integration/components/destroy-test.js