REFACTOR: Import `QUnit` and related helpers rather than globals
We used many global functions to handle tests when they should be imported like other libraries in our application. This also gets us closer to the way Ember CLI prefers our tests to be laid out.
This commit is contained in:
parent
c0293339b8
commit
71d37953d5
|
@ -2,5 +2,11 @@
|
|||
"extends": "eslint-config-discourse",
|
||||
"rules": {
|
||||
"discourse-ember/global-ember": 2
|
||||
},
|
||||
"globals": {
|
||||
"moduleFor": "off",
|
||||
"moduleForComponent": "off",
|
||||
"testStart": "off",
|
||||
"testDone": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { moduleForComponent } from "ember-qunit";
|
||||
import EmberObject from "@ember/object";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import componentTest from "discourse/tests/helpers/component-test";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { moduleForComponent } from "ember-qunit";
|
||||
import I18n from "I18n";
|
||||
import componentTest from "discourse/tests/helpers/component-test";
|
||||
import Theme from "admin/models/theme";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { moduleForComponent } from "ember-qunit";
|
||||
import I18n from "I18n";
|
||||
import componentTest from "discourse/tests/helpers/component-test";
|
||||
import Theme, { THEMES, COMPONENTS } from "admin/models/theme";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { moduleFor } from "ember-qunit";
|
||||
import { test } from "qunit";
|
||||
import { mapRoutes } from "discourse/mapping-router";
|
||||
import Theme from "admin/models/theme";
|
||||
|
||||
|
@ -8,7 +10,7 @@ moduleFor("controller:admin-customize-themes-show", {
|
|||
needs: ["controller:adminUser"],
|
||||
});
|
||||
|
||||
QUnit.test("can display source url for remote themes", function (assert) {
|
||||
test("can display source url for remote themes", function (assert) {
|
||||
const repoUrl = "https://github.com/discourse/discourse-brand-header.git";
|
||||
const remoteTheme = Theme.create({
|
||||
id: 2,
|
||||
|
@ -29,9 +31,7 @@ QUnit.test("can display source url for remote themes", function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("can display source url for remote theme branches", function (
|
||||
assert
|
||||
) {
|
||||
test("can display source url for remote theme branches", function (assert) {
|
||||
const remoteTheme = Theme.create({
|
||||
id: 2,
|
||||
default: true,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { moduleFor } from "ember-qunit";
|
||||
import { test } from "qunit";
|
||||
import { mapRoutes } from "discourse/mapping-router";
|
||||
import Theme from "admin/models/theme";
|
||||
|
||||
|
@ -8,7 +10,7 @@ moduleFor("controller:admin-customize-themes", {
|
|||
needs: ["controller:adminUser"],
|
||||
});
|
||||
|
||||
QUnit.test("can list themes correctly", function (assert) {
|
||||
test("can list themes correctly", function (assert) {
|
||||
const defaultTheme = Theme.create({ id: 2, default: true, name: "default" });
|
||||
const userTheme = Theme.create({
|
||||
id: 3,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { moduleFor } from "ember-qunit";
|
||||
import { test } from "qunit";
|
||||
import Badge from "discourse/models/badge";
|
||||
import { mapRoutes } from "discourse/mapping-router";
|
||||
|
||||
|
@ -8,7 +10,7 @@ moduleFor("controller:admin-user-badges", {
|
|||
needs: ["controller:adminUser"],
|
||||
});
|
||||
|
||||
QUnit.test("grantableBadges", function (assert) {
|
||||
test("grantableBadges", function (assert) {
|
||||
const badgeFirst = Badge.create({
|
||||
id: 3,
|
||||
name: "A Badge",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test, module } from "qunit";
|
||||
import Theme from "admin/models/theme";
|
||||
|
||||
QUnit.module("model:theme");
|
||||
module("model:theme");
|
||||
|
||||
QUnit.test("can add an upload correctly", function (assert) {
|
||||
test("can add an upload correctly", function (assert) {
|
||||
let theme = Theme.create();
|
||||
|
||||
assert.equal(
|
||||
|
|
|
@ -153,6 +153,19 @@ var define, requirejs;
|
|||
pretender: {
|
||||
default: window.Pretender,
|
||||
},
|
||||
"ember-qunit": {
|
||||
moduleFor: window.moduleFor,
|
||||
moduleForComponent: window.moduleForComponent,
|
||||
},
|
||||
qunit:
|
||||
typeof window.QUnit !== "undefined"
|
||||
? {
|
||||
default: window.QUnit,
|
||||
test: window.QUnit.test,
|
||||
skip: window.QUnit.skip,
|
||||
module: window.QUnit.module,
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
acceptance("About");
|
||||
|
||||
QUnit.test("viewing", async (assert) => {
|
||||
test("viewing", async (assert) => {
|
||||
await visit("/about");
|
||||
|
||||
assert.ok($("body.about-page").length, "has body class");
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
acceptance("Account Created");
|
||||
|
||||
QUnit.test("account created - message", async (assert) => {
|
||||
test("account created - message", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
});
|
||||
|
@ -18,7 +19,7 @@ QUnit.test("account created - message", async (assert) => {
|
|||
assert.notOk(exists(".activation-controls"));
|
||||
});
|
||||
|
||||
QUnit.test("account created - resend email", async (assert) => {
|
||||
test("account created - resend email", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
username: "eviltrout",
|
||||
|
@ -42,7 +43,7 @@ QUnit.test("account created - resend email", async (assert) => {
|
|||
assert.equal(email, "eviltrout@example.com");
|
||||
});
|
||||
|
||||
QUnit.test("account created - update email - cancel", async (assert) => {
|
||||
test("account created - update email - cancel", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
username: "eviltrout",
|
||||
|
@ -62,7 +63,7 @@ QUnit.test("account created - update email - cancel", async (assert) => {
|
|||
assert.equal(currentPath(), "account-created.index");
|
||||
});
|
||||
|
||||
QUnit.test("account created - update email - submit", async (assert) => {
|
||||
test("account created - update email - submit", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
username: "eviltrout",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
|
||||
|
@ -16,7 +17,7 @@ Hello, this is a test!
|
|||
|
||||
This part should be elided.`.trim();
|
||||
|
||||
QUnit.test("shows selected and elided text", async (assert) => {
|
||||
test("shows selected and elided text", async (assert) => {
|
||||
pretender.post("/admin/email/advanced-test", () => {
|
||||
return [
|
||||
200,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { skip } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
acceptance("Admin - Search Log Term", { loggedIn: true });
|
||||
|
||||
QUnit.skip("show search log term details", async (assert) => {
|
||||
skip("show search log term details", async (assert) => {
|
||||
await visit("/admin/logs/search_logs/term?term=ruby");
|
||||
|
||||
assert.ok($("div.search-logs-filter").length, "has the search type filter");
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { skip } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
acceptance("Admin - Search Logs", { loggedIn: true });
|
||||
|
||||
QUnit.skip("show search logs", async (assert) => {
|
||||
skip("show search logs", async (assert) => {
|
||||
await visit("/admin/logs/search_logs");
|
||||
|
||||
assert.ok($("table.search-logs-list.grid").length, "has the div class");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import siteSettingFixture from "discourse/tests/fixtures/site-settings";
|
||||
|
||||
|
@ -29,7 +30,7 @@ acceptance("Admin - Site Settings", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("upload site setting", async (assert) => {
|
||||
test("upload site setting", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
|
||||
assert.ok(
|
||||
|
@ -40,7 +41,7 @@ QUnit.test("upload site setting", async (assert) => {
|
|||
assert.ok(exists(".row.setting.upload .undo"), "undo button is present");
|
||||
});
|
||||
|
||||
QUnit.test("changing value updates dirty state", async (assert) => {
|
||||
test("changing value updates dirty state", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
await fillIn("#setting-filter", " title ");
|
||||
assert.equal(count(".row.setting"), 1, "filter returns 1 site setting");
|
||||
|
@ -87,24 +88,21 @@ QUnit.test("changing value updates dirty state", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"always shows filtered site settings if a filter is set",
|
||||
async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
await fillIn("#setting-filter", "title");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
test("always shows filtered site settings if a filter is set", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
await fillIn("#setting-filter", "title");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
|
||||
// navigate away to the "Dashboard" page
|
||||
await click(".nav.nav-pills li:nth-child(1) a");
|
||||
assert.equal(count(".row.setting"), 0);
|
||||
// navigate away to the "Dashboard" page
|
||||
await click(".nav.nav-pills li:nth-child(1) a");
|
||||
assert.equal(count(".row.setting"), 0);
|
||||
|
||||
// navigate back to the "Settings" page
|
||||
await click(".nav.nav-pills li:nth-child(2) a");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
}
|
||||
);
|
||||
// navigate back to the "Settings" page
|
||||
await click(".nav.nav-pills li:nth-child(2) a");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
});
|
||||
|
||||
QUnit.test("filter settings by plugin name", async (assert) => {
|
||||
test("filter settings by plugin name", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
|
||||
await fillIn("#setting-filter", "plugin:discourse-logo");
|
||||
|
@ -115,12 +113,12 @@ QUnit.test("filter settings by plugin name", async (assert) => {
|
|||
assert.equal(count(".row.setting"), 0);
|
||||
});
|
||||
|
||||
QUnit.test("category name is preserved", async (assert) => {
|
||||
test("category name is preserved", async (assert) => {
|
||||
await visit("admin/site_settings/category/basic?filter=menu");
|
||||
assert.equal(currentURL(), "admin/site_settings/category/basic?filter=menu");
|
||||
});
|
||||
|
||||
QUnit.test("shows all_results if current category has none", async (assert) => {
|
||||
test("shows all_results if current category has none", async (assert) => {
|
||||
await visit("admin/site_settings");
|
||||
|
||||
await click(".admin-nav .basic a");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - Site Texts", { loggedIn: true });
|
||||
|
||||
QUnit.test("search for a key", async (assert) => {
|
||||
test("search for a key", async (assert) => {
|
||||
await visit("/admin/customize/site_texts");
|
||||
|
||||
await fillIn(".site-text-search", "Test");
|
||||
|
@ -23,7 +24,7 @@ QUnit.test("search for a key", async (assert) => {
|
|||
assert.ok(exists(".site-text.overridden"));
|
||||
});
|
||||
|
||||
QUnit.test("edit and revert a site text by key", async (assert) => {
|
||||
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");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -23,7 +24,7 @@ acceptance("Admin - Suspend User", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("suspend a user - cancel", async (assert) => {
|
||||
test("suspend a user - cancel", async (assert) => {
|
||||
await visit("/admin/users/1234/regular");
|
||||
await click(".suspend-user");
|
||||
|
||||
|
@ -34,7 +35,7 @@ QUnit.test("suspend a user - cancel", async (assert) => {
|
|||
assert.equal(find(".suspend-user-modal:visible").length, 0);
|
||||
});
|
||||
|
||||
QUnit.test("suspend a user - cancel with input", async (assert) => {
|
||||
test("suspend a user - cancel with input", async (assert) => {
|
||||
await visit("/admin/users/1234/regular");
|
||||
await click(".suspend-user");
|
||||
|
||||
|
@ -61,7 +62,7 @@ QUnit.test("suspend a user - cancel with input", async (assert) => {
|
|||
assert.equal(find(".bootbox.modal:visible").length, 0);
|
||||
});
|
||||
|
||||
QUnit.test("suspend, then unsuspend a user", async (assert) => {
|
||||
test("suspend, then unsuspend a user", async (assert) => {
|
||||
const suspendUntilCombobox = selectKit(".suspend-until .combobox");
|
||||
|
||||
await visit("/admin/flags/active");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - Users Badges", { loggedIn: true });
|
||||
|
||||
QUnit.test("lists badges", async (assert) => {
|
||||
test("lists badges", async (assert) => {
|
||||
await visit("/admin/users/1/eviltrout/badges");
|
||||
|
||||
assert.ok(exists(`span[data-badge-name="Badge 8"]`));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -31,13 +32,13 @@ const assertMultipleSecondary = (assert, firstEmail, secondEmail) => {
|
|||
);
|
||||
};
|
||||
|
||||
QUnit.test("viewing self without secondary emails", async (assert) => {
|
||||
test("viewing self without secondary emails", async (assert) => {
|
||||
await visit("/admin/users/1/eviltrout");
|
||||
|
||||
assertNoSecondary(assert);
|
||||
});
|
||||
|
||||
QUnit.test("viewing self with multiple secondary emails", async (assert) => {
|
||||
test("viewing self with multiple secondary emails", async (assert) => {
|
||||
await visit("/admin/users/3/markvanlan");
|
||||
|
||||
assert.equal(
|
||||
|
@ -53,14 +54,14 @@ QUnit.test("viewing self with multiple secondary emails", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("viewing another user with no secondary email", async (assert) => {
|
||||
test("viewing another user with no secondary email", async (assert) => {
|
||||
await visit("/admin/users/1234/regular");
|
||||
await click(`.display-row.secondary-emails button`);
|
||||
|
||||
assertNoSecondary(assert);
|
||||
});
|
||||
|
||||
QUnit.test("viewing another account with secondary emails", async (assert) => {
|
||||
test("viewing another account with secondary emails", async (assert) => {
|
||||
await visit("/admin/users/1235/regular1");
|
||||
await click(`.display-row.secondary-emails button`);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
|
@ -34,7 +35,7 @@ acceptance("Admin - User Index", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("can edit username", async (assert) => {
|
||||
test("can edit username", async (assert) => {
|
||||
pretender.put("/users/sam/preferences/username", () => [
|
||||
200,
|
||||
{
|
||||
|
@ -60,7 +61,7 @@ QUnit.test("can edit username", async (assert) => {
|
|||
assert.equal(find(".display-row.username .value").text().trim(), "new-sam");
|
||||
});
|
||||
|
||||
QUnit.test("will clear unsaved groups when switching user", async (assert) => {
|
||||
test("will clear unsaved groups when switching user", async (assert) => {
|
||||
await visit("/admin/users/2/sam");
|
||||
|
||||
assert.equal(
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - Users List", { loggedIn: true });
|
||||
|
||||
QUnit.test("lists users", async (assert) => {
|
||||
test("lists users", async (assert) => {
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.ok(exists(".users-list .user"));
|
||||
assert.ok(!exists(".user:eq(0) .email small"), "escapes email");
|
||||
});
|
||||
|
||||
QUnit.test("sorts users", async (assert) => {
|
||||
test("sorts users", async (assert) => {
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.ok(exists(".users-list .user"));
|
||||
|
@ -34,7 +35,7 @@ QUnit.test("sorts users", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("toggles email visibility", async (assert) => {
|
||||
test("toggles email visibility", async (assert) => {
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.ok(exists(".users-list .user"));
|
||||
|
@ -56,7 +57,7 @@ QUnit.test("toggles email visibility", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("switching tabs", async (assert) => {
|
||||
test("switching tabs", async (assert) => {
|
||||
const activeUser = "eviltrout";
|
||||
const suspectUser = "sam";
|
||||
const activeTitle = I18n.t("admin.users.titles.active");
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
acceptance("Admin - Watched Words", { loggedIn: true });
|
||||
|
||||
QUnit.test("list words in groups", async (assert) => {
|
||||
test("list words in groups", async (assert) => {
|
||||
await visit("/admin/logs/watched_words/action/block");
|
||||
|
||||
assert.ok(exists(".watched-words-list"));
|
||||
|
@ -38,7 +39,7 @@ QUnit.test("list words in groups", async (assert) => {
|
|||
assert.ok(!exists(".watched-words-list .watched-word"), "Empty word list.");
|
||||
});
|
||||
|
||||
QUnit.test("add words", async (assert) => {
|
||||
test("add words", async (assert) => {
|
||||
await visit("/admin/logs/watched_words/action/block");
|
||||
|
||||
click(".show-words-checkbox");
|
||||
|
@ -55,7 +56,7 @@ QUnit.test("add words", async (assert) => {
|
|||
assert.equal(found.length, 1);
|
||||
});
|
||||
|
||||
QUnit.test("remove words", async (assert) => {
|
||||
test("remove words", async (assert) => {
|
||||
await visit("/admin/logs/watched_words/action/block");
|
||||
await click(".show-words-checkbox");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
acceptance("Auth Complete", {
|
||||
beforeEach() {
|
||||
|
@ -16,7 +17,7 @@ acceptance("Auth Complete", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("when login not required", async (assert) => {
|
||||
test("when login not required", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
assert.equal(currentPath(), "discovery.latest", "it stays on the homepage");
|
||||
|
@ -27,7 +28,7 @@ QUnit.test("when login not required", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("when login required", async function (assert) {
|
||||
test("when login required", async function (assert) {
|
||||
this.siteSettings.login_required = true;
|
||||
await visit("/");
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Badges", { loggedIn: true });
|
||||
|
||||
QUnit.test("Visit Badge Pages", async (assert) => {
|
||||
test("Visit Badge Pages", async (assert) => {
|
||||
await visit("/badges");
|
||||
|
||||
assert.ok($("body.badges-page").length, "has body class");
|
||||
|
@ -16,7 +17,7 @@ QUnit.test("Visit Badge Pages", async (assert) => {
|
|||
assert.ok(!exists(".badge-card:eq(0) script"));
|
||||
});
|
||||
|
||||
QUnit.test("shows correct badge titles to choose from", async (assert) => {
|
||||
test("shows correct badge titles to choose from", async (assert) => {
|
||||
const availableBadgeTitles = selectKit(".select-kit");
|
||||
await visit("/badges/50/custombadge");
|
||||
await availableBadgeTitles.expand();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { skip } from "qunit";
|
||||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
|
@ -236,25 +238,22 @@ acceptance("Bookmarking - Mobile", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.skip(
|
||||
"Editing a bookmark that has a Later Today reminder, and it is before 6pm today",
|
||||
async (assert) => {
|
||||
await acceptanceUseFakeClock("2020-05-04T13:00:00", async () => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
await fillIn("input#bookmark-name", "Test name");
|
||||
await click("#tap_tile_later_today");
|
||||
await openEditBookmarkModal();
|
||||
assert.not(
|
||||
exists("#bookmark-custom-date > input"),
|
||||
"it does not show the custom date input"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#tap_tile_later_today.active"),
|
||||
"it preselects Later Today"
|
||||
);
|
||||
assert.verifySteps(["later_today"]);
|
||||
});
|
||||
}
|
||||
);
|
||||
skip("Editing a bookmark that has a Later Today reminder, and it is before 6pm today", async (assert) => {
|
||||
await acceptanceUseFakeClock("2020-05-04T13:00:00", async () => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
await fillIn("input#bookmark-name", "Test name");
|
||||
await click("#tap_tile_later_today");
|
||||
await openEditBookmarkModal();
|
||||
assert.not(
|
||||
exists("#bookmark-custom-date > input"),
|
||||
"it does not show the custom date input"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#tap_tile_later_today.active"),
|
||||
"it preselects Later Today"
|
||||
);
|
||||
assert.verifySteps(["later_today"]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import DiscoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
||||
|
||||
|
@ -35,7 +36,7 @@ acceptance("Category Banners", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Does not display category banners when not set", async (assert) => {
|
||||
test("Does not display category banners when not set", async (assert) => {
|
||||
await visit("/c/test-read-only-without-banner");
|
||||
|
||||
await click("#create-topic");
|
||||
|
@ -46,7 +47,7 @@ QUnit.test("Does not display category banners when not set", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Displays category banners when set", async (assert) => {
|
||||
test("Displays category banners when set", async (assert) => {
|
||||
await visit("/c/test-read-only-with-banner");
|
||||
|
||||
await click("#create-topic");
|
||||
|
@ -84,7 +85,7 @@ acceptance("Anonymous Category Banners", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Does not display category banners when set", async (assert) => {
|
||||
test("Does not display category banners when set", async (assert) => {
|
||||
await visit("/c/test-read-only-with-banner");
|
||||
assert.ok(
|
||||
!visible(".category-read-only-banner"),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -8,7 +9,7 @@ acceptance("CategoryChooser", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("does not display uncategorized if not allowed", async (assert) => {
|
||||
test("does not display uncategorized if not allowed", async (assert) => {
|
||||
const categoryChooser = selectKit(".category-chooser");
|
||||
|
||||
await visit("/");
|
||||
|
@ -19,13 +20,13 @@ QUnit.test("does not display uncategorized if not allowed", async (assert) => {
|
|||
assert.ok(categoryChooser.rowByIndex(0).name() !== "uncategorized");
|
||||
});
|
||||
|
||||
QUnit.test("prefill category when category_id is set", async (assert) => {
|
||||
test("prefill category when category_id is set", async (assert) => {
|
||||
await visit("/new-topic?category_id=1");
|
||||
|
||||
assert.equal(selectKit(".category-chooser").header().value(), 1);
|
||||
});
|
||||
|
||||
QUnit.test("filter is case insensitive", async (assert) => {
|
||||
test("filter is case insensitive", async (assert) => {
|
||||
const categoryChooser = selectKit(".category-chooser");
|
||||
|
||||
await visit("/");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -5,7 +6,7 @@ acceptance("Category Edit - security", {
|
|||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("default", async (assert) => {
|
||||
test("default", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
|
@ -20,7 +21,7 @@ QUnit.test("default", async (assert) => {
|
|||
assert.equal(permission, "Create / Reply / See");
|
||||
});
|
||||
|
||||
QUnit.test("removing a permission", async (assert) => {
|
||||
test("removing a permission", async (assert) => {
|
||||
const availableGroups = selectKit(".available-groups");
|
||||
|
||||
await visit("/c/bug");
|
||||
|
@ -46,7 +47,7 @@ QUnit.test("removing a permission", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("adding a permission", async (assert) => {
|
||||
test("adding a permission", async (assert) => {
|
||||
const availableGroups = selectKit(".available-groups");
|
||||
const permissionSelector = selectKit(".permission-selector");
|
||||
|
||||
|
@ -72,7 +73,7 @@ QUnit.test("adding a permission", async (assert) => {
|
|||
assert.equal(permission, "Reply / See");
|
||||
});
|
||||
|
||||
QUnit.test("adding a previously removed permission", async (assert) => {
|
||||
test("adding a previously removed permission", async (assert) => {
|
||||
const availableGroups = selectKit(".available-groups");
|
||||
|
||||
await visit("/c/bug");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { skip } from "qunit";
|
||||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -7,7 +9,7 @@ acceptance("Category Edit", {
|
|||
settings: { email_in: true },
|
||||
});
|
||||
|
||||
QUnit.test("Can open the category modal", async (assert) => {
|
||||
test("Can open the category modal", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
|
@ -17,7 +19,7 @@ QUnit.test("Can open the category modal", async (assert) => {
|
|||
assert.ok(!visible(".d-modal"), "it closes the modal");
|
||||
});
|
||||
|
||||
QUnit.test("Editing the category", async (assert) => {
|
||||
test("Editing the category", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
|
@ -46,7 +48,7 @@ QUnit.test("Editing the category", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.skip("Edit the description without loosing progress", async (assert) => {
|
||||
skip("Edit the description without loosing progress", async (assert) => {
|
||||
let win = { focus: function () {} };
|
||||
let windowOpen = sandbox.stub(window, "open").returns(win);
|
||||
sandbox.stub(win, "focus");
|
||||
|
@ -61,7 +63,7 @@ QUnit.skip("Edit the description without loosing progress", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Error Saving", async (assert) => {
|
||||
test("Error Saving", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
|
@ -72,7 +74,7 @@ QUnit.test("Error Saving", async (assert) => {
|
|||
assert.equal(find("#modal-alert").html(), "duplicate email");
|
||||
});
|
||||
|
||||
QUnit.test("Subcategory list settings", async (assert) => {
|
||||
test("Subcategory list settings", async (assert) => {
|
||||
const categoryChooser = selectKit(
|
||||
".edit-category-tab-general .category-chooser"
|
||||
);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { test } from "qunit";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Click Track", {});
|
||||
|
||||
QUnit.test("Do not track mentions", async (assert) => {
|
||||
test("Do not track mentions", async (assert) => {
|
||||
pretender.post("/clicks/track", () => assert.ok(false));
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
|
@ -19,25 +20,22 @@ acceptance("Composer Actions", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"creating new topic and then reply_as_private_message keeps attributes",
|
||||
async (assert) => {
|
||||
await visit("/");
|
||||
await click("button#create-topic");
|
||||
test("creating new topic and then reply_as_private_message keeps attributes", async (assert) => {
|
||||
await visit("/");
|
||||
await click("button#create-topic");
|
||||
|
||||
await fillIn("#reply-title", "this is the title");
|
||||
await fillIn(".d-editor-input", "this is the reply");
|
||||
await fillIn("#reply-title", "this is the title");
|
||||
await fillIn(".d-editor-input", "this is the reply");
|
||||
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("reply_as_private_message");
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("reply_as_private_message");
|
||||
|
||||
assert.ok(find("#reply-title").val(), "this is the title");
|
||||
assert.ok(find(".d-editor-input").val(), "this is the reply");
|
||||
}
|
||||
);
|
||||
assert.ok(find("#reply-title").val(), "this is the title");
|
||||
assert.ok(find(".d-editor-input").val(), "this is the reply");
|
||||
});
|
||||
|
||||
QUnit.test("replying to post", async (assert) => {
|
||||
test("replying to post", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
@ -55,7 +53,7 @@ QUnit.test("replying to post", async (assert) => {
|
|||
assert.equal(composerActions.rowByIndex(5).value(), undefined);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_as_private_message", async (assert) => {
|
||||
test("replying to post - reply_as_private_message", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
@ -70,7 +68,7 @@ QUnit.test("replying to post - reply_as_private_message", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_to_topic", async (assert) => {
|
||||
test("replying to post - reply_to_topic", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
@ -97,7 +95,7 @@ QUnit.test("replying to post - reply_to_topic", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - toggle_whisper", async (assert) => {
|
||||
test("replying to post - toggle_whisper", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
@ -115,7 +113,7 @@ QUnit.test("replying to post - toggle_whisper", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_as_new_topic", async (assert) => {
|
||||
test("replying to post - reply_as_new_topic", async (assert) => {
|
||||
sandbox
|
||||
.stub(Draft, "get")
|
||||
.returns(Promise.resolve({ draft: "", draft_sequence: 0 }));
|
||||
|
@ -146,7 +144,7 @@ QUnit.test("replying to post - reply_as_new_topic", async (assert) => {
|
|||
sandbox.restore();
|
||||
});
|
||||
|
||||
QUnit.test("reply_as_new_topic without a new_topic draft", async (assert) => {
|
||||
test("reply_as_new_topic without a new_topic draft", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".create.reply");
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
@ -155,7 +153,7 @@ QUnit.test("reply_as_new_topic without a new_topic draft", async (assert) => {
|
|||
assert.equal(exists(find(".bootbox")), false);
|
||||
});
|
||||
|
||||
QUnit.test("reply_as_new_group_message", async (assert) => {
|
||||
test("reply_as_new_group_message", async (assert) => {
|
||||
// eslint-disable-next-line
|
||||
server.get("/t/130.json", () => {
|
||||
return [
|
||||
|
@ -408,7 +406,7 @@ QUnit.test("reply_as_new_group_message", async (assert) => {
|
|||
assert.deepEqual(items, ["foo", "foo_group"]);
|
||||
});
|
||||
|
||||
QUnit.test("hide component if no content", async (assert) => {
|
||||
test("hide component if no content", async (assert) => {
|
||||
await visit("/");
|
||||
await click("button#create-topic");
|
||||
|
||||
|
@ -424,7 +422,7 @@ QUnit.test("hide component if no content", async (assert) => {
|
|||
assert.equal(composerActions.rows().length, 2);
|
||||
});
|
||||
|
||||
QUnit.test("interactions", async (assert) => {
|
||||
test("interactions", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
const quote = "Life is like riding a bicycle.";
|
||||
|
||||
|
@ -501,7 +499,7 @@ QUnit.test("interactions", async (assert) => {
|
|||
assert.equal(composerActions.rows().length, 3);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - toggle_topic_bump", async (assert) => {
|
||||
test("replying to post - toggle_topic_bump", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
@ -529,7 +527,7 @@ QUnit.test("replying to post - toggle_topic_bump", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as staff", async (assert) => {
|
||||
test("replying to post as staff", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
updateCurrentUser({ admin: true });
|
||||
|
@ -541,7 +539,7 @@ QUnit.test("replying to post as staff", async (assert) => {
|
|||
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as TL3 user", async (assert) => {
|
||||
test("replying to post as TL3 user", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 3 });
|
||||
|
@ -559,7 +557,7 @@ QUnit.test("replying to post as TL3 user", async (assert) => {
|
|||
});
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as TL4 user", async (assert) => {
|
||||
test("replying to post as TL4 user", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 4 });
|
||||
|
@ -571,25 +569,22 @@ QUnit.test("replying to post as TL4 user", async (assert) => {
|
|||
assert.equal(composerActions.rowByIndex(3).value(), "toggle_topic_bump");
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"replying to first post - reply_as_private_message",
|
||||
async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
test("replying to first post - reply_as_private_message", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("article#post_1 button.reply");
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("article#post_1 button.reply");
|
||||
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("reply_as_private_message");
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("reply_as_private_message");
|
||||
|
||||
assert.equal(find(".users-input .item:eq(0)").text(), "uwe_keim");
|
||||
assert.ok(
|
||||
find(".d-editor-input").val().indexOf("Continuing the discussion") >= 0
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(find(".users-input .item:eq(0)").text(), "uwe_keim");
|
||||
assert.ok(
|
||||
find(".d-editor-input").val().indexOf("Continuing the discussion") >= 0
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("editing post", async (assert) => {
|
||||
test("editing post", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
@ -627,7 +622,7 @@ const stubDraftResponse = () => {
|
|||
);
|
||||
};
|
||||
|
||||
QUnit.test("shared draft", async (assert) => {
|
||||
test("shared draft", async (assert) => {
|
||||
stubDraftResponse();
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
@ -669,7 +664,7 @@ QUnit.test("shared draft", async (assert) => {
|
|||
sandbox.restore();
|
||||
});
|
||||
|
||||
QUnit.test("reply_as_new_topic with new_topic draft", async (assert) => {
|
||||
test("reply_as_new_topic with new_topic draft", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".create.reply");
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
function setupPretender(server, helper) {
|
||||
|
@ -33,7 +34,7 @@ acceptance("Composer Attachment", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("attachments are cooked properly", async (assert) => {
|
||||
test("attachments are cooked properly", async (assert) => {
|
||||
await writeInComposer(assert);
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
|
@ -51,13 +52,10 @@ acceptance("Composer Attachment - Secure Media Enabled", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"attachments are cooked properly when secure media is enabled",
|
||||
async (assert) => {
|
||||
await writeInComposer(assert);
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
'<p><a class="attachment" href="/secure-media-uploads/default/3X/1/asjdiasjdiasida.png">test</a></p>'
|
||||
);
|
||||
}
|
||||
);
|
||||
test("attachments are cooked properly when secure media is enabled", async (assert) => {
|
||||
await writeInComposer(assert);
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
'<p><a class="attachment" href="/secure-media-uploads/default/3X/1/asjdiasjdiasida.png">test</a></p>'
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
|
@ -6,7 +7,7 @@ acceptance("Composer - Edit conflict", {
|
|||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("Edit a post that causes an edit conflict", async (assert) => {
|
||||
test("Edit a post that causes an edit conflict", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
|
@ -47,21 +48,18 @@ function handleDraftPretender(assert) {
|
|||
});
|
||||
}
|
||||
|
||||
QUnit.test(
|
||||
"Should not send originalText when posting a new reply",
|
||||
async (assert) => {
|
||||
handleDraftPretender(assert);
|
||||
test("Should not send originalText when posting a new reply", async (assert) => {
|
||||
handleDraftPretender(assert);
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
"hello world hello world hello world hello world hello world"
|
||||
);
|
||||
}
|
||||
);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
"hello world hello world hello world hello world hello world"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Should send originalText when editing a reply", async (assert) => {
|
||||
test("Should send originalText when editing a reply", async (assert) => {
|
||||
handleDraftPretender(assert);
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer - Hyperlink", {
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("add a hyperlink to a reply", async (assert) => {
|
||||
test("add a hyperlink to a reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:first-child button.reply");
|
||||
await fillIn(".d-editor-input", "This is a link to ");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer - Onebox", {
|
||||
|
@ -8,15 +9,13 @@ acceptance("Composer - Onebox", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Preview update should respect max_oneboxes_per_post site setting",
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
test("Preview update should respect max_oneboxes_per_post site setting", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
`
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
`
|
||||
http://www.example.com/has-title.html
|
||||
This is another test http://www.example.com/has-title.html
|
||||
|
||||
|
@ -27,11 +26,11 @@ This is another test http://www.example.com/has-title.html
|
|||
|
||||
http://www.example.com/has-title.html
|
||||
`
|
||||
);
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
`
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
`
|
||||
<p><aside class=\"onebox\"><article class=\"onebox-body\"><h3><a href=\"http://www.example.com/article.html\">An interesting article</a></h3></article></aside><br>
|
||||
This is another test <a href=\"http://www.example.com/has-title.html\" class=\"inline-onebox\">This is a great title</a></p>
|
||||
<p><a href=\"http://www.example.com/no-title.html\" class=\"onebox\" target=\"_blank\">http://www.example.com/no-title.html</a></p>
|
||||
|
@ -39,6 +38,5 @@ This is another test <a href=\"http://www.example.com/has-title.html\" class=\"i
|
|||
This is another test <a href=\"http://www.example.com/has-title.html\" class=\"inline-onebox\">This is a great title</a></p>
|
||||
<p><aside class=\"onebox\"><article class=\"onebox-body\"><h3><a href=\"http://www.example.com/article.html\">An interesting article</a></h3></article></aside></p>
|
||||
`.trim()
|
||||
);
|
||||
}
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import Category from "discourse/models/category";
|
||||
import {
|
||||
acceptance,
|
||||
|
@ -17,7 +18,7 @@ acceptance("Composer - Tags", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("staff bypass tag validation rule", async (assert) => {
|
||||
test("staff bypass tag validation rule", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
|
@ -34,7 +35,7 @@ QUnit.test("staff bypass tag validation rule", async (assert) => {
|
|||
assert.notEqual(currentURL(), "/");
|
||||
});
|
||||
|
||||
QUnit.test("users do not bypass tag validation rule", async (assert) => {
|
||||
test("users do not bypass tag validation rule", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { skip } from "qunit";
|
||||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { run } from "@ember/runloop";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
@ -18,7 +20,7 @@ acceptance("Composer", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.skip("Tests the Composer controls", async (assert) => {
|
||||
skip("Tests the Composer controls", async (assert) => {
|
||||
await visit("/");
|
||||
assert.ok(exists("#create-topic"), "the create button is visible");
|
||||
|
||||
|
@ -96,7 +98,7 @@ QUnit.skip("Tests the Composer controls", async (assert) => {
|
|||
assert.ok(!exists(".bootbox.modal"), "the confirmation can be cancelled");
|
||||
});
|
||||
|
||||
QUnit.test("Composer upload placeholder", async (assert) => {
|
||||
test("Composer upload placeholder", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
|
@ -189,7 +191,7 @@ QUnit.test("Composer upload placeholder", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create a topic with server side errors", async (assert) => {
|
||||
test("Create a topic with server side errors", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "this title triggers an error");
|
||||
|
@ -201,7 +203,7 @@ QUnit.test("Create a topic with server side errors", async (assert) => {
|
|||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
});
|
||||
|
||||
QUnit.test("Create a Topic", async (assert) => {
|
||||
test("Create a Topic", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "Internationalization Localization");
|
||||
|
@ -214,7 +216,7 @@ QUnit.test("Create a Topic", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create an enqueued Topic", async (assert) => {
|
||||
test("Create an enqueued Topic", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "Internationalization Localization");
|
||||
|
@ -227,7 +229,7 @@ QUnit.test("Create an enqueued Topic", async (assert) => {
|
|||
assert.ok(invisible(".d-modal"), "the modal can be dismissed");
|
||||
});
|
||||
|
||||
QUnit.test("Can display a message and route to a URL", async (assert) => {
|
||||
test("Can display a message and route to a URL", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "This title doesn't matter");
|
||||
|
@ -247,7 +249,7 @@ QUnit.test("Can display a message and route to a URL", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create a Reply", async (assert) => {
|
||||
test("Create a Reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
|
@ -267,7 +269,7 @@ QUnit.test("Create a Reply", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Can edit a post after starting a reply", async (assert) => {
|
||||
test("Can edit a post after starting a reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click("#topic-footer-buttons .create");
|
||||
|
@ -285,7 +287,7 @@ QUnit.test("Can edit a post after starting a reply", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Posting on a different topic", async (assert) => {
|
||||
test("Posting on a different topic", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await fillIn(".d-editor-input", "this is the content for a different topic");
|
||||
|
@ -302,7 +304,7 @@ QUnit.test("Posting on a different topic", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create an enqueued Reply", async (assert) => {
|
||||
test("Create an enqueued Reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.notOk(find(".pending-posts .reviewable-item").length);
|
||||
|
@ -326,7 +328,7 @@ QUnit.test("Create an enqueued Reply", async (assert) => {
|
|||
assert.ok(find(".pending-posts .reviewable-item").length);
|
||||
});
|
||||
|
||||
QUnit.test("Edit the first post", async (assert) => {
|
||||
test("Edit the first post", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
|
@ -364,7 +366,7 @@ QUnit.test("Edit the first post", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Composer can switch between edits", async (assert) => {
|
||||
test("Composer can switch between edits", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
|
@ -381,26 +383,23 @@ QUnit.test("Composer can switch between edits", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Composer with dirty edit can toggle to another edit",
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
test("Composer with dirty edit can toggle to another edit", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".topic-post:eq(1) button.edit");
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".topic-post:eq(1) button.edit");
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
}
|
||||
);
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Composer can toggle between edit and reply", async (assert) => {
|
||||
test("Composer can toggle between edit and reply", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
|
@ -419,7 +418,7 @@ QUnit.test("Composer can toggle between edit and reply", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Composer can toggle whispers", async (assert) => {
|
||||
test("Composer can toggle whispers", async (assert) => {
|
||||
const menu = selectKit(".toolbar-popup-menu-options");
|
||||
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
@ -454,98 +453,91 @@ QUnit.test("Composer can toggle whispers", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Composer can toggle layouts (open, fullscreen and draft)",
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
test("Composer can toggle layouts (open, fullscreen and draft)", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
|
||||
assert.ok(
|
||||
find("#reply-control.open").length === 1,
|
||||
"it starts in open state by default"
|
||||
);
|
||||
assert.ok(
|
||||
find("#reply-control.open").length === 1,
|
||||
"it starts in open state by default"
|
||||
);
|
||||
|
||||
await click(".toggle-fullscreen");
|
||||
await click(".toggle-fullscreen");
|
||||
|
||||
assert.ok(
|
||||
find("#reply-control.fullscreen").length === 1,
|
||||
"it expands composer to full screen"
|
||||
);
|
||||
assert.ok(
|
||||
find("#reply-control.fullscreen").length === 1,
|
||||
"it expands composer to full screen"
|
||||
);
|
||||
|
||||
await click(".toggle-fullscreen");
|
||||
await click(".toggle-fullscreen");
|
||||
|
||||
assert.ok(
|
||||
find("#reply-control.open").length === 1,
|
||||
"it collapses composer to regular size"
|
||||
);
|
||||
assert.ok(
|
||||
find("#reply-control.open").length === 1,
|
||||
"it collapses composer to regular size"
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".toggler");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".toggler");
|
||||
|
||||
assert.ok(
|
||||
find("#reply-control.draft").length === 1,
|
||||
"it collapses composer to draft bar"
|
||||
);
|
||||
assert.ok(
|
||||
find("#reply-control.draft").length === 1,
|
||||
"it collapses composer to draft bar"
|
||||
);
|
||||
|
||||
await click(".toggle-fullscreen");
|
||||
await click(".toggle-fullscreen");
|
||||
|
||||
assert.ok(
|
||||
find("#reply-control.open").length === 1,
|
||||
"from draft, it expands composer back to open state"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.ok(
|
||||
find("#reply-control.open").length === 1,
|
||||
"from draft, it expands composer back to open state"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Composer can toggle between reply and createTopic",
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
test("Composer can toggle between reply and createTopic", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
|
||||
await selectKit(".toolbar-popup-menu-options").expand();
|
||||
await selectKit(".toolbar-popup-menu-options").selectRowByValue(
|
||||
"toggleWhisper"
|
||||
);
|
||||
await selectKit(".toolbar-popup-menu-options").expand();
|
||||
await selectKit(".toolbar-popup-menu-options").selectRowByValue(
|
||||
"toggleWhisper"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find(".composer-fields .whisper .d-icon-far-eye-slash").length === 1,
|
||||
"it sets the post type to whisper"
|
||||
);
|
||||
assert.ok(
|
||||
find(".composer-fields .whisper .d-icon-far-eye-slash").length === 1,
|
||||
"it sets the post type to whisper"
|
||||
);
|
||||
|
||||
await visit("/");
|
||||
assert.ok(exists("#create-topic"), "the create topic button is visible");
|
||||
await visit("/");
|
||||
assert.ok(exists("#create-topic"), "the create topic button is visible");
|
||||
|
||||
await click("#create-topic");
|
||||
assert.ok(
|
||||
find(".composer-fields .whisper .d-icon-far-eye-slash").length === 0,
|
||||
"it should reset the state of the composer's model"
|
||||
);
|
||||
await click("#create-topic");
|
||||
assert.ok(
|
||||
find(".composer-fields .whisper .d-icon-far-eye-slash").length === 0,
|
||||
"it should reset the state of the composer's model"
|
||||
);
|
||||
|
||||
await selectKit(".toolbar-popup-menu-options").expand();
|
||||
await selectKit(".toolbar-popup-menu-options").selectRowByValue(
|
||||
"toggleInvisible"
|
||||
);
|
||||
await selectKit(".toolbar-popup-menu-options").expand();
|
||||
await selectKit(".toolbar-popup-menu-options").selectRowByValue(
|
||||
"toggleInvisible"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find(".composer-fields .unlist")
|
||||
.text()
|
||||
.indexOf(I18n.t("composer.unlist")) > 0,
|
||||
"it sets the topic to unlisted"
|
||||
);
|
||||
assert.ok(
|
||||
find(".composer-fields .unlist").text().indexOf(I18n.t("composer.unlist")) >
|
||||
0,
|
||||
"it sets the topic to unlisted"
|
||||
);
|
||||
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
assert.ok(
|
||||
find(".composer-fields .whisper")
|
||||
.text()
|
||||
.indexOf(I18n.t("composer.unlist")) === -1,
|
||||
"it should reset the state of the composer's model"
|
||||
);
|
||||
}
|
||||
);
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
assert.ok(
|
||||
find(".composer-fields .whisper")
|
||||
.text()
|
||||
.indexOf(I18n.t("composer.unlist")) === -1,
|
||||
"it should reset the state of the composer's model"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Composer with dirty reply can toggle to edit", async (assert) => {
|
||||
test("Composer with dirty reply can toggle to edit", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
|
@ -560,55 +552,49 @@ QUnit.test("Composer with dirty reply can toggle to edit", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Composer draft with dirty reply can toggle to edit",
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
test("Composer draft with dirty reply can toggle to edit", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".toggler");
|
||||
await click(".topic-post:eq(1) button.edit");
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
assert.equal(
|
||||
find(".modal-footer a:eq(1)").text(),
|
||||
I18n.t("post.abandon.no_value")
|
||||
);
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
}
|
||||
);
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".toggler");
|
||||
await click(".topic-post:eq(1) button.edit");
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
assert.equal(
|
||||
find(".modal-footer a:eq(1)").text(),
|
||||
I18n.t("post.abandon.no_value")
|
||||
);
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Composer draft can switch to draft in new context without destroying current draft",
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
test("Composer draft can switch to draft in new context without destroying current draft", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||
|
||||
await click("#site-logo");
|
||||
await click("#create-topic");
|
||||
await click("#site-logo");
|
||||
await click("#create-topic");
|
||||
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
assert.equal(
|
||||
find(".modal-footer a:eq(1)").text(),
|
||||
I18n.t("post.abandon.no_save_draft")
|
||||
);
|
||||
await click(".modal-footer a:eq(1)");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
"",
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
assert.equal(
|
||||
find(".modal-footer a:eq(1)").text(),
|
||||
I18n.t("post.abandon.no_save_draft")
|
||||
);
|
||||
await click(".modal-footer a:eq(1)");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
"",
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Checks for existing draft", async (assert) => {
|
||||
test("Checks for existing draft", async (assert) => {
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
|
@ -625,7 +611,7 @@ QUnit.test("Checks for existing draft", async (assert) => {
|
|||
}
|
||||
});
|
||||
|
||||
QUnit.test("Can switch states without abandon popup", async (assert) => {
|
||||
test("Can switch states without abandon popup", async (assert) => {
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
|
@ -673,7 +659,7 @@ QUnit.test("Can switch states without abandon popup", async (assert) => {
|
|||
sandbox.restore();
|
||||
});
|
||||
|
||||
QUnit.test("Loading draft also replaces the recipients", async (assert) => {
|
||||
test("Loading draft also replaces the recipients", async (assert) => {
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
|
@ -695,24 +681,21 @@ QUnit.test("Loading draft also replaces the recipients", async (assert) => {
|
|||
}
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Deleting the text content of the first post in a private message",
|
||||
async (assert) => {
|
||||
await visit("/t/34");
|
||||
test("Deleting the text content of the first post in a private message", async (assert) => {
|
||||
await visit("/t/34");
|
||||
|
||||
await click("#post_1 .d-icon-ellipsis-h");
|
||||
await click("#post_1 .d-icon-ellipsis-h");
|
||||
|
||||
await click("#post_1 .d-icon-pencil-alt");
|
||||
await click("#post_1 .d-icon-pencil-alt");
|
||||
|
||||
await fillIn(".d-editor-input", "");
|
||||
await fillIn(".d-editor-input", "");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-container textarea").attr("placeholder"),
|
||||
I18n.t("composer.reply_placeholder"),
|
||||
"it should not block because of missing category"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-container textarea").attr("placeholder"),
|
||||
I18n.t("composer.reply_placeholder"),
|
||||
"it should not block because of missing category"
|
||||
);
|
||||
});
|
||||
|
||||
const assertImageResized = (assert, uploads) => {
|
||||
assert.equal(
|
||||
|
@ -722,7 +705,7 @@ const assertImageResized = (assert, uploads) => {
|
|||
);
|
||||
};
|
||||
|
||||
QUnit.test("Image resizing buttons", async (assert) => {
|
||||
test("Image resizing buttons", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
|
@ -828,7 +811,7 @@ QUnit.test("Image resizing buttons", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("can reply to a private message", async (assert) => {
|
||||
test("can reply to a private message", async (assert) => {
|
||||
let submitted;
|
||||
|
||||
/* global server */
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -12,7 +13,7 @@ acceptance("Composer topic featured links", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("onebox with title", async (assert) => {
|
||||
test("onebox with title", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
||||
|
@ -31,7 +32,7 @@ QUnit.test("onebox with title", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("onebox result doesn't include a title", async (assert) => {
|
||||
test("onebox result doesn't include a title", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/no-title.html");
|
||||
|
@ -50,7 +51,7 @@ QUnit.test("onebox result doesn't include a title", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("no onebox result", async (assert) => {
|
||||
test("no onebox result", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/nope-onebox.html");
|
||||
|
@ -69,7 +70,7 @@ QUnit.test("no onebox result", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("ignore internal links", async (assert) => {
|
||||
test("ignore internal links", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
const title = "http://" + window.location.hostname + "/internal-page.html";
|
||||
|
@ -87,7 +88,7 @@ QUnit.test("ignore internal links", async (assert) => {
|
|||
assert.equal(find(".title-input input").val(), title, "title is unchanged");
|
||||
});
|
||||
|
||||
QUnit.test("link is longer than max title length", async (assert) => {
|
||||
test("link is longer than max title length", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn(
|
||||
|
@ -109,29 +110,26 @@ QUnit.test("link is longer than max title length", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"onebox with title but extra words in title field",
|
||||
async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
|
||||
assert.equal(
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox"),
|
||||
-1,
|
||||
"onebox preview doesn't show"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().length,
|
||||
0,
|
||||
"link isn't put into the post"
|
||||
);
|
||||
assert.equal(
|
||||
find(".title-input input").val(),
|
||||
"http://www.example.com/has-title.html test",
|
||||
"title is unchanged"
|
||||
);
|
||||
}
|
||||
);
|
||||
test("onebox with title but extra words in title field", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
|
||||
assert.equal(
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox"),
|
||||
-1,
|
||||
"onebox preview doesn't show"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().length,
|
||||
0,
|
||||
"link isn't put into the post"
|
||||
);
|
||||
assert.equal(
|
||||
find(".title-input input").val(),
|
||||
"http://www.example.com/has-title.html test",
|
||||
"title is unchanged"
|
||||
);
|
||||
});
|
||||
|
||||
acceptance("Composer topic featured links when uncategorized is not allowed", {
|
||||
loggedIn: true,
|
||||
|
@ -143,7 +141,7 @@ acceptance("Composer topic featured links when uncategorized is not allowed", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Pasting a link enables the text input area", async (assert) => {
|
||||
test("Pasting a link enables the text input area", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
|
||||
await visit("/");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
acceptance,
|
||||
|
@ -15,7 +16,7 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
QUnit.test("Disable body until category is selected", async (assert) => {
|
||||
test("Disable body until category is selected", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
|
||||
await visit("/");
|
||||
|
@ -86,36 +87,33 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"Enable composer/body if no topic templates present",
|
||||
async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
test("Enable composer/body if no topic templates present", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
assert.ok(
|
||||
exists(".category-input .popup-tip.bad.hide"),
|
||||
"category errors are hidden by default"
|
||||
);
|
||||
assert.ok(
|
||||
find(".d-editor-textarea-wrapper.disabled").length === 0,
|
||||
"textarea is enabled"
|
||||
);
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
assert.ok(
|
||||
exists(".category-input .popup-tip.bad.hide"),
|
||||
"category errors are hidden by default"
|
||||
);
|
||||
assert.ok(
|
||||
find(".d-editor-textarea-wrapper.disabled").length === 0,
|
||||
"textarea is enabled"
|
||||
);
|
||||
|
||||
await click("#reply-control button.create");
|
||||
assert.ok(
|
||||
exists(".category-input .popup-tip.bad"),
|
||||
"it shows the choose a category error"
|
||||
);
|
||||
await click("#reply-control button.create");
|
||||
assert.ok(
|
||||
exists(".category-input .popup-tip.bad"),
|
||||
"it shows the choose a category error"
|
||||
);
|
||||
|
||||
const categoryChooser = selectKit(".category-chooser");
|
||||
await categoryChooser.expand();
|
||||
await categoryChooser.selectRowByValue(1);
|
||||
const categoryChooser = selectKit(".category-chooser");
|
||||
await categoryChooser.expand();
|
||||
await categoryChooser.selectRowByValue(1);
|
||||
|
||||
assert.ok(
|
||||
!exists(".category-input .popup-tip.bad"),
|
||||
"category error removed after selecting category"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.ok(
|
||||
!exists(".category-input .popup-tip.bad"),
|
||||
"category error removed after selecting category"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Create Account - external auth", {
|
||||
|
@ -19,7 +20,7 @@ acceptance("Create Account - external auth", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("when skip is disabled (default)", async (assert) => {
|
||||
test("when skip is disabled (default)", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
|
@ -30,7 +31,7 @@ QUnit.test("when skip is disabled (default)", async (assert) => {
|
|||
assert.ok(exists("#new-account-username"), "it shows the fields");
|
||||
});
|
||||
|
||||
QUnit.test("when skip is enabled", async function (assert) {
|
||||
test("when skip is enabled", async function (assert) {
|
||||
this.siteSettings.external_auth_skip_create_confirm = true;
|
||||
await visit("/");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Create Account - User Fields", {
|
||||
|
@ -25,7 +26,7 @@ acceptance("Create Account - User Fields", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("create account with user fields", async (assert) => {
|
||||
test("create account with user fields", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .sign-up-button");
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { setCustomHTML } from "discourse/helpers/custom-html";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
acceptance("CustomHTML set");
|
||||
|
||||
QUnit.test("has no custom HTML in the top", async (assert) => {
|
||||
test("has no custom HTML in the top", async (assert) => {
|
||||
await visit("/static/faq");
|
||||
assert.ok(!exists("span.custom-html-test"), "it has no markup");
|
||||
});
|
||||
|
||||
QUnit.test("renders set HTML", async (assert) => {
|
||||
test("renders set HTML", async (assert) => {
|
||||
setCustomHTML("top", '<span class="custom-html-test">HTML</span>');
|
||||
|
||||
await visit("/static/faq");
|
||||
|
@ -20,7 +21,7 @@ QUnit.test("renders set HTML", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("renders preloaded HTML", async (assert) => {
|
||||
test("renders preloaded HTML", async (assert) => {
|
||||
PreloadStore.store("customHTML", {
|
||||
top: "<span class='cookie'>monster</span>",
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("CustomHTML template", {
|
||||
|
@ -12,7 +13,7 @@ acceptance("CustomHTML template", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("renders custom template", async (assert) => {
|
||||
test("renders custom template", async (assert) => {
|
||||
await visit("/static/faq");
|
||||
assert.equal(find("span.top-span").text(), "TOP", "it inserted the template");
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -21,13 +22,13 @@ acceptance("Dashboard", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("default", async (assert) => {
|
||||
test("default", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard"), "has dashboard-next class");
|
||||
});
|
||||
|
||||
QUnit.test("tabs", async (assert) => {
|
||||
test("tabs", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
||||
|
@ -36,7 +37,7 @@ QUnit.test("tabs", async (assert) => {
|
|||
assert.ok(exists(".dashboard .navigation-item.reports"), "reports tab");
|
||||
});
|
||||
|
||||
QUnit.test("general tab", async (assert) => {
|
||||
test("general tab", async (assert) => {
|
||||
await visit("/admin");
|
||||
assert.ok(exists(".admin-report.signups"), "signups report");
|
||||
assert.ok(exists(".admin-report.posts"), "posts report");
|
||||
|
@ -59,7 +60,7 @@ QUnit.test("general tab", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("activity metrics", async (assert) => {
|
||||
test("activity metrics", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".admin-report.page-view-total-reqs .today-count"));
|
||||
|
@ -68,7 +69,7 @@ QUnit.test("activity metrics", async (assert) => {
|
|||
assert.ok(exists(".admin-report.page-view-total-reqs .thirty-days-count"));
|
||||
});
|
||||
|
||||
QUnit.test("reports tab", async (assert) => {
|
||||
test("reports tab", async (assert) => {
|
||||
await visit("/admin");
|
||||
await click(".dashboard .navigation-item.reports .navigation-link");
|
||||
|
||||
|
@ -102,7 +103,7 @@ QUnit.test("reports tab", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("reports filters", async (assert) => {
|
||||
test("reports filters", async (assert) => {
|
||||
await visit(
|
||||
'/admin/reports/signups_with_groups?end_date=2018-07-16&filters=%7B"group"%3A88%7D&start_date=2018-06-16'
|
||||
);
|
||||
|
@ -123,7 +124,7 @@ acceptance("Dashboard: dashboard_visible_tabs", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("visible tabs", async (assert) => {
|
||||
test("visible tabs", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
||||
|
@ -143,7 +144,7 @@ acceptance("Dashboard: dashboard_hidden_reports", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("hidden reports", async (assert) => {
|
||||
test("hidden reports", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".admin-report.signups.is-visible"), "signups report");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -7,7 +8,7 @@ acceptance("Email Disabled Banner", {
|
|||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("when disabled", async function (assert) {
|
||||
test("when disabled", async function (assert) {
|
||||
this.siteSettings.disable_emails = "no";
|
||||
await visit("/");
|
||||
assert.notOk(
|
||||
|
@ -16,7 +17,7 @@ QUnit.test("when disabled", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("when enabled", async function (assert) {
|
||||
test("when enabled", async function (assert) {
|
||||
this.siteSettings.disable_emails = "yes";
|
||||
await visit("/latest");
|
||||
assert.ok(
|
||||
|
@ -25,7 +26,7 @@ QUnit.test("when enabled", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("when non-staff", async function (assert) {
|
||||
test("when non-staff", async function (assert) {
|
||||
this.siteSettings.disable_emails = "non-staff";
|
||||
await visit("/");
|
||||
assert.ok(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("EmojiPicker", {
|
||||
|
@ -11,7 +12,7 @@ acceptance("EmojiPicker", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("emoji picker can be opened/closed", async (assert) => {
|
||||
test("emoji picker can be opened/closed", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
|
@ -22,7 +23,7 @@ QUnit.test("emoji picker can be opened/closed", async (assert) => {
|
|||
assert.notOk(exists(".emoji-picker.opened"), "it closes the picker");
|
||||
});
|
||||
|
||||
QUnit.test("emoji picker triggers event when picking emoji", async (assert) => {
|
||||
test("emoji picker triggers event when picking emoji", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
|
@ -35,101 +36,92 @@ QUnit.test("emoji picker triggers event when picking emoji", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"emoji picker adds leading whitespace before emoji",
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
test("emoji picker adds leading whitespace before emoji", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
// Whitespace should be added on text
|
||||
await fillIn(".d-editor-input", "This is a test input");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
"This is a test input :grinning:",
|
||||
"it adds the emoji code and a leading whitespace when there is text"
|
||||
);
|
||||
// Whitespace should be added on text
|
||||
await fillIn(".d-editor-input", "This is a test input");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
"This is a test input :grinning:",
|
||||
"it adds the emoji code and a leading whitespace when there is text"
|
||||
);
|
||||
|
||||
// Whitespace should not be added on whitespace
|
||||
await fillIn(".d-editor-input", "This is a test input ");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
// Whitespace should not be added on whitespace
|
||||
await fillIn(".d-editor-input", "This is a test input ");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
"This is a test input :grinning:",
|
||||
"it adds the emoji code and no leading whitespace when user already entered whitespace"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
"This is a test input :grinning:",
|
||||
"it adds the emoji code and no leading whitespace when user already entered whitespace"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"emoji picker has a list of recently used emojis",
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
test("emoji picker has a list of recently used emojis", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
|
||||
assert.ok(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it shows recent selected emoji"
|
||||
);
|
||||
assert.ok(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it shows recent selected emoji"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it shows recent category icon"
|
||||
);
|
||||
assert.ok(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it shows recent category icon"
|
||||
);
|
||||
|
||||
await click(".emoji-picker .trash-recent");
|
||||
await click(".emoji-picker .trash-recent");
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it has cleared recent emojis"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it has cleared recent emojis"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .section[data-section="recent"]'),
|
||||
"it hides recent section"
|
||||
);
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .section[data-section="recent"]'),
|
||||
"it hides recent section"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it hides recent category icon"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it hides recent category icon"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"emoji picker correctly orders recently used emojis",
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='sunglasses']");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
test("emoji picker correctly orders recently used emojis", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='sunglasses']");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
|
||||
assert.equal(
|
||||
find('.section[data-section="recent"] .section-group img.emoji').length,
|
||||
2,
|
||||
"it has multiple recent emojis"
|
||||
);
|
||||
assert.equal(
|
||||
find('.section[data-section="recent"] .section-group img.emoji').length,
|
||||
2,
|
||||
"it has multiple recent emojis"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
/grinning/.test(
|
||||
find(".section.recent .section-group img.emoji").first().attr("src")
|
||||
),
|
||||
true,
|
||||
"it puts the last used emoji in first"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(
|
||||
/grinning/.test(
|
||||
find(".section.recent .section-group img.emoji").first().attr("src")
|
||||
),
|
||||
true,
|
||||
"it puts the last used emoji in first"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("emoji picker persists state", async (assert) => {
|
||||
test("emoji picker persists state", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { test } from "qunit";
|
||||
import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Emoji", { loggedIn: true });
|
||||
|
||||
QUnit.test("emoji is cooked properly", async (assert) => {
|
||||
test("emoji is cooked properly", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
|
@ -14,7 +15,7 @@ QUnit.test("emoji is cooked properly", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("skin toned emoji is cooked properly", async (assert) => {
|
||||
test("skin toned emoji is cooked properly", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import DiscoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
||||
|
||||
|
@ -41,7 +42,7 @@ acceptance("Encoded Sub Category Discovery", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Visit subcategory by slug", async (assert) => {
|
||||
test("Visit subcategory by slug", async (assert) => {
|
||||
let bodySelector =
|
||||
"body.category-\\%E6\\%BC\\%A2\\%E5\\%AD\\%97-parent-\\%E6\\%BC\\%A2\\%E5\\%AD\\%97-subcategory";
|
||||
await visit("/c/%E6%BC%A2%E5%AD%97-parent/%E6%BC%A2%E5%AD%97-subcategory");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -15,7 +16,7 @@ acceptance("Enforce Second Factor", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("as an admin", async function (assert) {
|
||||
test("as an admin", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
this.siteSettings.enforce_second_factor = "staff";
|
||||
|
||||
|
@ -37,7 +38,7 @@ QUnit.test("as an admin", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("as a user", async function (assert) {
|
||||
test("as a user", async function (assert) {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
@ -61,7 +62,7 @@ QUnit.test("as a user", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("as an anonymous user", async function (assert) {
|
||||
test("as an anonymous user", async function (assert) {
|
||||
updateCurrentUser({ moderator: false, admin: false, is_anonymous: true });
|
||||
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -13,7 +14,7 @@ acceptance("Forgot password", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("requesting password reset", async (assert) => {
|
||||
test("requesting password reset", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
await click("#forgot-password-link");
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { skip } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
|
||||
acceptance("Group Card - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.skip("group card", async (assert) => {
|
||||
skip("group card", async (assert) => {
|
||||
await visit("/t/-/301/1");
|
||||
assert.ok(
|
||||
invisible(".group-card"),
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { skip } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
|
||||
acceptance("Group Card");
|
||||
|
||||
QUnit.skip("group card", async (assert) => {
|
||||
skip("group card", async (assert) => {
|
||||
await visit("/t/-/301/1");
|
||||
assert.ok(invisible(".group-card"), "user card is invisible by default");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import {
|
||||
acceptance,
|
||||
|
@ -6,7 +7,7 @@ import {
|
|||
|
||||
acceptance("Group Members");
|
||||
|
||||
QUnit.test("Viewing Members as anon user", async (assert) => {
|
||||
test("Viewing Members as anon user", async (assert) => {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
|
@ -29,7 +30,7 @@ QUnit.test("Viewing Members as anon user", async (assert) => {
|
|||
|
||||
acceptance("Group Members", { loggedIn: true });
|
||||
|
||||
QUnit.test("Viewing Members as a group owner", async (assert) => {
|
||||
test("Viewing Members as a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse");
|
||||
|
@ -42,7 +43,7 @@ QUnit.test("Viewing Members as a group owner", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Viewing Members as an admin user", async (assert) => {
|
||||
test("Viewing Members as an admin user", async (assert) => {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Category Notification Defaults");
|
||||
QUnit.test("As an anonymous user", async (assert) => {
|
||||
test("As an anonymous user", async (assert) => {
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
||||
assert.ok(
|
||||
|
@ -15,7 +16,7 @@ QUnit.test("As an anonymous user", async (assert) => {
|
|||
|
||||
acceptance("Managing Group Category Notification Defaults", { loggedIn: true });
|
||||
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
test("As an admin", async (assert) => {
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
||||
assert.ok(
|
||||
|
@ -24,7 +25,7 @@ QUnit.test("As an admin", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -10,7 +11,7 @@ acceptance("Managing Group Interaction Settings", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
test("As an admin", async (assert) => {
|
||||
updateCurrentUser({
|
||||
moderator: false,
|
||||
admin: true,
|
||||
|
@ -50,7 +51,7 @@ QUnit.test("As an admin", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({
|
||||
moderator: false,
|
||||
admin: false,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Group logs", {
|
||||
|
@ -92,7 +93,7 @@ acceptance("Group logs", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Browsing group logs", async (assert) => {
|
||||
test("Browsing group logs", async (assert) => {
|
||||
await visit("/g/snorlax/manage/logs");
|
||||
assert.ok(
|
||||
find("tr.group-manage-logs-row").length === 2,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -8,7 +9,7 @@ acceptance("Managing Group Membership", {
|
|||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
test("As an admin", async (assert) => {
|
||||
updateCurrentUser({ can_create_group: true });
|
||||
|
||||
await visit("/g/alternative-group/manage/membership");
|
||||
|
@ -75,7 +76,7 @@ QUnit.test("As an admin", async (assert) => {
|
|||
assert.equal(emailDomains.header().value(), "foo.com");
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse/manage/membership");
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Profile");
|
||||
QUnit.test("As an anonymous user", async (assert) => {
|
||||
test("As an anonymous user", async (assert) => {
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
assert.ok(
|
||||
|
@ -15,7 +16,7 @@ QUnit.test("As an anonymous user", async (assert) => {
|
|||
|
||||
acceptance("Managing Group Profile", { loggedIn: true });
|
||||
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
test("As an admin", async (assert) => {
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
assert.ok(
|
||||
|
@ -36,7 +37,7 @@ QUnit.test("As an admin", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({
|
||||
moderator: false,
|
||||
admin: false,
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Tag Notification Defaults");
|
||||
QUnit.test("As an anonymous user", async (assert) => {
|
||||
test("As an anonymous user", async (assert) => {
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
||||
assert.ok(
|
||||
|
@ -15,7 +16,7 @@ QUnit.test("As an anonymous user", async (assert) => {
|
|||
|
||||
acceptance("Managing Group Tag Notification Defaults", { loggedIn: true });
|
||||
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
test("As an admin", async (assert) => {
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
||||
assert.ok(
|
||||
|
@ -24,7 +25,7 @@ QUnit.test("As an admin", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { parsePostData } from "discourse/tests/helpers/create-pretender";
|
||||
|
||||
|
@ -80,7 +81,7 @@ acceptance("Group Requests", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Group Requests", async (assert) => {
|
||||
test("Group Requests", async (assert) => {
|
||||
await visit("/g/Macdonald/requests");
|
||||
|
||||
assert.equal(find(".group-members tr").length, 2);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -22,7 +23,7 @@ const response = (object) => {
|
|||
return [200, { "Content-Type": "application/json" }, object];
|
||||
};
|
||||
|
||||
QUnit.test("Anonymous Viewing Group", async function (assert) {
|
||||
test("Anonymous Viewing Group", async function (assert) {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.equal(
|
||||
|
@ -77,7 +78,7 @@ QUnit.test("Anonymous Viewing Group", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Anonymous Viewing Automatic Group", async (assert) => {
|
||||
test("Anonymous Viewing Automatic Group", async (assert) => {
|
||||
await visit("/g/moderators");
|
||||
|
||||
assert.equal(
|
||||
|
@ -89,7 +90,7 @@ QUnit.test("Anonymous Viewing Automatic Group", async (assert) => {
|
|||
|
||||
acceptance("Group", Object.assign({ loggedIn: true }, groupArgs));
|
||||
|
||||
QUnit.test("User Viewing Group", async (assert) => {
|
||||
test("User Viewing Group", async (assert) => {
|
||||
await visit("/g");
|
||||
await click(".group-index-request");
|
||||
|
||||
|
@ -122,28 +123,25 @@ QUnit.test("User Viewing Group", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Admin viewing group messages when there are no messages",
|
||||
async (assert) => {
|
||||
pretender.get(
|
||||
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||
() => {
|
||||
return response({ topic_list: { topics: [] } });
|
||||
}
|
||||
);
|
||||
test("Admin viewing group messages when there are no messages", async (assert) => {
|
||||
pretender.get(
|
||||
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||
() => {
|
||||
return response({ topic_list: { topics: [] } });
|
||||
}
|
||||
);
|
||||
|
||||
await visit("/g/discourse");
|
||||
await click(".nav-pills li a[title='Messages']");
|
||||
await visit("/g/discourse");
|
||||
await click(".nav-pills li a[title='Messages']");
|
||||
|
||||
assert.equal(
|
||||
find(".alert").text().trim(),
|
||||
I18n.t("choose_topic.none_found"),
|
||||
"it should display the right alert"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(
|
||||
find(".alert").text().trim(),
|
||||
I18n.t("choose_topic.none_found"),
|
||||
"it should display the right alert"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Admin viewing group messages", async (assert) => {
|
||||
test("Admin viewing group messages", async (assert) => {
|
||||
pretender.get(
|
||||
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||
() => {
|
||||
|
@ -238,7 +236,7 @@ QUnit.test("Admin viewing group messages", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Admin Viewing Group", async (assert) => {
|
||||
test("Admin Viewing Group", async (assert) => {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Groups");
|
||||
|
||||
QUnit.test("Browsing Groups", async (assert) => {
|
||||
test("Browsing Groups", async (assert) => {
|
||||
await visit("/g?username=eviltrout");
|
||||
|
||||
assert.equal(count(".group-box"), 1, "it displays user's groups");
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Group");
|
||||
|
||||
QUnit.test("As an anon user", async (assert) => {
|
||||
test("As an anon user", async (assert) => {
|
||||
await visit("/g");
|
||||
|
||||
assert.equal(
|
||||
|
@ -15,7 +16,7 @@ QUnit.test("As an anon user", async (assert) => {
|
|||
|
||||
acceptance("New Group", { loggedIn: true });
|
||||
|
||||
QUnit.test("Creating a new group", async (assert) => {
|
||||
test("Creating a new group", async (assert) => {
|
||||
await visit("/g");
|
||||
await click(".groups-header-new");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -10,7 +11,7 @@ acceptance("Opening the hamburger menu with some reviewables", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("As a staff member", async (assert) => {
|
||||
test("As a staff member", async (assert) => {
|
||||
updateCurrentUser({ moderator: true, admin: false });
|
||||
|
||||
await visit("/");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Category and Tag Hashtags", {
|
||||
|
@ -16,7 +17,7 @@ acceptance("Category and Tag Hashtags", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("hashtags are cooked properly", async (assert) => {
|
||||
test("hashtags are cooked properly", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
|
@ -7,7 +8,7 @@ acceptance("Invite Accept", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Invite Acceptance Page", async (assert) => {
|
||||
test("Invite Acceptance Page", async (assert) => {
|
||||
PreloadStore.store("invite_info", {
|
||||
invited_by: {
|
||||
id: 123,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
|
@ -26,7 +27,7 @@ acceptance("Accept Invite - User Fields", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("accept invite with user fields", async (assert) => {
|
||||
test("accept invite with user fields", async (assert) => {
|
||||
PreloadStore.store("invite_info", {
|
||||
invited_by: {
|
||||
id: 123,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Jump to", {
|
||||
|
@ -20,7 +21,7 @@ acceptance("Jump to", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("default", async (assert) => {
|
||||
test("default", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("nav#topic-progress .nums");
|
||||
await click("button.jump-to-post");
|
||||
|
@ -37,7 +38,7 @@ QUnit.test("default", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("invalid date", async (assert) => {
|
||||
test("invalid date", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("nav#topic-progress .nums");
|
||||
await click("button.jump-to-post");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login redirect");
|
||||
QUnit.test("redirects login to default homepage", async function (assert) {
|
||||
test("redirects login to default homepage", async function (assert) {
|
||||
await visit("/login");
|
||||
assert.equal(
|
||||
currentPath(),
|
||||
|
@ -16,7 +17,7 @@ acceptance("Login redirect - categories default", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("when site setting is categories", async function (assert) {
|
||||
test("when site setting is categories", async function (assert) {
|
||||
await visit("/login");
|
||||
assert.equal(
|
||||
currentPath(),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login Required", {
|
||||
|
@ -6,7 +7,7 @@ acceptance("Login Required", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("redirect", async (assert) => {
|
||||
test("redirect", async (assert) => {
|
||||
await visit("/latest");
|
||||
assert.equal(currentPath(), "login", "it redirects them to login");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
|
@ -18,7 +19,7 @@ acceptance("Login with email - hide email address taken", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("with hide_email_address_taken enabled", async (assert) => {
|
||||
test("with hide_email_address_taken enabled", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
await fillIn("#login-account-name", "someuser@example.com");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login with email - no social logins", {
|
||||
|
@ -9,14 +10,14 @@ acceptance("Login with email - no social logins", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("with login with email enabled", async (assert) => {
|
||||
test("with login with email enabled", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
assert.ok(exists(".login-with-email-button"));
|
||||
});
|
||||
|
||||
QUnit.test("with login with email disabled", async (assert) => {
|
||||
test("with login with email disabled", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login with email disabled", {
|
||||
|
@ -7,7 +8,7 @@ acceptance("Login with email disabled", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("with email button", async (assert) => {
|
||||
test("with email button", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -15,7 +16,7 @@ acceptance("Login with email", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("with email button", async (assert) => {
|
||||
test("with email button", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
acceptance("Topic Discovery - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("Visit Discovery Pages", async (assert) => {
|
||||
test("Visit Discovery Pages", async (assert) => {
|
||||
await visit("/");
|
||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Signing In - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("sign in", async (assert) => {
|
||||
test("sign in", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
assert.ok(exists("#login-form"), "it shows the login modal");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("User Directory - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("Visit Page", async (assert) => {
|
||||
test("Visit Page", async (assert) => {
|
||||
await visit("/u");
|
||||
assert.ok(exists(".directory .user"), "has a list of users");
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { skip } from "qunit";
|
||||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { run } from "@ember/runloop";
|
||||
import {
|
||||
|
@ -24,7 +26,7 @@ acceptance("Modal", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.skip("modal", async function (assert) {
|
||||
skip("modal", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
|
@ -74,7 +76,7 @@ QUnit.skip("modal", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("rawTitle in modal panels", async function (assert) {
|
||||
test("rawTitle in modal panels", async function (assert) {
|
||||
Ember.TEMPLATES["modal/test-raw-title-panels"] = Ember.HTMLBars.compile("");
|
||||
const panels = [
|
||||
{ id: "test1", rawTitle: "Test 1" },
|
||||
|
@ -91,7 +93,7 @@ QUnit.test("rawTitle in modal panels", async function (assert) {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("modal title", async function (assert) {
|
||||
test("modal title", async function (assert) {
|
||||
Ember.TEMPLATES["modal/test-title"] = Ember.HTMLBars.compile("");
|
||||
Ember.TEMPLATES["modal/test-title-with-body"] = Ember.HTMLBars.compile(
|
||||
"{{#d-modal-body}}test{{/d-modal-body}}"
|
||||
|
@ -126,7 +128,7 @@ QUnit.test("modal title", async function (assert) {
|
|||
|
||||
acceptance("Modal Keyboard Events", { loggedIn: true });
|
||||
|
||||
QUnit.test("modal-keyboard-events", async function (assert) {
|
||||
test("modal-keyboard-events", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Message");
|
||||
|
||||
QUnit.test("accessing new-message route when logged out", async (assert) => {
|
||||
test("accessing new-message route when logged out", async (assert) => {
|
||||
await visit(
|
||||
"/new-message?username=charlie&title=message%20title&body=message%20body"
|
||||
);
|
||||
|
@ -11,7 +12,7 @@ QUnit.test("accessing new-message route when logged out", async (assert) => {
|
|||
});
|
||||
|
||||
acceptance("New Message", { loggedIn: true });
|
||||
QUnit.test("accessing new-message route when logged in", async (assert) => {
|
||||
test("accessing new-message route when logged in", async (assert) => {
|
||||
await visit(
|
||||
"/new-message?username=charlie&title=message%20title&body=message%20body"
|
||||
);
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Topic");
|
||||
|
||||
QUnit.test("accessing new-topic route when logged out", async (assert) => {
|
||||
test("accessing new-topic route when logged out", async (assert) => {
|
||||
await visit("/new-topic?title=topic%20title&body=topic%20body");
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
});
|
||||
|
||||
acceptance("New Topic", { loggedIn: true });
|
||||
QUnit.test("accessing new-topic route when logged in", async (assert) => {
|
||||
test("accessing new-topic route when logged in", async (assert) => {
|
||||
await visit("/new-topic?title=topic%20title&body=topic%20body&category=bug");
|
||||
|
||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Page Publishing", {
|
||||
|
@ -22,7 +23,7 @@ acceptance("Page Publishing", {
|
|||
});
|
||||
},
|
||||
});
|
||||
QUnit.test("can publish a page via modal", async (assert) => {
|
||||
test("can publish a page via modal", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".topic-post:eq(0) button.show-post-admin-menu");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
@ -54,7 +55,7 @@ acceptance("Password Reset", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Password Reset Page", async (assert) => {
|
||||
test("Password Reset Page", async (assert) => {
|
||||
PreloadStore.store("password_reset", { is_developer: false });
|
||||
|
||||
await visit("/u/password-reset/myvalidtoken");
|
||||
|
@ -86,7 +87,7 @@ QUnit.test("Password Reset Page", async (assert) => {
|
|||
assert.ok(!exists(".password-reset form"), "form is gone");
|
||||
});
|
||||
|
||||
QUnit.test("Password Reset Page With Second Factor", async (assert) => {
|
||||
test("Password Reset Page With Second Factor", async (assert) => {
|
||||
PreloadStore.store("password_reset", {
|
||||
is_developer: false,
|
||||
second_factor_required: true,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -5,7 +6,7 @@ acceptance("Personal Message", {
|
|||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("footer edit button", async (assert) => {
|
||||
test("footer edit button", async (assert) => {
|
||||
await visit("/t/pm-for-testing/12");
|
||||
|
||||
assert.ok(
|
||||
|
@ -14,7 +15,7 @@ QUnit.test("footer edit button", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("suggested messages", async (assert) => {
|
||||
test("suggested messages", async (assert) => {
|
||||
await visit("/t/pm-for-testing/12");
|
||||
|
||||
assert.equal(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { extraConnectorClass } from "discourse/lib/plugin-connectors";
|
||||
import { action } from "@ember/object";
|
||||
|
@ -64,7 +65,7 @@ acceptance("Plugin Outlet - Connector Class", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders a template into the outlet", async (assert) => {
|
||||
test("Renders a template into the outlet", async (assert) => {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
find(".user-profile-primary-outlet.hello").length === 1,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
|
||||
|
@ -38,24 +39,21 @@ acceptance("Plugin Outlet - Decorator", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Calls the plugin callback with the rendered outlet",
|
||||
async (assert) => {
|
||||
await visit("/");
|
||||
test("Calls the plugin callback with the rendered outlet", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
const fooConnector = find(".discovery-list-container-top-outlet.foo ")[0];
|
||||
const barConnector = find(".discovery-list-container-top-outlet.bar ")[0];
|
||||
const fooConnector = find(".discovery-list-container-top-outlet.foo ")[0];
|
||||
const barConnector = find(".discovery-list-container-top-outlet.bar ")[0];
|
||||
|
||||
assert.ok(exists(fooConnector));
|
||||
assert.equal(fooConnector.style.backgroundColor, "yellow");
|
||||
assert.equal(barConnector.style.backgroundColor, "");
|
||||
assert.ok(exists(fooConnector));
|
||||
assert.equal(fooConnector.style.backgroundColor, "yellow");
|
||||
assert.equal(barConnector.style.backgroundColor, "");
|
||||
|
||||
await visit("/c/bug");
|
||||
await visit("/c/bug");
|
||||
|
||||
assert.ok(fooConnector.classList.contains("in-category"));
|
||||
assert.ok(fooConnector.classList.contains("in-category"));
|
||||
|
||||
await visit("/");
|
||||
await visit("/");
|
||||
|
||||
assert.notOk(fooConnector.classList.contains("in-category"));
|
||||
}
|
||||
);
|
||||
assert.notOk(fooConnector.classList.contains("in-category"));
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { clearCache } from "discourse/lib/plugin-connectors";
|
||||
|
||||
|
@ -23,7 +24,7 @@ acceptance("Plugin Outlet - Multi Template", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders a template into the outlet", async (assert) => {
|
||||
test("Renders a template into the outlet", async (assert) => {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
find(".user-profile-primary-outlet.hello").length === 1,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
const CONNECTOR =
|
||||
|
@ -14,7 +15,7 @@ acceptance("Plugin Outlet - Single Template", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders a template into the outlet", async (assert) => {
|
||||
test("Renders a template into the outlet", async (assert) => {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
find(".user-profile-primary-outlet.hello").length === 1,
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Post - Admin Menu Anonymous Users", { loggedIn: false });
|
||||
|
||||
QUnit.test("Enter as a anon user", async (assert) => {
|
||||
test("Enter as a anon user", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".show-more-actions");
|
||||
|
||||
|
@ -19,17 +20,14 @@ QUnit.test("Enter as a anon user", async (assert) => {
|
|||
|
||||
acceptance("Post - Admin Menu", { loggedIn: true });
|
||||
|
||||
QUnit.test(
|
||||
"Enter as a user with group moderator permissions",
|
||||
async (assert) => {
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
await click(".show-more-actions");
|
||||
await click(".show-post-admin-menu");
|
||||
test("Enter as a user with group moderator permissions", async (assert) => {
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
await click(".show-more-actions");
|
||||
await click(".show-post-admin-menu");
|
||||
|
||||
assert.ok(
|
||||
exists("#post_1 .post-controls .edit"),
|
||||
"The edit button was rendered"
|
||||
);
|
||||
assert.ok(exists(".add-notice"), "The add notice button was rendered");
|
||||
}
|
||||
);
|
||||
assert.ok(
|
||||
exists("#post_1 .post-controls .edit"),
|
||||
"The edit button was rendered"
|
||||
);
|
||||
assert.ok(exists(".add-notice"), "The add notice button was rendered");
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import {
|
||||
acceptance,
|
||||
|
@ -69,7 +70,7 @@ acceptance("User Preferences", {
|
|||
pretend: preferencesPretender,
|
||||
});
|
||||
|
||||
QUnit.test("update some fields", async (assert) => {
|
||||
test("update some fields", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
|
@ -124,12 +125,12 @@ QUnit.test("update some fields", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("username", async (assert) => {
|
||||
test("username", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/username");
|
||||
assert.ok(exists("#change_username"), "it has the input element");
|
||||
});
|
||||
|
||||
QUnit.test("email", async (assert) => {
|
||||
test("email", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
@ -143,7 +144,7 @@ QUnit.test("email", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("email field always shows up", async (assert) => {
|
||||
test("email field always shows up", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
@ -157,7 +158,7 @@ QUnit.test("email field always shows up", async (assert) => {
|
|||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
});
|
||||
|
||||
QUnit.test("connected accounts", async (assert) => {
|
||||
test("connected accounts", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/account");
|
||||
|
||||
assert.ok(
|
||||
|
@ -178,7 +179,7 @@ QUnit.test("connected accounts", async (assert) => {
|
|||
.indexOf("Connect") > -1;
|
||||
});
|
||||
|
||||
QUnit.test("second factor totp", async (assert) => {
|
||||
test("second factor totp", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
||||
assert.ok(exists("#password"), "it has a password input");
|
||||
|
@ -198,7 +199,7 @@ QUnit.test("second factor totp", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("second factor security keys", async (assert) => {
|
||||
test("second factor security keys", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
||||
assert.ok(exists("#password"), "it has a password input");
|
||||
|
@ -224,7 +225,7 @@ QUnit.test("second factor security keys", async (assert) => {
|
|||
}
|
||||
});
|
||||
|
||||
QUnit.test("default avatar selector", async (assert) => {
|
||||
test("default avatar selector", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
await click(".pref-avatar .btn");
|
||||
|
@ -260,7 +261,7 @@ acceptance("Second Factor Backups", {
|
|||
});
|
||||
},
|
||||
});
|
||||
QUnit.test("second factor backup", async (assert) => {
|
||||
test("second factor backup", async (assert) => {
|
||||
updateCurrentUser({ second_factor_enabled: true });
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
await click(".edit-2fa-backup");
|
||||
|
@ -287,7 +288,7 @@ acceptance("Avatar selector when selectable avatars is enabled", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("selectable avatars", async (assert) => {
|
||||
test("selectable avatars", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
await click(".pref-avatar .btn");
|
||||
|
@ -301,7 +302,7 @@ acceptance("User Preferences when badges are disabled", {
|
|||
pretend: preferencesPretender,
|
||||
});
|
||||
|
||||
QUnit.test("visit my preferences", async (assert) => {
|
||||
test("visit my preferences", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
assert.equal(
|
||||
|
@ -312,7 +313,7 @@ QUnit.test("visit my preferences", async (assert) => {
|
|||
assert.ok(exists(".user-preferences"), "it shows the preferences");
|
||||
});
|
||||
|
||||
QUnit.test("recently connected devices", async (assert) => {
|
||||
test("recently connected devices", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
assert.equal(
|
||||
|
@ -367,7 +368,7 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
QUnit.test("setting featured topic on profile", async (assert) => {
|
||||
test("setting featured topic on profile", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/profile");
|
||||
|
||||
assert.ok(
|
||||
|
@ -418,7 +419,7 @@ acceptance("Custom User Fields", {
|
|||
pretend: preferencesPretender,
|
||||
});
|
||||
|
||||
QUnit.test("can select an option from a dropdown", async (assert) => {
|
||||
test("can select an option from a dropdown", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/profile");
|
||||
assert.ok(exists(".user-field"), "it has at least one user field");
|
||||
await click(".user-field.dropdown");
|
||||
|
@ -441,22 +442,19 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"selecting bookmarks as home directs home to bookmarks",
|
||||
async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/interface");
|
||||
assert.ok(exists(".home .combo-box"), "it has a home selector combo-box");
|
||||
test("selecting bookmarks as home directs home to bookmarks", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/interface");
|
||||
assert.ok(exists(".home .combo-box"), "it has a home selector combo-box");
|
||||
|
||||
const field = selectKit(".home .combo-box");
|
||||
await field.expand();
|
||||
await field.selectRowByValue("6");
|
||||
await click(".save-changes");
|
||||
await visit("/");
|
||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
assert.equal(
|
||||
currentPath(),
|
||||
"discovery.bookmarks",
|
||||
"it navigates to bookmarks"
|
||||
);
|
||||
}
|
||||
);
|
||||
const field = selectKit(".home .combo-box");
|
||||
await field.expand();
|
||||
await field.selectRowByValue("6");
|
||||
await click(".save-changes");
|
||||
await visit("/");
|
||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
assert.equal(
|
||||
currentPath(),
|
||||
"discovery.bookmarks",
|
||||
"it navigates to bookmarks"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import compile from "handlebars-compiler";
|
||||
import {
|
||||
|
@ -21,7 +22,7 @@ acceptance("Raw Plugin Outlet", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders the raw plugin outlet", async (assert) => {
|
||||
test("Renders the raw plugin outlet", async (assert) => {
|
||||
await visit("/");
|
||||
assert.ok(find(".topic-lala").length > 0, "it renders the outlet");
|
||||
assert.equal(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
updateCurrentUser,
|
||||
|
@ -19,7 +20,7 @@ acceptance("Redirect to Top", {
|
|||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("redirects categories to weekly top", async (assert) => {
|
||||
test("redirects categories to weekly top", async (assert) => {
|
||||
updateCurrentUser({
|
||||
should_be_redirected_to_top: true,
|
||||
redirected_to_top: {
|
||||
|
@ -32,7 +33,7 @@ QUnit.test("redirects categories to weekly top", async (assert) => {
|
|||
assert.equal(currentPath(), "discovery.topWeekly", "it works for categories");
|
||||
});
|
||||
|
||||
QUnit.test("redirects latest to monthly top", async (assert) => {
|
||||
test("redirects latest to monthly top", async (assert) => {
|
||||
updateCurrentUser({
|
||||
should_be_redirected_to_top: true,
|
||||
redirected_to_top: {
|
||||
|
@ -45,7 +46,7 @@ QUnit.test("redirects latest to monthly top", async (assert) => {
|
|||
assert.equal(currentPath(), "discovery.topMonthly", "it works for latest");
|
||||
});
|
||||
|
||||
QUnit.test("redirects root to All top", async (assert) => {
|
||||
test("redirects root to All top", async (assert) => {
|
||||
updateCurrentUser({
|
||||
should_be_redirected_to_top: true,
|
||||
redirected_to_top: {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Reports", {
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("Visit reports page", async (assert) => {
|
||||
test("Visit reports page", async (assert) => {
|
||||
await visit("/admin/reports");
|
||||
|
||||
assert.equal($(".reports-list .report").length, 1);
|
||||
|
@ -19,7 +20,7 @@ QUnit.test("Visit reports page", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Visit report page", async (assert) => {
|
||||
test("Visit report page", async (assert) => {
|
||||
await visit("/admin/reports/staff_logins");
|
||||
|
||||
assert.ok(exists(".export-csv-btn"));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -7,7 +8,7 @@ acceptance("Review", {
|
|||
|
||||
const user = ".reviewable-item[data-reviewable-id=1234]";
|
||||
|
||||
QUnit.test("It returns a list of reviewable items", async (assert) => {
|
||||
test("It returns a list of reviewable items", async (assert) => {
|
||||
await visit("/review");
|
||||
|
||||
assert.ok(find(".reviewable-item").length, "has a list of items");
|
||||
|
@ -26,7 +27,7 @@ QUnit.test("It returns a list of reviewable items", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Grouped by topic", async (assert) => {
|
||||
test("Grouped by topic", async (assert) => {
|
||||
await visit("/review/topics");
|
||||
assert.ok(
|
||||
find(".reviewable-topic").length,
|
||||
|
@ -34,7 +35,7 @@ QUnit.test("Grouped by topic", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Settings", async (assert) => {
|
||||
test("Settings", async (assert) => {
|
||||
await visit("/review/settings");
|
||||
|
||||
assert.ok(find(".reviewable-score-type").length, "has a list of bonuses");
|
||||
|
@ -47,7 +48,7 @@ QUnit.test("Settings", async (assert) => {
|
|||
assert.ok(find(".reviewable-settings .saved").length, "it saved");
|
||||
});
|
||||
|
||||
QUnit.test("Flag related", async (assert) => {
|
||||
test("Flag related", async (assert) => {
|
||||
await visit("/review");
|
||||
|
||||
assert.ok(
|
||||
|
@ -63,7 +64,7 @@ QUnit.test("Flag related", async (assert) => {
|
|||
assert.equal(find(".reviewable-flagged-post .reviewable-score").length, 2);
|
||||
});
|
||||
|
||||
QUnit.test("Flag related", async (assert) => {
|
||||
test("Flag related", async (assert) => {
|
||||
await visit("/review/1");
|
||||
|
||||
assert.ok(
|
||||
|
@ -72,13 +73,13 @@ QUnit.test("Flag related", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Clicking the buttons triggers actions", async (assert) => {
|
||||
test("Clicking the buttons triggers actions", async (assert) => {
|
||||
await visit("/review");
|
||||
await click(`${user} .reviewable-action.approve`);
|
||||
assert.equal(find(user).length, 0, "it removes the reviewable on success");
|
||||
});
|
||||
|
||||
QUnit.test("Editing a reviewable", async (assert) => {
|
||||
test("Editing a reviewable", async (assert) => {
|
||||
const topic = ".reviewable-item[data-reviewable-id=4321]";
|
||||
await visit("/review");
|
||||
assert.ok(find(`${topic} .reviewable-action.approve`).length);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { skip } from "qunit";
|
||||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import {
|
||||
selectDate,
|
||||
|
@ -87,7 +89,7 @@ acceptance("Search - Full Page", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test("perform various searches", async (assert) => {
|
||||
test("perform various searches", async (assert) => {
|
||||
await visit("/search");
|
||||
|
||||
assert.ok($("body.search-page").length, "has body class");
|
||||
|
@ -107,7 +109,7 @@ QUnit.test("perform various searches", async (assert) => {
|
|||
assert.ok(find(".fps-topic").length === 1, "has one post");
|
||||
});
|
||||
|
||||
QUnit.test("escape search term", async (assert) => {
|
||||
test("escape search term", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "@<script>prompt(1337)</script>gmail.com");
|
||||
|
||||
|
@ -119,7 +121,7 @@ QUnit.test("escape search term", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.skip("update username through advanced search ui", async (assert) => {
|
||||
skip("update username through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn(".search-advanced-options .user-selector", "admin");
|
||||
|
@ -152,7 +154,7 @@ QUnit.skip("update username through advanced search ui", async (assert) => {
|
|||
});
|
||||
});
|
||||
|
||||
QUnit.test("update category through advanced search ui", async (assert) => {
|
||||
test("update category through advanced search ui", async (assert) => {
|
||||
const categoryChooser = selectKit(
|
||||
".search-advanced-options .category-chooser"
|
||||
);
|
||||
|
@ -176,106 +178,94 @@ QUnit.test("update category through advanced search ui", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"update in:title filter through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-title");
|
||||
test("update in:title filter through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-title");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-title:checked"),
|
||||
'has "in title" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:title",
|
||||
'has updated search term to "none in:title"'
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-title:checked"),
|
||||
'has "in title" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:title",
|
||||
'has updated search term to "none in:title"'
|
||||
);
|
||||
|
||||
await fillIn(".search-query", "none in:titleasd");
|
||||
await fillIn(".search-query", "none in:titleasd");
|
||||
|
||||
assert.not(
|
||||
exists(".search-advanced-options .in-title:checked"),
|
||||
"does not populate title only checkbox"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.not(
|
||||
exists(".search-advanced-options .in-title:checked"),
|
||||
"does not populate title only checkbox"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"update in:likes filter through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-likes");
|
||||
test("update in:likes filter through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-likes");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-likes:checked"),
|
||||
'has "I liked" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:likes",
|
||||
'has updated search term to "none in:likes"'
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-likes:checked"),
|
||||
'has "I liked" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:likes",
|
||||
'has updated search term to "none in:likes"'
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"update in:personal filter through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-private");
|
||||
test("update in:personal filter through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-private");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-private:checked"),
|
||||
'has "are in my messages" populated'
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-private:checked"),
|
||||
'has "are in my messages" populated'
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:personal",
|
||||
'has updated search term to "none in:personal"'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:personal",
|
||||
'has updated search term to "none in:personal"'
|
||||
);
|
||||
|
||||
await fillIn(".search-query", "none in:personal-direct");
|
||||
await fillIn(".search-query", "none in:personal-direct");
|
||||
|
||||
assert.not(
|
||||
exists(".search-advanced-options .in-private:checked"),
|
||||
"does not populate messages checkbox"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.not(
|
||||
exists(".search-advanced-options .in-private:checked"),
|
||||
"does not populate messages checkbox"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"update in:seen filter through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-seen");
|
||||
test("update in:seen filter through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-seen");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-seen:checked"),
|
||||
"it should check the right checkbox"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-seen:checked"),
|
||||
"it should check the right checkbox"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:seen",
|
||||
"it should update the search term"
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:seen",
|
||||
"it should update the search term"
|
||||
);
|
||||
|
||||
await fillIn(".search-query", "none in:seenasdan");
|
||||
await fillIn(".search-query", "none in:seenasdan");
|
||||
|
||||
assert.not(
|
||||
exists(".search-advanced-options .in-seen:checked"),
|
||||
"does not populate seen checkbox"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.not(
|
||||
exists(".search-advanced-options .in-seen:checked"),
|
||||
"does not populate seen checkbox"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("update in filter through advanced search ui", async (assert) => {
|
||||
test("update in filter through advanced search ui", async (assert) => {
|
||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||
|
||||
await visit("/search");
|
||||
|
@ -296,7 +286,7 @@ QUnit.test("update in filter through advanced search ui", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("update status through advanced search ui", async (assert) => {
|
||||
test("update status through advanced search ui", async (assert) => {
|
||||
const statusSelector = selectKit(
|
||||
".search-advanced-options .select-kit#status"
|
||||
);
|
||||
|
@ -319,35 +309,29 @@ QUnit.test("update status through advanced search ui", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"doesn't update status filter header if wrong value entered through searchbox",
|
||||
async (assert) => {
|
||||
const statusSelector = selectKit(
|
||||
".search-advanced-options .select-kit#status"
|
||||
);
|
||||
test("doesn't update status filter header if wrong value entered through searchbox", async (assert) => {
|
||||
const statusSelector = selectKit(
|
||||
".search-advanced-options .select-kit#status"
|
||||
);
|
||||
|
||||
await visit("/search");
|
||||
await visit("/search");
|
||||
|
||||
await fillIn(".search-query", "status:none");
|
||||
await fillIn(".search-query", "status:none");
|
||||
|
||||
assert.equal(statusSelector.header().label(), "any", 'has "any" populated');
|
||||
}
|
||||
);
|
||||
assert.equal(statusSelector.header().label(), "any", 'has "any" populated');
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"doesn't update in filter header if wrong value entered through searchbox",
|
||||
async (assert) => {
|
||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||
test("doesn't update in filter header if wrong value entered through searchbox", async (assert) => {
|
||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||
|
||||
await visit("/search");
|
||||
await visit("/search");
|
||||
|
||||
await fillIn(".search-query", "in:none");
|
||||
await fillIn(".search-query", "in:none");
|
||||
|
||||
assert.equal(inSelector.header().label(), "any", 'has "any" populated');
|
||||
}
|
||||
);
|
||||
assert.equal(inSelector.header().label(), "any", 'has "any" populated');
|
||||
});
|
||||
|
||||
QUnit.test("update post time through advanced search ui", async (assert) => {
|
||||
test("update post time through advanced search ui", async (assert) => {
|
||||
await visit("/search?expanded=true&q=after:2018-08-22");
|
||||
|
||||
assert.equal(
|
||||
|
@ -380,47 +364,41 @@ QUnit.test("update post time through advanced search ui", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"update min post count through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn("#search-min-post-count", "5");
|
||||
test("update min post count through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn("#search-min-post-count", "5");
|
||||
|
||||
assert.equal(
|
||||
find(".search-advanced-options #search-min-post-count").val(),
|
||||
"5",
|
||||
'has "5" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none min_posts:5",
|
||||
'has updated search term to "none min_posts:5"'
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-advanced-options #search-min-post-count").val(),
|
||||
"5",
|
||||
'has "5" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none min_posts:5",
|
||||
'has updated search term to "none min_posts:5"'
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"update max post count through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn("#search-max-post-count", "5");
|
||||
test("update max post count through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn("#search-max-post-count", "5");
|
||||
|
||||
assert.equal(
|
||||
find(".search-advanced-options #search-max-post-count").val(),
|
||||
"5",
|
||||
'has "5" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none max_posts:5",
|
||||
'has updated search term to "none max_posts:5"'
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-advanced-options #search-max-post-count").val(),
|
||||
"5",
|
||||
'has "5" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none max_posts:5",
|
||||
'has updated search term to "none max_posts:5"'
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("validate advanced search when initially empty", async (assert) => {
|
||||
test("validate advanced search when initially empty", async (assert) => {
|
||||
await visit("/search?expanded=true");
|
||||
await click(".search-advanced-options .in-likes");
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Search - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("search", async (assert) => {
|
||||
test("search", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { test } from "qunit";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
|
@ -17,7 +18,7 @@ let searchArgs = {
|
|||
|
||||
acceptance("Search", searchArgs);
|
||||
|
||||
QUnit.test("search", async (assert) => {
|
||||
test("search", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
@ -43,7 +44,7 @@ QUnit.test("search", async (assert) => {
|
|||
assert.ok(exists(".search-advanced-options"), "advanced search is expanded");
|
||||
});
|
||||
|
||||
QUnit.test("search for a tag", async (assert) => {
|
||||
test("search for a tag", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
@ -53,7 +54,7 @@ QUnit.test("search for a tag", async (assert) => {
|
|||
assert.ok(exists(".search-menu .results ul li"), "it shows results");
|
||||
});
|
||||
|
||||
QUnit.test("search scope checkbox", async (assert) => {
|
||||
test("search scope checkbox", async (assert) => {
|
||||
await visit("/tag/important");
|
||||
await click("#search-button");
|
||||
assert.ok(
|
||||
|
@ -86,7 +87,7 @@ QUnit.test("search scope checkbox", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Search with context", async (assert) => {
|
||||
test("Search with context", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280/1");
|
||||
|
||||
await click("#search-button");
|
||||
|
@ -126,7 +127,7 @@ QUnit.test("Search with context", async (assert) => {
|
|||
assert.ok(!$(".search-context input[type=checkbox]").is(":checked"));
|
||||
});
|
||||
|
||||
QUnit.test("Right filters are shown to anonymous users", async (assert) => {
|
||||
test("Right filters are shown to anonymous users", async (assert) => {
|
||||
const inSelector = selectKit(".select-kit#in");
|
||||
|
||||
await visit("/search?expanded=true");
|
||||
|
@ -151,7 +152,7 @@ QUnit.test("Right filters are shown to anonymous users", async (assert) => {
|
|||
|
||||
acceptance("Search", Object.assign({ loggedIn: true, searchArgs }));
|
||||
|
||||
QUnit.test("Right filters are shown to logged-in users", async (assert) => {
|
||||
test("Right filters are shown to logged-in users", async (assert) => {
|
||||
const inSelector = selectKit(".select-kit#in");
|
||||
|
||||
await visit("/search?expanded=true");
|
||||
|
@ -183,7 +184,7 @@ acceptance(
|
|||
})
|
||||
);
|
||||
|
||||
QUnit.test("displays tags", async (assert) => {
|
||||
test("displays tags", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { test } from "qunit";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Share and Invite modal - desktop", {
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("Topic footer button", async (assert) => {
|
||||
test("Topic footer button", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
|
@ -64,7 +65,7 @@ QUnit.test("Topic footer button", async (assert) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("Post date link", async (assert) => {
|
||||
test("Post date link", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#post_2 .post-info.post-date a");
|
||||
|
||||
|
@ -78,17 +79,14 @@ acceptance("Share url with badges disabled - desktop", {
|
|||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"topic footer button - badges disabled - desktop",
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-button-share-and-invite");
|
||||
test("topic footer button - badges disabled - desktop", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-button-share-and-invite");
|
||||
|
||||
assert.notOk(
|
||||
find(".share-and-invite.modal .modal-panel.share .topic-share-url")
|
||||
.val()
|
||||
.includes("?u=eviltrout"),
|
||||
"it doesn't add the username param when badges are disabled"
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.notOk(
|
||||
find(".share-and-invite.modal .modal-panel.share .topic-share-url")
|
||||
.val()
|
||||
.includes("?u=eviltrout"),
|
||||
"it doesn't add the username param when badges are disabled"
|
||||
);
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue