2015-11-23 16:45:05 -05:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
|
|
|
|
acceptance("Admin - Site Texts", { loggedIn: true });
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("search for a key", assert => {
|
2015-11-23 16:45:05 -05:00
|
|
|
visit("/admin/customize/site_texts");
|
|
|
|
|
|
|
|
fillIn('.site-text-search', 'Test');
|
2015-11-30 15:22:58 -05:00
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -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
|
|
|
|
click('.extra-options input');
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok(!exists(".site-text:not(.overridden)"));
|
|
|
|
assert.ok(exists('.site-text.overridden'));
|
2015-11-30 15:22:58 -05:00
|
|
|
});
|
2015-11-23 16:45:05 -05:00
|
|
|
});
|
|
|
|
|
2015-11-30 15:22:58 -05:00
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("edit and revert a site text by key", assert => {
|
2015-11-23 16:45:05 -05:00
|
|
|
visit("/admin/customize/site_texts/site.test");
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04: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-23 16:45:05 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// Change the value
|
|
|
|
fillIn('.site-text-value', 'New Test Value');
|
|
|
|
click(".save-changes");
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok(exists('.save-messages .saved'));
|
|
|
|
assert.ok(exists('.revert-site-text'));
|
2015-11-23 16:45:05 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// Revert the changes
|
|
|
|
click('.revert-site-text');
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok(exists('.bootbox.modal'));
|
2015-11-23 16:45:05 -05:00
|
|
|
});
|
|
|
|
click('.bootbox.modal .btn-primary');
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.ok(!exists('.save-messages .saved'));
|
|
|
|
assert.ok(!exists('.revert-site-text'));
|
2015-11-23 16:45:05 -05:00
|
|
|
});
|
2017-06-14 13:57:58 -04:00
|
|
|
});
|