discourse/test/javascripts/controllers/avatar-selector-test.js.es6

28 lines
932 B
Plaintext
Raw Normal View History

2016-11-08 13:29:50 -06:00
import { mapRoutes } from 'discourse/mapping-router';
2014-07-30 16:53:14 -05:00
moduleFor("controller:avatar-selector", "controller:avatar-selector", {
2017-06-14 12:57:58 -05:00
beforeEach() {
2016-11-08 13:29:50 -06:00
this.registry.register('router:main', mapRoutes());
},
2014-07-30 16:53:14 -05:00
needs: ['controller:modal']
});
2017-06-14 12:57:58 -05:00
QUnit.test("avatarTemplate", function(assert) {
const avatarSelectorController = this.subject();
avatarSelectorController.setProperties({
selected: "system",
system_avatar_upload_id:1,
gravatar_avatar_upload_id:2,
custom_avatar_upload_id: 3
});
2017-06-14 12:57:58 -05:00
assert.equal(avatarSelectorController.get("selectedUploadId"), 1, "we are using system by default");
avatarSelectorController.set('selected', 'gravatar');
2017-06-14 12:57:58 -05:00
assert.equal(avatarSelectorController.get("selectedUploadId"), 2, "we are using gravatar when set");
avatarSelectorController.set("selected", "custom");
2017-06-14 12:57:58 -05:00
assert.equal(avatarSelectorController.get("selectedUploadId"), 3, "we are using custom when set");
});