2019-10-29 18:12:09 +08:00
|
|
|
import selectKit from "helpers/select-kit-helper";
|
|
|
|
import componentTest from "helpers/component-test";
|
2020-02-06 00:14:42 +08:00
|
|
|
import EmberObject from "@ember/object";
|
2019-10-29 18:12:09 +08:00
|
|
|
|
|
|
|
moduleForComponent("badge-title", { integration: true });
|
|
|
|
|
|
|
|
componentTest("badge title", {
|
|
|
|
template:
|
|
|
|
"{{badge-title selectableUserBadges=selectableUserBadges user=user}}",
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set("subject", selectKit());
|
|
|
|
this.set("selectableUserBadges", [
|
2020-02-06 00:14:42 +08:00
|
|
|
EmberObject.create({
|
2019-10-29 18:12:09 +08:00
|
|
|
badge: { name: "(none)" }
|
|
|
|
}),
|
2020-02-06 00:14:42 +08:00
|
|
|
EmberObject.create({
|
2019-10-29 18:12:09 +08:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
});
|