chore: 🤖 add computed displayName to fallback on id for models
This commit is contained in:
8 files changed
+33
-6
No files matched your search
@@ -11,6 +11,23 @@ module('Unit | Model | base', function (hooks) {
|
||||
assert.ok(model);
|
||||
});
|
||||
|
||||
test('it has a displayName attribute', function (assert) {
|
||||
assert.expect(3);
|
||||
const store = this.owner.lookup('service:store');
|
||||
store.push({
|
||||
data: {
|
||||
id: '123abc',
|
||||
type: 'project',
|
||||
attributes: {},
|
||||
},
|
||||
});
|
||||
const model = store.peekRecord('project', '123abc');
|
||||
assert.equal(model.name, null);
|
||||
assert.equal(model.displayName, '123abc');
|
||||
model.name = 'Test';
|
||||
assert.equal(model.displayName, 'Test');
|
||||
});
|
||||
|
||||
test('it has canSave and cannotSave attributes', function (assert) {
|
||||
assert.expect(8);
|
||||
const store = this.owner.lookup('service:store');
|
||||
|
||||
Reference in new issue
Block a user