discourse/test/javascripts/acceptance/admin-site-text-test.js.es6

53 lines
1.4 KiB
Plaintext
Raw Normal View History

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 => {
visit("/admin/customize/site_texts");
2018-06-15 23:03:24 +08:00
fillIn(".site-text-search", "Test");
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"));
});
// Only show overridden
2018-06-15 23:03:24 +08:00
click(".extra-options input");
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"));
});
});
2017-06-15 01:57:58 +08:00
QUnit.test("edit and revert a site text by key", assert => {
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"));
});
// Change the value
2018-06-15 23:03:24 +08:00
fillIn(".site-text-value", "New Test Value");
click(".save-changes");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(exists(".save-messages .saved"));
assert.ok(exists(".revert-site-text"));
});
// Revert the changes
2018-06-15 23:03:24 +08:00
click(".revert-site-text");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(exists(".bootbox.modal"));
});
2018-06-15 23:03:24 +08:00
click(".bootbox.modal .btn-primary");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(!exists(".save-messages .saved"));
assert.ok(!exists(".revert-site-text"));
});
2018-06-15 23:03:24 +08:00
});