This encompasses a lot of work done over the last year, much of which has already been merged into master. This is the final set of changes required to get Ember CLI running locally for development. From here on it will be bug fixes / enhancements. Co-authored-by: Jarek Radosz <jradosz@gmail.com> Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com> Co-authored-by: Jarek Radosz <jradosz@gmail.com> Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com>
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import EmberObject from "@ember/object";
|
|
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
|
import { registerRouter } from "discourse/mapping-router";
|
|
import { test } from "qunit";
|
|
|
|
discourseModule("Unit | Controller | avatar-selector", function (hooks) {
|
|
hooks.beforeEach(function () {
|
|
registerRouter(this.registry);
|
|
});
|
|
|
|
test("avatarTemplate", function (assert) {
|
|
const user = EmberObject.create({
|
|
avatar_template: "avatar",
|
|
system_avatar_template: "system",
|
|
gravatar_avatar_template: "gravatar",
|
|
|
|
system_avatar_upload_id: 1,
|
|
gravatar_avatar_upload_id: 2,
|
|
custom_avatar_upload_id: 3,
|
|
});
|
|
const avatarSelectorController = this.getController("avatar-selector", {
|
|
user,
|
|
});
|
|
|
|
user.set("avatar_template", "system");
|
|
assert.equal(
|
|
avatarSelectorController.get("selectedUploadId"),
|
|
1,
|
|
"we are using system by default"
|
|
);
|
|
|
|
user.set("avatar_template", "gravatar");
|
|
assert.equal(
|
|
avatarSelectorController.get("selectedUploadId"),
|
|
2,
|
|
"we are using gravatar when set"
|
|
);
|
|
|
|
user.set("avatar_template", "avatar");
|
|
assert.equal(
|
|
avatarSelectorController.get("selectedUploadId"),
|
|
3,
|
|
"we are using custom when set"
|
|
);
|
|
});
|
|
});
|