Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions ember_debug/object-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1112,6 +1101,9 @@ function calculateCPs(
item.code = '';
}
}
if (value instanceof Service) {
item.isService = true;
}
}
}
});
Expand Down
13 changes: 9 additions & 4 deletions tests/ember_debug/object-inspector-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down