2019-10-29 14:23:50 -05:00
|
|
|
import EmberObject from "@ember/object";
|
2018-09-04 10:42:39 +10:00
|
|
|
moduleFor("controller:preferences/account");
|
|
|
|
|
2019-04-17 10:05:02 +02:00
|
|
|
QUnit.test("updating of associated accounts", function(assert) {
|
2018-09-04 10:42:39 +10:00
|
|
|
const controller = this.subject({
|
|
|
|
siteSettings: {
|
|
|
|
enable_google_oauth2_logins: true
|
|
|
|
},
|
2019-10-29 14:23:50 -05:00
|
|
|
model: EmberObject.create({
|
2020-04-08 12:46:43 +02:00
|
|
|
id: 70,
|
2019-04-17 10:05:02 +02:00
|
|
|
second_factor_enabled: true,
|
|
|
|
is_anonymous: true
|
2018-09-04 10:42:39 +10:00
|
|
|
}),
|
2020-04-08 12:46:43 +02:00
|
|
|
currentUser: EmberObject.create({
|
2020-04-22 13:44:19 +10:00
|
|
|
id: 1234
|
2020-04-08 12:46:43 +02:00
|
|
|
}),
|
2019-10-29 14:23:50 -05:00
|
|
|
site: EmberObject.create({
|
2018-09-04 10:42:39 +10:00
|
|
|
isMobileDevice: false
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
|
|
|
|
|
|
|
|
controller.set("model.second_factor_enabled", false);
|
2019-02-26 13:49:27 +05:30
|
|
|
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
|
|
|
|
|
2019-04-17 10:05:02 +02:00
|
|
|
controller.set("model.is_anonymous", false);
|
|
|
|
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
|
|
|
|
|
2020-04-08 12:46:43 +02:00
|
|
|
controller.set("model.id", 1234);
|
2018-09-04 10:42:39 +10:00
|
|
|
assert.equal(controller.get("canUpdateAssociatedAccounts"), true);
|
|
|
|
});
|