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");
|
|
|
|
|
|
|
|
fillIn('.site-text-search', 'Test');
|
2015-12-01 04:22:58 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +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
|
|
|
|
click('.extra-options input');
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(!exists(".site-text:not(.overridden)"));
|
|
|
|
assert.ok(exists('.site-text.overridden'));
|
2015-12-01 04:22:58 +08:00
|
|
|
});
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
|
|
|
|
2015-12-01 04:22:58 +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(() => {
|
2017-06-15 01:57:58 +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
|
|
|
|
fillIn('.site-text-value', 'New Test Value');
|
|
|
|
click(".save-changes");
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +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
|
|
|
|
click('.revert-site-text');
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists('.bootbox.modal'));
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
|
|
|
click('.bootbox.modal .btn-primary');
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(!exists('.save-messages .saved'));
|
|
|
|
assert.ok(!exists('.revert-site-text'));
|
2015-11-24 05:45:05 +08:00
|
|
|
});
|
2017-06-15 01:57:58 +08:00
|
|
|
});
|