UX: Show edit button on post revision modal as long as user can edit.

This commit is contained in:
Guo Xiang Tan
2017-01-27 10:49:17 +08:00
parent 0a1d05c3b2
commit 156a00af47
7 changed files with 75 additions and 12 deletions

View File

@@ -0,0 +1,28 @@
moduleFor("controller:history");
test("displayEdit", function() {
const HistoryController = this.subject();
HistoryController.setProperties({
model: { last_revision: 3, current_revision: 3, can_edit: false }
});
equal(
HistoryController.get("displayEdit"), false,
"it should not display edit button when user cannot edit the post"
);
HistoryController.set("model.can_edit", true);
equal(
HistoryController.get("displayEdit"), true,
"it should display edit button when user can edit the post"
);
HistoryController.set("model.current_revision", 2);
equal(
HistoryController.get("displayEdit"), false,
"it should only display the edit button on the latest revision"
);
});