Refactor and add tests for category editing

This commit is contained in:
Robin Ward
2015-07-02 12:06:24 -04:00
parent 2d2e2b9924
commit 23daa9d8ce
6 changed files with 37 additions and 14 deletions
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
acceptance("Category Edit", { loggedIn: true });
test("Can edit a category", (assert) => {
test("Can open the category modal", (assert) => {
visit("/c/bug");
click('.edit-category');
@@ -15,3 +15,15 @@ test("Can edit a category", (assert) => {
assert.ok(!visible('#discourse-modal'), 'it closes the modal');
});
});
test("Change the category color", (assert) => {
visit("/c/bug");
click('.edit-category');
fillIn('#edit-text-color', '#ff0000');
click('#save-category');
andThen(() => {
assert.ok(!visible('#discourse-modal'), 'it closes the modal');
assert.equal(Discourse.URL.redirectedTo, '/c/bug', 'it does one of the rare full page redirects');
});
});