Skip to content

Commit

Permalink
add failing test for content attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Aug 28, 2021
1 parent e393450 commit 7d87813
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/-ember-data/tests/unit/model/attr-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,28 @@ module('unit/model/attr | attr syntax', function (hooks) {

assert.strictEqual(userRecord.name, 'Chris', 'attr is correctly set: name');
});

test('attr can be used to define an attribute with name "content"', async function (assert) {
class Blog extends Model {
@attr content;
}

owner.register('model:blog', Blog);

let BlogModel = store.modelFor('blog');
let attrs = BlogModel.attributes;
assert.true(attrs.has('content'), 'We have the attr: name');

let userRecord = store.push({
data: {
type: 'blog',
id: '1',
attributes: {
content: 'The best blog post',
},
},
});

assert.strictEqual(userRecord.content, 'The best blog post', 'attr is correctly set: content');
});
});

0 comments on commit 7d87813

Please sign in to comment.