2015-11-24 05:45:05 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
|
|
|
|
acceptance("Admin - Site Texts", { loggedIn: true });
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("search for a key", assert => {
|
2015-11-24 05:45:05 +08:00
|
|
|
visit("/admin/customize/site_texts");
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
fillIn(".site-text-search", "Test");
|
2015-12-01 04:22:58 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".site-text"));
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists(".site-text:not(.overridden)"));
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".site-text.overridden"));
|
2015-12-01 04:22:58 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Only show overridden
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".extra-options input");
|
2015-12-01 04:22:58 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(!exists(".site-text:not(.overridden)"));
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".site-text.overridden"));
|
2015-12-01 04:22:58 +08:00
|
|
|
});
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("edit and revert a site text by key", assert => {
|
2015-11-24 05:45:05 +08:00
|
|
|
visit("/admin/customize/site_texts/site.test");
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(find(".title h3").text(), "site.test");
|
|
|
|
assert.ok(!exists(".save-messages .saved"));
|
|
|
|
assert.ok(!exists(".save-messages .saved"));
|
|
|
|
assert.ok(!exists(".revert-site-text"));
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Change the value
|
2018-06-15 23:03:24 +08:00
|
|
|
fillIn(".site-text-value", "New Test Value");
|
2015-11-24 05:45:05 +08:00
|
|
|
click(".save-changes");
|
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".save-messages .saved"));
|
|
|
|
assert.ok(exists(".revert-site-text"));
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Revert the changes
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".revert-site-text");
|
2015-11-24 05:45:05 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".bootbox.modal"));
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".bootbox.modal .btn-primary");
|
2015-11-24 05:45:05 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(!exists(".save-messages .saved"));
|
|
|
|
assert.ok(!exists(".revert-site-text"));
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
2018-06-15 23:03:24 +08:00
|
|
|
});
|