Sha256: a0ce2827d55908d610d86a27fcd04c21361ddd384baae088b884567f022ce739

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

import { Mixin } from '../..';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'Mixin.detect',
  class extends AbstractTestCase {
    ['@test detect() finds a directly applied mixin'](assert) {
      let MixinA = Mixin.create();
      let obj = {};

      assert.equal(MixinA.detect(obj), false, 'MixinA.detect(obj) before apply()');

      MixinA.apply(obj);
      assert.equal(MixinA.detect(obj), true, 'MixinA.detect(obj) after apply()');
    }

    ['@test detect() finds nested mixins'](assert) {
      let MixinA = Mixin.create({});
      let MixinB = Mixin.create(MixinA);
      let obj = {};

      assert.equal(MixinA.detect(obj), false, 'MixinA.detect(obj) before apply()');

      MixinB.apply(obj);
      assert.equal(MixinA.detect(obj), true, 'MixinA.detect(obj) after apply()');
    }

    ['@test detect() finds mixins on other mixins'](assert) {
      let MixinA = Mixin.create({});
      let MixinB = Mixin.create(MixinA);
      assert.equal(MixinA.detect(MixinB), true, 'MixinA is part of MixinB');
      assert.equal(MixinB.detect(MixinA), false, 'MixinB is not part of MixinA');
    }

    ['@test detect handles null values'](assert) {
      let MixinA = Mixin.create();
      assert.equal(MixinA.detect(null), false);
    }
  }
);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/metal/tests/mixin/detect_test.js
discourse-ember-source-3.5.1.1 dist/es/ember-metal/tests/mixin/detect_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-metal/tests/mixin/detect_test.js