diff --git a/ember_debug/object-inspector.js b/ember_debug/object-inspector.js index 777f9d5f4b..bfa2df7e6d 100644 --- a/ember_debug/object-inspector.js +++ b/ember_debug/object-inspector.js @@ -899,18 +899,7 @@ function addProperties(properties, hash) { let options = { isMandatorySetter: isMandatorySetter(desc) }; if (typeof hash[prop] === 'object' && hash[prop] !== null) { - options.isService = - !('type' in hash[prop]) && hash[prop].type === 'service'; - - if (!options.isService) { - if (hash[prop].constructor) { - options.isService = hash[prop].constructor.isServiceFactory; - } - } - - if (!options.isService) { - options.isService = desc.value instanceof Service; - } + options.isService = desc.value instanceof Service; } if (options.isService) { replaceProperty(properties, prop, inspectValue(hash, prop), options); @@ -1112,6 +1101,9 @@ function calculateCPs( item.code = ''; } } + if (value instanceof Service) { + item.isService = true; + } } } }); diff --git a/tests/ember_debug/object-inspector-test.js b/tests/ember_debug/object-inspector-test.js index 4ae1d4b0f5..c5f42975a5 100644 --- a/tests/ember_debug/object-inspector-test.js +++ b/tests/ember_debug/object-inspector-test.js @@ -11,7 +11,7 @@ import EmberObject, { computed } from '@ember/object'; import MutableArray from '@ember/array/mutable'; import ArrayProxy from '@ember/array/proxy'; import ObjectProxy from '@ember/object/proxy'; -import Service from '@ember/service'; +import Service, { inject as service } from '@ember/service'; import { VERSION } from '@ember/version'; import { tracked } from '@glimmer/tracking'; import { module, skip, test } from 'qunit'; @@ -902,17 +902,22 @@ module('Ember Debug - Object Inspector', function (hooks) { fooBoo() { return true; }, - }).create(); + }); + + this.owner.register('service:test-inspect-service', inspectedService); let inspected = EmberObject.extend({ - service: inspectedService, - }).create(); + service: inspectedService.create(), + service2: service('test-inspect-service'), + }).create(this); let message = await inspectObject(inspected); let serializedServiceProperty = message.details[1].properties[0]; + let serializedService2Property = message.details[1].properties[1]; assert.true(serializedServiceProperty.isService); + assert.true(serializedService2Property.isService); }); test('Proxy Service should be successfully tagged as service on serialization', async function (assert) {