DEV: Update a component test (#612)
This commit is contained in:
parent
67d9b1c1d9
commit
e603f06394
|
@ -0,0 +1,32 @@
|
|||
import { render } from "@ember/test-helpers";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import GroupAssignedFilter from "discourse/plugins/discourse-assign/discourse/components/group-assigned-filter";
|
||||
|
||||
module(
|
||||
"Discourse Assign | Integration | Component | group-assigned-filter",
|
||||
function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test("displays username and name", async function (assert) {
|
||||
const filter = {
|
||||
id: 2,
|
||||
username: "Ahmed",
|
||||
name: "Ahmed Gagan",
|
||||
avatar_template: "/letter_avatar_proxy/v4/letter/a/8c91f0/{size}.png",
|
||||
title: "trust_level_0",
|
||||
last_posted_at: "2020-06-22T10:15:54.532Z",
|
||||
last_seen_at: "2020-07-07T11:55:59.437Z",
|
||||
added_at: "2020-06-22T09:55:31.692Z",
|
||||
timezone: "Asia/Calcutta",
|
||||
};
|
||||
|
||||
await render(<template>
|
||||
<GroupAssignedFilter @showAvatar={{true}} @filter={{filter}} />
|
||||
</template>);
|
||||
|
||||
assert.dom(".assign-username").hasText("Ahmed");
|
||||
assert.dom(".assign-name").hasText("Ahmed Gagan");
|
||||
});
|
||||
}
|
||||
);
|
|
@ -1,35 +0,0 @@
|
|||
import hbs from "htmlbars-inline-precompile";
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import { discourseModule, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
discourseModule(
|
||||
"Discourse Assign | Integration | Component | group-assigned-filter",
|
||||
function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("displays username and name", {
|
||||
template: hbs`<GroupAssignedFilter @showAvatar={{true}} @filter={{filter}} />`,
|
||||
|
||||
beforeEach() {
|
||||
this.set("filter", {
|
||||
id: 2,
|
||||
username: "Ahmed",
|
||||
name: "Ahmed Gagan",
|
||||
avatar_template: "/letter_avatar_proxy/v4/letter/a/8c91f0/{size}.png",
|
||||
title: "trust_level_0",
|
||||
last_posted_at: "2020-06-22T10:15:54.532Z",
|
||||
last_seen_at: "2020-07-07T11:55:59.437Z",
|
||||
added_at: "2020-06-22T09:55:31.692Z",
|
||||
timezone: "Asia/Calcutta",
|
||||
});
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.strictEqual(query(".assign-username").innerText, "Ahmed");
|
||||
assert.strictEqual(query(".assign-name").innerText, "Ahmed Gagan");
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
|
@ -1,35 +0,0 @@
|
|||
import hbs from "htmlbars-inline-precompile";
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import { discourseModule, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
discourseModule(
|
||||
"Discourse Assign | Integration | Component | group-assigned-filter",
|
||||
function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("displays username and name", {
|
||||
template: hbs`<GroupAssignedFilter @showAvatar={{true}} @filter={{filter}} />`,
|
||||
|
||||
beforeEach() {
|
||||
this.set("filter", {
|
||||
id: 2,
|
||||
username: "Ahmed",
|
||||
name: "Ahmed Gagan",
|
||||
avatar_template: "/letter_avatar_proxy/v4/letter/a/8c91f0/{size}.png",
|
||||
title: "trust_level_0",
|
||||
last_posted_at: "2020-06-22T10:15:54.532Z",
|
||||
last_seen_at: "2020-07-07T11:55:59.437Z",
|
||||
added_at: "2020-06-22T09:55:31.692Z",
|
||||
timezone: "Asia/Calcutta",
|
||||
});
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.strictEqual(query(".assign-username").innerText, "Ahmed");
|
||||
assert.strictEqual(query(".assign-name").innerText, "Ahmed Gagan");
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue