Sha256: 7df81469299e760d91afe13548d08298a6390084f39833005bb83941b4242f29

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

import { set } from '@ember/-internals/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

1 entries across 1 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/glimmer/tests/integration/components/destroy-test.js