Sha256: d3178f4dd3887cfcc6210cbe4e794409b953a91fc30186dd9ff61100a0d1b789

Contents?: true

Size: 980 Bytes

Versions: 1

Compression:

Stored size: 980 Bytes

Contents

import { get } from '@ember/-internals/metal';
import EmberObject from '../../../lib/system/object';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'system/object/reopenClass',
  class extends AbstractTestCase {
    ['@test adds new properties to subclass'](assert) {
      let Subclass = EmberObject.extend();
      Subclass.reopenClass({
        foo() {
          return 'FOO';
        },
        bar: 'BAR',
      });

      assert.equal(Subclass.foo(), 'FOO', 'Adds method');
      assert.equal(get(Subclass, 'bar'), 'BAR', 'Adds property');
    }

    ['@test class properties inherited by subclasses'](assert) {
      let Subclass = EmberObject.extend();
      Subclass.reopenClass({
        foo() {
          return 'FOO';
        },
        bar: 'BAR',
      });

      let SubSub = Subclass.extend();

      assert.equal(SubSub.foo(), 'FOO', 'Adds method');
      assert.equal(get(SubSub, 'bar'), 'BAR', 'Adds property');
    }
  }
);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/runtime/tests/system/object/reopenClass_test.js