Skip to content

Commit

Permalink
start fleshing out the document-list test but I don't know yet how to…
Browse files Browse the repository at this point in the history
… test things properly with mirage
  • Loading branch information
StephanH90 authored and czosel committed Sep 17, 2021
1 parent 661818f commit e2a2295
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
11 changes: 10 additions & 1 deletion addon/components/document-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@
<th class="uk-table-shrink">
Icon
</th>
<th {{on "click" (fn @setSort "title")}}>
{{!-- <th {{on "click" (fn @setSort "title")}}>
Title
</th>
<th {{on "click" (fn @setSort "createdAt")}}>
Created
</th>
<th {{on "click" (fn @setSort "createdByGroup")}}>
Group
</th> --}}
<th>
Title
</th>
<th>
Created
</th>
<th>
Group
</th>
</tr>
</thead>
Expand Down
37 changes: 19 additions & 18 deletions tests/integration/components/document-list-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
// import { render } from "@ember/test-helpers";
// import { hbs } from "ember-cli-htmlbars";
import { setupMirage } from "ember-cli-mirage/test-support";
import engineResolverFor from "ember-engines/test-support/engine-resolver-for";
import { setupIntl } from "ember-intl/test-support";
import { setupRenderingTest } from "ember-qunit";
import { module, test } from "qunit";

Expand All @@ -9,22 +11,21 @@ const resolver = engineResolverFor(modulePrefix);

module("Integration | Component | document-list", function (hooks) {
setupRenderingTest(hooks, { resolver });
setupIntl(hooks, "en");
setupMirage(hooks);

test("it renders", async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
// test("it renders the supplied list of documents with the correct title", async function (assert) {
// const createdDocs = this.server.createList("document", 3);
// this.set("fetchedDocuments", createdDocs);
// // await render(hbs`<DocumentList />`);
// // assert.equal(this.element.textContent.trim(), "");
// // Template block usage:
// await render(hbs`
// <DocumentList/>
// `);
// assert.equal(this.element.textContent.trim(), createdDocs[0]);
// });

await render(hbs`<DocumentList />`);

assert.equal(this.element.textContent.trim(), "");

// Template block usage:
await render(hbs`
<DocumentList>
template block text
</DocumentList>
`);

assert.equal(this.element.textContent.trim(), "template block text");
});
test("it renders the supplied list of documents with the correct title");
test("clicking the sorting buttons enables the correct sorting function");
});

0 comments on commit e2a2295

Please sign in to comment.