['@test can iterate over a list of computed properties for a class'](assert) { let MyClass = EmberObject.extend({ foo: computed(function() {}), fooDidChange: observer('foo', function() {}), bar: computed(function() {}), qux: alias('foo'), }); let SubClass = MyClass.extend({ baz: computed(function() {}), }); SubClass.reopen({ bat: computed(function() {}).meta({ iAmBat: true }), }); let list = []; MyClass.eachComputedProperty(function(name) { list.push(name); }); assert.deepEqual( list.sort(), ['bar', 'foo', 'qux'], 'watched and unwatched computed properties are iterated' ); list = []; SubClass.eachComputedProperty(function(name, meta) { list.push(name); if (name === 'bat') { assert.deepEqual(meta, { iAmBat: true }); } else { assert.deepEqual(meta, {}); } }); assert.deepEqual( list.sort(), ['bar', 'bat', 'baz', 'foo', 'qux'], 'all inherited properties are included' ); }
export function readOnly(dependentKey) { return alias(dependentKey).readOnly(); }
let length = get(this._arrangedContent, 'length'); dirtyIndex += length + removedCnt - addedCnt; } if (this._objectsDirtyIndex === -1 || this._objectsDirtyIndex > dirtyIndex) { this._objectsDirtyIndex = dirtyIndex; } this._lengthDirty = true; this.arrayContentDidChange(idx, removedCnt, addedCnt); } _invalidate() { this._objectsDirtyIndex = 0; this._lengthDirty = true; } } ArrayProxy.reopen(MutableArray, { /** The array that the proxy pretends to be. In the default `ArrayProxy` implementation, this and `content` are the same. Subclasses of `ArrayProxy` can override this property to provide things like sorting and filtering. @property arrangedContent @public */ arrangedContent: alias('content'), });
export function oneWay(dependentKey) { return alias(dependentKey).oneWay(); }