Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
patocallaghan committed Feb 11, 2020
1 parent 223fca8 commit 1edaeb6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/dummy/app/components/my-component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';

export default class MyComponent extends Component {
@service store;
@tracked record = this.store.createRecord('my-model', { name: 'test', fragments: [] })
}
6 changes: 6 additions & 0 deletions tests/dummy/app/models/my-fragment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { attr } from '@ember-data/model';
import Fragment from 'ember-data-model-fragments/fragment';

export default Fragment.extend({
name: attr('string')
});
7 changes: 7 additions & 0 deletions tests/dummy/app/models/my-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Model, { attr } from '@ember-data/model';
import { fragmentArray } from 'ember-data-model-fragments/attributes';

export default Model.extend({
name: attr('string'),
fragments: fragmentArray('my-fragment')
});
1 change: 1 addition & 0 deletions tests/dummy/app/templates/components/my-component.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>{{this.record.name}}</p>
15 changes: 15 additions & 0 deletions tests/integration/components/my-component-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | my-component', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
await render(hbs`
<MyComponent />
`);
assert.dom('p').hasText('test');
});
});

0 comments on commit 1edaeb6

Please sign in to comment.