Sha256: e694a836ec30ae13c5c82d1618ae3e8eac89ca07ed41079a72dc1731fece19e6
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
import { AbstractTestCase } from 'internal-test-helpers'; import { runArrayTests } from '../helpers/array'; import { get, set } from 'ember-metal'; class LastObjectTests extends AbstractTestCase { '@test returns last item in enumerable'() { let obj = this.newObject(); let ary = this.toArray(obj); this.assert.equal(get(obj, 'lastObject'), ary[ary.length - 1]); } '@test returns undefined if enumerable is empty'() { let obj = this.newObject([]); this.assert.equal(get(obj, 'lastObject'), undefined); } '@test can not be set'() { let obj = this.newObject(); let ary = this.toArray(obj); this.assert.equal(get(obj, 'lastObject'), ary[ary.length - 1]); this.assert.throws(function() { set(obj, 'lastObject', 'foo!'); }, /Cannot set read-only property "lastObject" on object/); } } runArrayTests('lastObject', LastObjectTests);
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/ember-runtime/tests/array/lastObject-test.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/ember-runtime/tests/array/lastObject-test.js |