Sha256: 695f74463ef005c0ca1de2d5139374c057392fcea55c0e9bc50979fdc38625d7

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

import EmberObject from '../../../lib/system/object';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'system/object/detectInstance',
  class extends AbstractTestCase {
    ['@test detectInstance detects instances correctly'](assert) {
      let A = EmberObject.extend();
      let B = A.extend();
      let C = A.extend();

      let o = EmberObject.create();
      let a = A.create();
      let b = B.create();
      let c = C.create();

      assert.ok(EmberObject.detectInstance(o), 'o is an instance of EmberObject');
      assert.ok(EmberObject.detectInstance(a), 'a is an instance of EmberObject');
      assert.ok(EmberObject.detectInstance(b), 'b is an instance of EmberObject');
      assert.ok(EmberObject.detectInstance(c), 'c is an instance of EmberObject');

      assert.ok(!A.detectInstance(o), 'o is not an instance of A');
      assert.ok(A.detectInstance(a), 'a is an instance of A');
      assert.ok(A.detectInstance(b), 'b is an instance of A');
      assert.ok(A.detectInstance(c), 'c is an instance of A');

      assert.ok(!B.detectInstance(o), 'o is not an instance of B');
      assert.ok(!B.detectInstance(a), 'a is not an instance of B');
      assert.ok(B.detectInstance(b), 'b is an instance of B');
      assert.ok(!B.detectInstance(c), 'c is not an instance of B');

      assert.ok(!C.detectInstance(o), 'o is not an instance of C');
      assert.ok(!C.detectInstance(a), 'a is not an instance of C');
      assert.ok(!C.detectInstance(b), 'b is not an instance of C');
      assert.ok(C.detectInstance(c), 'c is an instance of C');
    }
  }
);

Version data entries

3 entries across 3 versions & 1 rubygems

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