Sha256: 26068e811f11073ce70c0d0691642991eb882f7a6819cf14e1e3d3706f835080

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

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

function K() {}

moduleFor(
  'Mixin.apply',
  class extends AbstractTestCase {
    ['@test using apply() should apply properties'](assert) {
      let MixinA = Mixin.create({ foo: 'FOO', baz: K });
      let obj = {};
      mixin(obj, MixinA);

      assert.equal(get(obj, 'foo'), 'FOO', 'should apply foo');
      assert.equal(get(obj, 'baz'), K, 'should apply foo');
    }

    ['@test applying anonymous properties'](assert) {
      let obj = {};
      mixin(obj, {
        foo: 'FOO',
        baz: K,
      });

      assert.equal(get(obj, 'foo'), 'FOO', 'should apply foo');
      assert.equal(get(obj, 'baz'), K, 'should apply foo');
    }

    ['@test applying null values']() {
      expectAssertion(() => mixin({}, null));
    }

    ['@test applying a property with an undefined value'](assert) {
      let obj = { tagName: '' };
      mixin(obj, { tagName: undefined });

      assert.strictEqual(get(obj, 'tagName'), '');
    }
  }
);

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/apply_test.js
discourse-ember-source-3.5.1.1 dist/es/ember-metal/tests/mixin/apply_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-metal/tests/mixin/apply_test.js