From 86f2f6871b7bb9ec34498323bfcbc497cd9b74b7 Mon Sep 17 00:00:00 2001 From: patricklx Date: Tue, 17 Dec 2019 21:36:27 +0100 Subject: [PATCH] fix accessing properties of Object Proxy (#1092) * fix access of Object Proxy also for tracked detection * Update object-inspector-test.js --- ember_debug/object-inspector.js | 15 ++++++++------- tests/ember_debug/object-inspector-test.js | 9 ++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ember_debug/object-inspector.js b/ember_debug/object-inspector.js index 05f095f170..554c3614e9 100644 --- a/ember_debug/object-inspector.js +++ b/ember_debug/object-inspector.js @@ -557,13 +557,6 @@ export default EmberObject.extend(PortMixin, { */ mixinDetailsForObject(object) { const mixins = []; - if (object instanceof Ember.ObjectProxy && object.content && !object._showProxyDetails) { - return this.mixinDetailsForObject(object.content); - } - - if (object instanceof Ember.ArrayProxy && object.content && !object._showProxyDetails) { - return this.mixinDetailsForObject(object.slice(0, 101)); - } const own = ownMixins(object); @@ -611,6 +604,14 @@ export default EmberObject.extend(PortMixin, { }, mixinsForObject(object) { + if (object instanceof Ember.ObjectProxy && object.content && !object._showProxyDetails) { + object = object.content; + } + + if (object instanceof Ember.ArrayProxy && object.content && !object._showProxyDetails) { + object = object.slice(0, 101); + } + let mixinDetails = this.mixinDetailsForObject(object); mixinDetails[0].name = 'Own Properties'; diff --git a/tests/ember_debug/object-inspector-test.js b/tests/ember_debug/object-inspector-test.js index 36a523ce21..56c354c6e9 100644 --- a/tests/ember_debug/object-inspector-test.js +++ b/tests/ember_debug/object-inspector-test.js @@ -276,7 +276,10 @@ module('Ember Debug - Object Inspector', function(hooks) { test('Proxies are skipped by default', function (assert) { let inspected = EmberObject.extend({ - test: 'a' + test: 'a', + get abc() { + return 1; + } }).create(); const proxy = ObjectProxy.create({ content: inspected @@ -285,6 +288,10 @@ module('Ember Debug - Object Inspector', function(hooks) { let computedProperty = message.details[1].properties[0]; assert.equal(computedProperty.name, 'test'); assert.equal(computedProperty.value.inspect, inspect('a')); + + let getterProperty = message.details[1].properties[1]; + assert.equal(getterProperty.name, 'abc'); + assert.equal(getterProperty.value.inspect, inspect(1)); }); test('Object Proxies are not skipped with _showProxyDetails', function (assert) {