2015-11-23 16:45:05 -05:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
|
|
|
|
acceptance("Admin - Site Texts", { loggedIn: true });
|
|
|
|
|
2018-07-19 05:35:10 -04:00
|
|
|
QUnit.test("search for a key", async assert => {
|
|
|
|
await visit("/admin/customize/site_texts");
|
2015-11-23 16:45:05 -05:00
|
|
|
|
2018-07-19 05:35:10 -04:00
|
|
|
await fillIn(".site-text-search", "Test");
|
|
|
|
|
2018-11-26 12:47:11 -05:00
|
|
|
assert.equal(currentURL(), "/admin/customize/site_texts?q=Test");
|
2018-07-19 05:35:10 -04:00
|
|
|
assert.ok(exists(".site-text"));
|
|
|
|
assert.ok(exists(".site-text:not(.overridden)"));
|
|
|
|
assert.ok(exists(".site-text.overridden"));
|
2015-11-30 15:22:58 -05:00
|
|
|
|
|
|
|
// Only show overridden
|
2019-03-18 16:09:13 -04:00
|
|
|
await click(".search-area .filter-options input");
|
2018-11-26 12:47:11 -05:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
"/admin/customize/site_texts?overridden=true&q=Test"
|
|
|
|
);
|
2018-07-19 05:35:10 -04:00
|
|
|
|
|
|
|
assert.ok(!exists(".site-text:not(.overridden)"));
|
|
|
|
assert.ok(exists(".site-text.overridden"));
|
2015-11-23 16:45:05 -05:00
|
|
|
});
|
|
|
|
|
2018-07-19 05:35:10 -04:00
|
|
|
QUnit.test("edit and revert a site text by key", async assert => {
|
|
|
|
await visit("/admin/customize/site_texts/site.test");
|
|
|
|
|
|
|
|
assert.equal(find(".title h3").text(), "site.test");
|
2020-03-10 09:37:54 -04:00
|
|
|
assert.ok(!exists(".saved"));
|
2018-07-19 05:35:10 -04:00
|
|
|
assert.ok(!exists(".revert-site-text"));
|
2015-11-23 16:45:05 -05:00
|
|
|
|
|
|
|
// Change the value
|
2018-07-19 05:35:10 -04:00
|
|
|
await fillIn(".site-text-value", "New Test Value");
|
|
|
|
await click(".save-changes");
|
2015-11-23 16:45:05 -05:00
|
|
|
|
2020-03-10 09:37:54 -04:00
|
|
|
assert.ok(exists(".saved"));
|
2018-07-19 05:35:10 -04:00
|
|
|
assert.ok(exists(".revert-site-text"));
|
2015-11-23 16:45:05 -05:00
|
|
|
|
|
|
|
// Revert the changes
|
2018-07-19 05:35:10 -04:00
|
|
|
await click(".revert-site-text");
|
|
|
|
|
|
|
|
assert.ok(exists(".bootbox.modal"));
|
|
|
|
|
|
|
|
await click(".bootbox.modal .btn-primary");
|
|
|
|
|
2020-03-10 09:37:54 -04:00
|
|
|
assert.ok(!exists(".saved"));
|
2018-07-19 05:35:10 -04:00
|
|
|
assert.ok(!exists(".revert-site-text"));
|
2018-06-15 11:03:24 -04:00
|
|
|
});
|