A platform for community discussion. Free, open, simple.
DEV: Add test (#8250)
Bianca Nenciu15316442889b
diff --git a/test/javascripts/components/badge-title-test.js.es6 b/test/javascripts/components/badge-title-test.js.es6new file mode 100644index 00000000000..a6af1eff06b--- /dev/null+++ b/test/javascripts/components/badge-title-test.js.es6@@ -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");+ }+});diff --git a/test/javascripts/helpers/component-test.js.es6 b/test/javascripts/helpers/component-test.js.es6index 8ddd75012a7..e694cb8a05b 100644--- a/test/javascripts/helpers/component-test.js.es6+++ b/test/javascripts/helpers/component-test.js.es6@@ -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 }),