DEV: Add test (#8250)

Follow-up to 2863e7c181843261a0d7b6c9255185a38b7f2680.
This commit is contained in:
Bianca Nenciu 2019-10-29 12:12:09 +02:00 committed by GitHub
parent ff9345fbb0
commit 1531644288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import selectKit from "helpers/select-kit-helper";
import componentTest from "helpers/component-test";
moduleForComponent("badge-title", { integration: true });
componentTest("badge title", {
template:
"{{badge-title selectableUserBadges=selectableUserBadges user=user}}",
beforeEach() {
this.set("subject", selectKit());
this.set("selectableUserBadges", [
Ember.Object.create({
badge: { name: "(none)" }
}),
Ember.Object.create({
id: 42,
badge_id: 102,
badge: { name: "Test" }
})
]);
},
async test(assert) {
/* global server */
server.put("/u/eviltrout/preferences/badge_title", () => [
200,
{ "Content-Type": "application/json" },
{}
]);
await this.subject.expand();
await this.subject.selectRowByValue(42);
await click(".btn");
assert.equal(this.currentUser.title, "Test");
}
});

View File

@ -33,6 +33,7 @@ export default function(name, opts) {
this.registry.register("current-user:main", this.currentUser, {
instantiate: false
});
this.registry.injection("component", "currentUser", "current-user:main");
this.registry.register(
"topic-tracking-state:main",
TopicTrackingState.create({ currentUser }),