From 941f245efb5fe3e03e65636ba96a985fb169b86b Mon Sep 17 00:00:00 2001 From: bmac Date: Wed, 26 Aug 2015 18:01:06 -0400 Subject: [PATCH] Failing tests for ArrayProxy#length cacheing issue --- .../system/array_proxy/content_change_test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/ember-runtime/tests/system/array_proxy/content_change_test.js b/packages/ember-runtime/tests/system/array_proxy/content_change_test.js index 495b31283d6..5e205261614 100644 --- a/packages/ember-runtime/tests/system/array_proxy/content_change_test.js +++ b/packages/ember-runtime/tests/system/array_proxy/content_change_test.js @@ -17,6 +17,24 @@ QUnit.test('should update length for null content', function() { equal(proxy.get('length'), 0, 'length updates'); }); +QUnit.test('should update length for null content when there is a computed property watching length', function() { + var proxy = ArrayProxy.extend({ + isEmpty: Ember.computed.not('length') + }).create({ + content: Ember.A([1, 2, 3]) + }); + + equal(proxy.get('length'), 3, 'precond - length is 3'); + + // Consume computed property that depends on length + proxy.get('isEmpty'); + + // update content + proxy.set('content', null); + + equal(proxy.get('length'), 0, 'length updates'); +}); + QUnit.test('The `arrangedContentWillChange` method is invoked before `content` is changed.', function() { var callCount = 0; var expectedLength;