Skip to content

Commit

Permalink
[BUGFIX inspector] Set group name to relationship.kind (#6349)
Browse files Browse the repository at this point in the history
* Set group name to relationship.kind

This fixes a bug in inspector where the groups are named the model name instead of the relationship type.

* Update tests
  • Loading branch information
RobbieTheWagner authored and runspired committed Aug 20, 2019
1 parent ab0155e commit 9d18bd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/-ember-data/tests/unit/debug-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ test('_debugInfo groups the attributes and relationships correctly', function(as
let propertyInfo = record._debugInfo().propertyInfo;

assert.equal(propertyInfo.groups.length, 4);
assert.equal(propertyInfo.groups[0].name, 'Attributes');
assert.deepEqual(propertyInfo.groups[0].properties, ['id', 'name', 'isDrugAddict']);
assert.equal(propertyInfo.groups[1].name, 'belongsTo');
assert.deepEqual(propertyInfo.groups[1].properties, ['maritalStatus']);
assert.equal(propertyInfo.groups[2].name, 'hasMany');
assert.deepEqual(propertyInfo.groups[2].properties, ['posts']);
});

Expand Down Expand Up @@ -86,12 +89,12 @@ test('_debugInfo supports arbitray relationship types', function(assert) {
expand: true,
},
{
name: 'maritalStatus',
name: 'belongsTo',
properties: ['maritalStatus'],
expand: true,
},
{
name: 'posts',
name: 'customRelationship',
properties: ['posts'],
expand: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/store/addon/-private/system/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ const Model = EmberObject.extend(DeprecatedEvented, {
if (properties === undefined) {
properties = relationships[relationship.kind] = [];
groups.push({
name: relationship.name,
name: relationship.kind,
properties,
expand: true,
});
Expand Down

0 comments on commit 9d18bd2

Please sign in to comment.