discourse/test/javascripts/controllers/group-test.js.es6

34 lines
692 B
Plaintext
Raw Normal View History

2017-06-15 01:57:58 +08:00
moduleFor("controller:group", {
2018-06-15 23:03:24 +08:00
needs: ["controller:application"]
2017-06-15 01:57:58 +08:00
});
2017-06-15 01:57:58 +08:00
QUnit.test("canEditGroup", function(assert) {
const GroupController = this.subject();
GroupController.setProperties({
model: { is_group_owner: true, automatic: true }
});
2018-06-15 23:03:24 +08:00
assert.equal(
GroupController.get("canEditGroup"),
false,
"automatic groups cannot be edited"
);
GroupController.set("model.automatic", false);
2018-06-15 23:03:24 +08:00
assert.equal(
GroupController.get("canEditGroup"),
true,
"owners can edit groups"
);
GroupController.set("model.is_group_owner", false);
2018-06-15 23:03:24 +08:00
assert.equal(
GroupController.get("canEditGroup"),
false,
"normal users cannot edit groups"
);
});