discourse/test/javascripts/components/badge-title-test.js.es6
Bianca Nenciu 1531644288
DEV: Add test (#8250)
Follow-up to 2863e7c181.
2019-10-29 12:12:09 +02:00

37 lines
915 B
JavaScript

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");
}
});