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