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