DEV: Remove most of jQuery usage from tests (#17474)
This commit is contained in:
parent
b6ed518631
commit
7b6cd44c32
|
@ -6,7 +6,7 @@ acceptance("About", function () {
|
||||||
test("viewing", async function (assert) {
|
test("viewing", async function (assert) {
|
||||||
await visit("/about");
|
await visit("/about");
|
||||||
|
|
||||||
assert.ok($("body.about-page").length, "has body class");
|
assert.ok(document.body.classList.contains("about-page"), "has body class");
|
||||||
assert.ok(exists(".about.admins .user-info"), "has admins");
|
assert.ok(exists(".about.admins .user-info"), "has admins");
|
||||||
assert.ok(exists(".about.moderators .user-info"), "has moderators");
|
assert.ok(exists(".about.moderators .user-info"), "has moderators");
|
||||||
assert.ok(exists(".about.stats tr td"), "has stats");
|
assert.ok(exists(".about.stats tr td"), "has stats");
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
count,
|
count,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import {
|
import {
|
||||||
click,
|
click,
|
||||||
|
@ -58,7 +58,7 @@ acceptance("Admin - Site Settings", function (needs) {
|
||||||
await visit("/admin/site_settings");
|
await visit("/admin/site_settings");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".row.setting .setting-label h3 a").attr("href"),
|
query(".row.setting .setting-label h3 a").getAttribute("href"),
|
||||||
"/admin/logs/staff_action_logs?filters=%7B%22subject%22%3A%22title%22%2C%22action_name%22%3A%22change_site_setting%22%7D&force_refresh=true",
|
"/admin/logs/staff_action_logs?filters=%7B%22subject%22%3A%22title%22%2C%22action_name%22%3A%22change_site_setting%22%7D&force_refresh=true",
|
||||||
"it links to the staff action log"
|
"it links to the staff action log"
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,10 @@ acceptance("Badges", function (needs) {
|
||||||
test("Visit Badge Pages", async function (assert) {
|
test("Visit Badge Pages", async function (assert) {
|
||||||
await visit("/badges");
|
await visit("/badges");
|
||||||
|
|
||||||
assert.ok($("body.badges-page").length, "has body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("badges-page"),
|
||||||
|
"has body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".badge-groups .badge-card"), "has a list of badges");
|
assert.ok(exists(".badge-groups .badge-card"), "has a list of badges");
|
||||||
|
|
||||||
await visit("/badges/9/autobiographer");
|
await visit("/badges/9/autobiographer");
|
||||||
|
@ -23,6 +26,9 @@ acceptance("Badges", function (needs) {
|
||||||
const availableBadgeTitles = selectKit(".select-kit");
|
const availableBadgeTitles = selectKit(".select-kit");
|
||||||
await visit("/badges/50/custombadge");
|
await visit("/badges/50/custombadge");
|
||||||
await availableBadgeTitles.expand();
|
await availableBadgeTitles.expand();
|
||||||
assert.ok(availableBadgeTitles.rowByIndex(1).name() === "CustomBadge");
|
assert.strictEqual(
|
||||||
|
availableBadgeTitles.rowByIndex(1).name(),
|
||||||
|
"CustomBadge"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,14 +10,14 @@ import I18n from "I18n";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
acceptance("Category Edit - security", function (needs) {
|
acceptance("Category Edit - Security", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
|
||||||
test("default", async function (assert) {
|
test("default", async function (assert) {
|
||||||
await visit("/c/bug/edit/security");
|
await visit("/c/bug/edit/security");
|
||||||
|
|
||||||
const firstRow = queryAll(".row-body").first();
|
const firstRow = query(".row-body");
|
||||||
const badgeName = firstRow.find(".group-name-label").text();
|
const badgeName = firstRow.querySelector(".group-name-label").innerText;
|
||||||
assert.strictEqual(badgeName, "everyone");
|
assert.strictEqual(badgeName, "everyone");
|
||||||
|
|
||||||
assert.strictEqual(count(".d-icon-check-square"), 3);
|
assert.strictEqual(count(".d-icon-check-square"), 3);
|
||||||
|
@ -56,11 +56,14 @@ acceptance("Category Edit - security", function (needs) {
|
||||||
await availableGroups.expand();
|
await availableGroups.expand();
|
||||||
await availableGroups.selectRowByValue("staff");
|
await availableGroups.selectRowByValue("staff");
|
||||||
|
|
||||||
const addedRow = queryAll(".row-body").last();
|
const addedRow = [...queryAll(".row-body")].at(-1);
|
||||||
|
|
||||||
assert.strictEqual(addedRow.find(".group-name-label").text(), "staff");
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
addedRow.find(".d-icon-check-square").length,
|
addedRow.querySelector(".group-name-label").innerText,
|
||||||
|
"staff"
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
addedRow.querySelectorAll(".d-icon-check-square").length,
|
||||||
3,
|
3,
|
||||||
"new row permissions match default 'everyone' permissions"
|
"new row permissions match default 'everyone' permissions"
|
||||||
);
|
);
|
||||||
|
@ -70,7 +73,6 @@ acceptance("Category Edit - security", function (needs) {
|
||||||
const availableGroups = selectKit(".available-groups");
|
const availableGroups = selectKit(".available-groups");
|
||||||
|
|
||||||
await visit("/c/bug/edit/security");
|
await visit("/c/bug/edit/security");
|
||||||
|
|
||||||
await click(".row-body .remove-permission");
|
await click(".row-body .remove-permission");
|
||||||
|
|
||||||
assert.ok(!exists(".row-body"), "removes the permission from the list");
|
assert.ok(!exists(".row-body"), "removes the permission from the list");
|
||||||
|
@ -84,11 +86,14 @@ acceptance("Category Edit - security", function (needs) {
|
||||||
"adds back the permission tp the list"
|
"adds back the permission tp the list"
|
||||||
);
|
);
|
||||||
|
|
||||||
const firstRow = queryAll(".row-body").first();
|
const firstRow = query(".row-body");
|
||||||
|
|
||||||
assert.strictEqual(firstRow.find(".group-name-label").text(), "everyone");
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
firstRow.find(".d-icon-check-square").length,
|
firstRow.querySelector(".group-name-label").innerText,
|
||||||
|
"everyone"
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
firstRow.querySelectorAll(".d-icon-check-square").length,
|
||||||
1,
|
1,
|
||||||
"adds only 'See' permission for a new row"
|
"adds only 'See' permission for a new row"
|
||||||
);
|
);
|
||||||
|
@ -99,10 +104,10 @@ acceptance("Category Edit - security", function (needs) {
|
||||||
|
|
||||||
await visit("/c/bug/edit/security");
|
await visit("/c/bug/edit/security");
|
||||||
|
|
||||||
const everyoneRow = queryAll(".row-body").first();
|
const everyoneRow = query(".row-body");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
everyoneRow.find(".reply-granted, .create-granted").length,
|
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
2,
|
2,
|
||||||
"everyone has full permissions by default"
|
"everyone has full permissions by default"
|
||||||
);
|
);
|
||||||
|
@ -110,58 +115,58 @@ acceptance("Category Edit - security", function (needs) {
|
||||||
await availableGroups.expand();
|
await availableGroups.expand();
|
||||||
await availableGroups.selectRowByValue("staff");
|
await availableGroups.selectRowByValue("staff");
|
||||||
|
|
||||||
const staffRow = queryAll(".row-body").last();
|
const staffRow = [...queryAll(".row-body")].at(-1);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
staffRow.find(".reply-granted, .create-granted").length,
|
staffRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
2,
|
2,
|
||||||
"staff group also has full permissions"
|
"staff group also has full permissions"
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(everyoneRow.find(".reply-toggle")[0]);
|
await click(everyoneRow.querySelector(".reply-toggle"));
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
everyoneRow.find(".reply-granted, .create-granted").length,
|
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
0,
|
0,
|
||||||
"everyone does not have reply or create"
|
"everyone does not have reply or create"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
staffRow.find(".reply-granted, .create-granted").length,
|
staffRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
2,
|
2,
|
||||||
"staff group still has full permissions"
|
"staff group still has full permissions"
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(staffRow.find(".reply-toggle")[0]);
|
await click(staffRow.querySelector(".reply-toggle"));
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
everyoneRow.find(".reply-granted, .create-granted").length,
|
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
0,
|
0,
|
||||||
"everyone permission unchanged"
|
"everyone permission unchanged"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
staffRow.find(".reply-granted").length,
|
staffRow.querySelectorAll(".reply-granted").length,
|
||||||
0,
|
0,
|
||||||
"staff does not have reply permission"
|
"staff does not have reply permission"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
staffRow.find(".create-granted").length,
|
staffRow.querySelectorAll(".create-granted").length,
|
||||||
0,
|
0,
|
||||||
"staff does not have create permission"
|
"staff does not have create permission"
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(everyoneRow.find(".create-toggle")[0]);
|
await click(everyoneRow.querySelector(".create-toggle"));
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
everyoneRow.find(".reply-granted, .create-granted").length,
|
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
2,
|
2,
|
||||||
"everyone has full permissions"
|
"everyone has full permissions"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
staffRow.find(".reply-granted, .create-granted").length,
|
staffRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||||
2,
|
2,
|
||||||
"staff group has full permissions (inherited from everyone)"
|
"staff group has full permissions (inherited from everyone)"
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,7 +20,7 @@ acceptance("Composer - Edit conflict", function (needs) {
|
||||||
".d-editor-input",
|
".d-editor-input",
|
||||||
"hello world hello world hello world hello world hello world"
|
"hello world hello world hello world hello world hello world"
|
||||||
);
|
);
|
||||||
assert.ok(lastBody.indexOf("originalText") === -1);
|
assert.ok(!lastBody.includes("originalText"));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Should send originalText when editing a reply", async function (assert) {
|
test("Should send originalText when editing a reply", async function (assert) {
|
||||||
|
@ -31,6 +31,6 @@ acceptance("Composer - Edit conflict", function (needs) {
|
||||||
".d-editor-input",
|
".d-editor-input",
|
||||||
"hello world hello world hello world hello world hello world"
|
"hello world hello world hello world hello world hello world"
|
||||||
);
|
);
|
||||||
assert.ok(lastBody.indexOf("originalText") > -1);
|
assert.ok(lastBody.includes("originalText"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,6 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -28,7 +27,7 @@ acceptance("Composer - Hyperlink", function (needs) {
|
||||||
await click(".modal-footer button.btn-primary");
|
await click(".modal-footer button.btn-primary");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"This is a link to [Google](https://google.com)",
|
"This is a link to [Google](https://google.com)",
|
||||||
"adds link with url and text, prepends 'https://'"
|
"adds link with url and text, prepends 'https://'"
|
||||||
);
|
);
|
||||||
|
@ -46,7 +45,7 @@ acceptance("Composer - Hyperlink", function (needs) {
|
||||||
await click(".modal-footer button.btn-danger");
|
await click(".modal-footer button.btn-danger");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"Reset textarea contents.",
|
"Reset textarea contents.",
|
||||||
"doesn’t insert anything after cancelling"
|
"doesn’t insert anything after cancelling"
|
||||||
);
|
);
|
||||||
|
@ -65,7 +64,7 @@ acceptance("Composer - Hyperlink", function (needs) {
|
||||||
await click(".modal-footer button.btn-primary");
|
await click(".modal-footer button.btn-primary");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"[Reset](https://somelink.com) textarea contents.",
|
"[Reset](https://somelink.com) textarea contents.",
|
||||||
"adds link to a selected text"
|
"adds link to a selected text"
|
||||||
);
|
);
|
||||||
|
@ -96,7 +95,7 @@ acceptance("Composer - Hyperlink", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".link-url").val().includes("http"),
|
query(".link-url").value.includes("http"),
|
||||||
"replaces link url field with internal link"
|
"replaces link url field with internal link"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
exists,
|
exists,
|
||||||
invisible,
|
invisible,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
visible,
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -34,7 +33,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
|
|
||||||
const assertImageResized = (assert, uploads) => {
|
const assertImageResized = (assert, uploads) => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
uploads.join("\n"),
|
uploads.join("\n"),
|
||||||
"it resizes uploaded image"
|
"it resizes uploaded image"
|
||||||
);
|
);
|
||||||
|
@ -84,9 +83,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
uploads[0] =
|
uploads[0] =
|
||||||
"<a href='https://example.com'>![test|690x313, 50%](upload://test.png)</a>";
|
"<a href='https://example.com'>![test|690x313, 50%](upload://test.png)</a>";
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='0'] .scale-btn[data-scale='50']"
|
".button-wrapper[data-image-index='0'] .scale-btn[data-scale='50']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
|
@ -94,9 +91,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
uploads[6] =
|
uploads[6] =
|
||||||
"![onTheSameLine1|200x200, 50%](upload://onTheSameLine1.jpeg) ![onTheSameLine2|250x250](upload://onTheSameLine2.jpeg)";
|
"![onTheSameLine1|200x200, 50%](upload://onTheSameLine1.jpeg) ![onTheSameLine2|250x250](upload://onTheSameLine2.jpeg)";
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='3'] .scale-btn[data-scale='50']"
|
".button-wrapper[data-image-index='3'] .scale-btn[data-scale='50']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
|
@ -104,45 +99,35 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
uploads[6] =
|
uploads[6] =
|
||||||
"![onTheSameLine1|200x200, 50%](upload://onTheSameLine1.jpeg) ![onTheSameLine2|250x250, 75%](upload://onTheSameLine2.jpeg)";
|
"![onTheSameLine1|200x200, 50%](upload://onTheSameLine1.jpeg) ![onTheSameLine2|250x250, 75%](upload://onTheSameLine2.jpeg)";
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='4'] .scale-btn[data-scale='75']"
|
".button-wrapper[data-image-index='4'] .scale-btn[data-scale='75']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
// Make sure we target the correct image if there are duplicates
|
// Make sure we target the correct image if there are duplicates
|
||||||
uploads[7] = "![identicalImage|300x300, 50%](upload://identicalImage.png)";
|
uploads[7] = "![identicalImage|300x300, 50%](upload://identicalImage.png)";
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='5'] .scale-btn[data-scale='50']"
|
".button-wrapper[data-image-index='5'] .scale-btn[data-scale='50']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
// Try the other dupe
|
// Try the other dupe
|
||||||
uploads[8] = "![identicalImage|300x300, 75%](upload://identicalImage.png)";
|
uploads[8] = "![identicalImage|300x300, 75%](upload://identicalImage.png)";
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='6'] .scale-btn[data-scale='75']"
|
".button-wrapper[data-image-index='6'] .scale-btn[data-scale='75']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
// Don't mess with image titles
|
// Don't mess with image titles
|
||||||
uploads[10] = `![image|690x220, 75%](upload://test.png "image title")`;
|
uploads[10] = `![image|690x220, 75%](upload://test.png "image title")`;
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='8'] .scale-btn[data-scale='75']"
|
".button-wrapper[data-image-index='8'] .scale-btn[data-scale='75']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
// Keep data attributes
|
// Keep data attributes
|
||||||
uploads[12] = `![test|foo=bar|690x313, 75%|bar=baz](upload://test.png)`;
|
uploads[12] = `![test|foo=bar|690x313, 75%|bar=baz](upload://test.png)`;
|
||||||
await click(
|
await click(
|
||||||
queryAll(
|
|
||||||
".button-wrapper[data-image-index='9'] .scale-btn[data-scale='75']"
|
".button-wrapper[data-image-index='9'] .scale-btn[data-scale='75']"
|
||||||
)[0]
|
|
||||||
);
|
);
|
||||||
assertImageResized(assert, uploads);
|
assertImageResized(assert, uploads);
|
||||||
|
|
||||||
|
@ -192,24 +177,20 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
assert.ok(visible(altTextEditOk), "alt text edit ok button is visible");
|
assert.ok(visible(altTextEditOk), "alt text edit ok button is visible");
|
||||||
assert.ok(visible(altTextEditCancel), "alt text edit cancel is hidden");
|
assert.ok(visible(altTextEditCancel), "alt text edit cancel is hidden");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(altTextInput).val(),
|
query(altTextInput).value,
|
||||||
"zorro",
|
"zorro",
|
||||||
"correct alt text in input"
|
"correct alt text in input"
|
||||||
);
|
);
|
||||||
|
|
||||||
await triggerKeyEvent(altTextInput, "keypress", "[".charCodeAt(0));
|
await triggerKeyEvent(altTextInput, "keypress", "[".charCodeAt(0));
|
||||||
await triggerKeyEvent(altTextInput, "keypress", "]".charCodeAt(0));
|
await triggerKeyEvent(altTextInput, "keypress", "]".charCodeAt(0));
|
||||||
assert.equal(
|
assert.equal(query(altTextInput).value, "zorro", "does not input [ ] keys");
|
||||||
queryAll(altTextInput).val(),
|
|
||||||
"zorro",
|
|
||||||
"does not input [ ] keys"
|
|
||||||
);
|
|
||||||
|
|
||||||
await fillIn(altTextInput, "steak");
|
await fillIn(altTextInput, "steak");
|
||||||
await triggerKeyEvent(altTextInput, "keypress", 13);
|
await triggerKeyEvent(altTextInput, "keypress", 13);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"![steak|200x200](upload://zorro.png)",
|
"![steak|200x200](upload://zorro.png)",
|
||||||
"alt text updated"
|
"alt text updated"
|
||||||
);
|
);
|
||||||
|
@ -246,7 +227,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
await click(altTextEditOk);
|
await click(altTextEditOk);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"![steak|200x200](upload://zorro.png)",
|
"![steak|200x200](upload://zorro.png)",
|
||||||
"alt text updated"
|
"alt text updated"
|
||||||
);
|
);
|
||||||
|
@ -285,7 +266,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
await click(altTextEditCancel);
|
await click(altTextEditCancel);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"![zorro|200x200](upload://zorro.png)",
|
"![zorro|200x200](upload://zorro.png)",
|
||||||
"alt text not updated"
|
"alt text not updated"
|
||||||
);
|
);
|
||||||
|
@ -320,7 +301,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
await triggerKeyEvent(altTextInput, "keypress", 13);
|
await triggerKeyEvent(altTextInput, "keypress", 13);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
`![tomtom|200x200](upload://zorro.png) ![not-zorro|200x200](upload://not-zorro.png)`,
|
`![tomtom|200x200](upload://zorro.png) ![not-zorro|200x200](upload://not-zorro.png)`,
|
||||||
"the correct image's alt text updated"
|
"the correct image's alt text updated"
|
||||||
);
|
);
|
||||||
|
@ -342,7 +323,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
await triggerKeyEvent(altTextInput, "keypress", 13);
|
await triggerKeyEvent(altTextInput, "keypress", 13);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"![|200x200](upload://zorro.png)",
|
"![|200x200](upload://zorro.png)",
|
||||||
"alt text updated"
|
"alt text updated"
|
||||||
);
|
);
|
||||||
|
@ -354,7 +335,7 @@ acceptance("Composer - Image Preview", function (needs) {
|
||||||
await triggerKeyEvent(altTextInput, "keypress", 13);
|
await triggerKeyEvent(altTextInput, "keypress", 13);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"![tomtom|200x200](upload://zorro.png)",
|
"![tomtom|200x200](upload://zorro.png)",
|
||||||
"alt text updated"
|
"alt text updated"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
import {
|
||||||
|
acceptance,
|
||||||
|
query,
|
||||||
|
visible,
|
||||||
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
|
@ -28,8 +32,9 @@ http://www.example.com/has-title.html
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.ok(visible(".d-editor-preview"));
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-preview:visible").html().trim(),
|
query(".d-editor-preview").innerHTML.trim(),
|
||||||
`
|
`
|
||||||
<p><aside class=\"onebox\"><article class=\"onebox-body\"><h3><a href=\"http://www.example.com/article.html\" tabindex=\"-1\">An interesting article</a></h3></article></aside><br>
|
<p><aside class=\"onebox\"><article class=\"onebox-body\"><h3><a href=\"http://www.example.com/article.html\" tabindex=\"-1\">An interesting article</a></h3></article></aside><br>
|
||||||
This is another test <a href=\"http://www.example.com/has-title.html\" class=\"inline-onebox\" tabindex=\"-1\">This is a great title</a></p>
|
This is another test <a href=\"http://www.example.com/has-title.html\" class=\"inline-onebox\" tabindex=\"-1\">This is a great title</a></p>
|
||||||
|
@ -68,14 +73,14 @@ acceptance("Composer - Inline Onebox", function (needs) {
|
||||||
await fillIn(".d-editor-input", `Test www.example.com/page`);
|
await fillIn(".d-editor-input", `Test www.example.com/page`);
|
||||||
assert.strictEqual(requestsCount, 1);
|
assert.strictEqual(requestsCount, 1);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-preview").html().trim(),
|
query(".d-editor-preview").innerHTML.trim(),
|
||||||
'<p>Test <a href="http://www.example.com/page" class="inline-onebox-loading" tabindex="-1">www.example.com/page</a></p>'
|
'<p>Test <a href="http://www.example.com/page" class="inline-onebox-loading" tabindex="-1">www.example.com/page</a></p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn(".d-editor-input", `Test www.example.com/page Test`);
|
await fillIn(".d-editor-input", `Test www.example.com/page Test`);
|
||||||
assert.strictEqual(requestsCount, 1);
|
assert.strictEqual(requestsCount, 1);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-preview").html().trim(),
|
query(".d-editor-preview").innerHTML.trim(),
|
||||||
'<p>Test <a href="http://www.example.com/page" tabindex="-1">www.example.com/page</a> Test</p>'
|
'<p>Test <a href="http://www.example.com/page" tabindex="-1">www.example.com/page</a> Test</p>'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -341,9 +341,8 @@ acceptance("Composer", function (needs) {
|
||||||
|
|
||||||
await click(".topic-post:nth-of-type(1) button.show-more-actions");
|
await click(".topic-post:nth-of-type(1) button.show-more-actions");
|
||||||
await click(".topic-post:nth-of-type(1) button.edit");
|
await click(".topic-post:nth-of-type(1) button.edit");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("Any plans to support"),
|
query(".d-editor-input").value.startsWith("Any plans to support"),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -356,15 +355,15 @@ acceptance("Composer", function (needs) {
|
||||||
"it has the edits icon"
|
"it has the edits icon"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
query("#topic-title h1").innerText.indexOf(
|
query("#topic-title h1").innerText.includes(
|
||||||
"This is the new text for the title"
|
"This is the new text for the title"
|
||||||
) !== -1,
|
),
|
||||||
"it shows the new title"
|
"it shows the new title"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
query(".topic-post:nth-of-type(1) .cooked").innerText.indexOf(
|
query(".topic-post:nth-of-type(1) .cooked").innerText.includes(
|
||||||
"This is the new text for the post"
|
"This is the new text for the post"
|
||||||
) !== -1,
|
),
|
||||||
"it updates the post"
|
"it updates the post"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -406,15 +405,13 @@ acceptance("Composer", function (needs) {
|
||||||
await visit("/t/this-is-a-test-topic/9");
|
await visit("/t/this-is-a-test-topic/9");
|
||||||
|
|
||||||
await click(".topic-post:nth-of-type(1) button.edit");
|
await click(".topic-post:nth-of-type(1) button.edit");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
await click(".topic-post:nth-of-type(2) button.edit");
|
await click(".topic-post:nth-of-type(2) button.edit");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the second post."),
|
query(".d-editor-input").value.startsWith("This is the second post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -431,9 +428,8 @@ acceptance("Composer", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(".modal-footer button.discard-draft");
|
await click(".modal-footer button.discard-draft");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the second post."),
|
query(".d-editor-input").value.startsWith("This is the second post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -442,9 +438,8 @@ acceptance("Composer", function (needs) {
|
||||||
await visit("/t/this-is-a-test-topic/9");
|
await visit("/t/this-is-a-test-topic/9");
|
||||||
|
|
||||||
await click(".topic-post:nth-of-type(1) button.edit");
|
await click(".topic-post:nth-of-type(1) button.edit");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
await click(".topic-post:nth-of-type(1) button.reply");
|
await click(".topic-post:nth-of-type(1) button.reply");
|
||||||
|
@ -454,9 +449,8 @@ acceptance("Composer", function (needs) {
|
||||||
"it clears the input"
|
"it clears the input"
|
||||||
);
|
);
|
||||||
await click(".topic-post:nth-of-type(1) button.edit");
|
await click(".topic-post:nth-of-type(1) button.edit");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -627,9 +621,8 @@ acceptance("Composer", function (needs) {
|
||||||
"it pops up a confirmation dialog"
|
"it pops up a confirmation dialog"
|
||||||
);
|
);
|
||||||
await click(".modal-footer button.discard-draft");
|
await click(".modal-footer button.discard-draft");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -656,9 +649,8 @@ acceptance("Composer", function (needs) {
|
||||||
"has keep editing button"
|
"has keep editing button"
|
||||||
);
|
);
|
||||||
await click(".modal-footer button.save-draft");
|
await click(".modal-footer button.save-draft");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query(".d-editor-input").value.indexOf("This is the second post."),
|
query(".d-editor-input").value.startsWith("This is the second post."),
|
||||||
0,
|
|
||||||
"it populates the input with the post text"
|
"it populates the input with the post text"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -928,7 +920,7 @@ acceptance("Composer - Customizations", function (needs) {
|
||||||
|
|
||||||
function customComposerAction(composer) {
|
function customComposerAction(composer) {
|
||||||
return (
|
return (
|
||||||
(composer.tags || []).indexOf("monkey") !== -1 &&
|
(composer.tags || []).includes("monkey") &&
|
||||||
composer.action === CREATE_TOPIC
|
composer.action === CREATE_TOPIC
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -19,7 +19,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
"it pastes the link into the body and previews it"
|
"it pastes the link into the body and previews it"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -27,7 +27,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
"the body is now good"
|
"the body is now good"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"An interesting article",
|
"An interesting article",
|
||||||
"title is from the oneboxed article"
|
"title is from the oneboxed article"
|
||||||
);
|
);
|
||||||
|
@ -38,7 +38,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
await fillIn("#reply-title", "http://www.example.com/no-title.html");
|
await fillIn("#reply-title", "http://www.example.com/no-title.html");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
"it pastes the link into the body and previews it"
|
"it pastes the link into the body and previews it"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -46,7 +46,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
"the body is now good"
|
"the body is now good"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"http://www.example.com/no-title.html",
|
"http://www.example.com/no-title.html",
|
||||||
"title is unchanged"
|
"title is unchanged"
|
||||||
);
|
);
|
||||||
|
@ -57,7 +57,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
await fillIn("#reply-title", "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
|
await fillIn("#reply-title", "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"Rick Astley - Never Gonna Give You Up (Video)",
|
"Rick Astley - Never Gonna Give You Up (Video)",
|
||||||
"title is from the oneboxed article"
|
"title is from the oneboxed article"
|
||||||
);
|
);
|
||||||
|
@ -68,7 +68,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
await fillIn("#reply-title", "http://www.example.com/nope-onebox.html");
|
await fillIn("#reply-title", "http://www.example.com/nope-onebox.html");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
"it pastes the link into the body and previews it"
|
"it pastes the link into the body and previews it"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -76,7 +76,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
"link is pasted into body"
|
"link is pasted into body"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"http://www.example.com/nope-onebox.html",
|
"http://www.example.com/nope-onebox.html",
|
||||||
"title is unchanged"
|
"title is unchanged"
|
||||||
);
|
);
|
||||||
|
@ -87,18 +87,17 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
const title = "http://" + window.location.hostname + "/internal-page.html";
|
const title = "http://" + window.location.hostname + "/internal-page.html";
|
||||||
await fillIn("#reply-title", title);
|
await fillIn("#reply-title", title);
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox"),
|
!query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
-1,
|
|
||||||
"onebox preview doesn't show"
|
"onebox preview doesn't show"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().length,
|
query(".d-editor-input").value.length,
|
||||||
0,
|
0,
|
||||||
"link isn't put into the post"
|
"link isn't put into the post"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
title,
|
title,
|
||||||
"title is unchanged"
|
"title is unchanged"
|
||||||
);
|
);
|
||||||
|
@ -112,7 +111,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
"http://www.example.com/has-title-and-a-url-that-is-more-than-80-characters-because-thats-good-for-seo-i-guess.html"
|
"http://www.example.com/has-title-and-a-url-that-is-more-than-80-characters-because-thats-good-for-seo-i-guess.html"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
"it pastes the link into the body and previews it"
|
"it pastes the link into the body and previews it"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -120,7 +119,7 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
"the body is now good"
|
"the body is now good"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"An interesting article",
|
"An interesting article",
|
||||||
"title is from the oneboxed article"
|
"title is from the oneboxed article"
|
||||||
);
|
);
|
||||||
|
@ -130,18 +129,17 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
|
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox"),
|
!query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
-1,
|
|
||||||
"onebox preview doesn't show"
|
"onebox preview doesn't show"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().length,
|
query(".d-editor-input").value.length,
|
||||||
0,
|
0,
|
||||||
"link isn't put into the post"
|
"link isn't put into the post"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"http://www.example.com/has-title.html test",
|
"http://www.example.com/has-title.html test",
|
||||||
"title is unchanged"
|
"title is unchanged"
|
||||||
);
|
);
|
||||||
|
@ -155,14 +153,14 @@ acceptance("Composer topic featured links", function (needs) {
|
||||||
"https://twitter.com/discourse/status/1357664660724482048"
|
"https://twitter.com/discourse/status/1357664660724482048"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
"it pastes the link into the body and previews it"
|
"it pastes the link into the body and previews it"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
exists(".d-editor-textarea-wrapper .popup-tip.good"),
|
||||||
"the body is now good"
|
"the body is now good"
|
||||||
);
|
);
|
||||||
assert.blank(queryAll(".title-input input").val(), "title is blank");
|
assert.blank(query(".title-input input").value, "title is blank");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -186,7 +184,7 @@ acceptance(
|
||||||
);
|
);
|
||||||
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
query(".d-editor-preview").innerHTML.trim().includes("onebox"),
|
||||||
"it pastes the link into the body and previews it"
|
"it pastes the link into the body and previews it"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -194,7 +192,7 @@ acceptance(
|
||||||
"the body is now good"
|
"the body is now good"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".title-input input").val(),
|
query(".title-input input").value,
|
||||||
"An interesting article",
|
"An interesting article",
|
||||||
"title is from the oneboxed article"
|
"title is from the oneboxed article"
|
||||||
);
|
);
|
||||||
|
|
|
@ -151,7 +151,7 @@ acceptance("Invites - Email Invites", function (needs) {
|
||||||
assert.ok(exists(".save-invite"), "shows save without email button");
|
assert.ok(exists(".save-invite"), "shows save without email button");
|
||||||
await click(".save-invite");
|
await click(".save-invite");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
lastRequest.requestBody.indexOf("skip_email=true") !== -1,
|
lastRequest.requestBody.includes("skip_email=true"),
|
||||||
"sends skip_email to server"
|
"sends skip_email to server"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ acceptance("Invites - Email Invites", function (needs) {
|
||||||
assert.ok(exists(".send-invite"), "shows save and send email button");
|
assert.ok(exists(".send-invite"), "shows save and send email button");
|
||||||
await click(".send-invite");
|
await click(".send-invite");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
lastRequest.requestBody.indexOf("send_email=true") !== -1,
|
lastRequest.requestBody.includes("send_email=true"),
|
||||||
"sends send_email to server"
|
"sends send_email to server"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
|
@ -46,6 +47,7 @@ acceptance("Dashboard", function (needs) {
|
||||||
|
|
||||||
test("general tab", async function (assert) {
|
test("general tab", async function (assert) {
|
||||||
await visit("/admin");
|
await visit("/admin");
|
||||||
|
|
||||||
assert.ok(exists(".admin-report.signups"), "signups report");
|
assert.ok(exists(".admin-report.signups"), "signups report");
|
||||||
assert.ok(exists(".admin-report.posts"), "posts report");
|
assert.ok(exists(".admin-report.posts"), "posts report");
|
||||||
assert.ok(exists(".admin-report.dau-by-mau"), "dau-by-mau report");
|
assert.ok(exists(".admin-report.dau-by-mau"), "dau-by-mau report");
|
||||||
|
@ -57,11 +59,10 @@ acceptance("Dashboard", function (needs) {
|
||||||
exists(".admin-report.new-contributors"),
|
exists(".admin-report.new-contributors"),
|
||||||
"new-contributors report"
|
"new-contributors report"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
$(".section.dashboard-problems .problem-messages ul li:first-child")
|
query(
|
||||||
.html()
|
".section.dashboard-problems .problem-messages ul li:first-child"
|
||||||
.trim(),
|
).innerHTML.trim(),
|
||||||
"Houston...",
|
"Houston...",
|
||||||
"displays problems"
|
"displays problems"
|
||||||
);
|
);
|
||||||
|
@ -81,16 +82,14 @@ acceptance("Dashboard", function (needs) {
|
||||||
await click(".dashboard .navigation-item.reports .navigation-link");
|
await click(".dashboard .navigation-item.reports .navigation-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".dashboard .reports-index.section .reports-list .report")
|
count(".dashboard .reports-index.section .reports-list .report"),
|
||||||
.length,
|
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn(".dashboard .filter-reports-input", "flags");
|
await fillIn(".dashboard .filter-reports-input", "flags");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".dashboard .reports-index.section .reports-list .report")
|
count(".dashboard .reports-index.section .reports-list .report"),
|
||||||
.length,
|
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -98,8 +97,7 @@ acceptance("Dashboard", function (needs) {
|
||||||
await click(".dashboard .navigation-item.reports .navigation-link");
|
await click(".dashboard .navigation-item.reports .navigation-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".dashboard .reports-index.section .reports-list .report")
|
count(".dashboard .reports-index.section .reports-list .report"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"navigating back and forth resets filter"
|
"navigating back and forth resets filter"
|
||||||
);
|
);
|
||||||
|
@ -107,8 +105,7 @@ acceptance("Dashboard", function (needs) {
|
||||||
await fillIn(".dashboard .filter-reports-input", "activities");
|
await fillIn(".dashboard .filter-reports-input", "activities");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".dashboard .reports-index.section .reports-list .report")
|
count(".dashboard .reports-index.section .reports-list .report"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"filter is case insensitive"
|
"filter is case insensitive"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
|
@ -56,7 +57,7 @@ acceptance("Do not disturb", function (needs) {
|
||||||
assert.ok(exists(".do-not-disturb-modal"), "DND modal is displayed");
|
assert.ok(exists(".do-not-disturb-modal"), "DND modal is displayed");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".do-not-disturb-tile").length,
|
count(".do-not-disturb-tile"),
|
||||||
4,
|
4,
|
||||||
"There are 4 duration choices"
|
"There are 4 duration choices"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
|
@ -45,7 +46,7 @@ acceptance("EmojiPicker", function (needs) {
|
||||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
":grinning:",
|
":grinning:",
|
||||||
"it adds the emoji code in the editor when selected"
|
"it adds the emoji code in the editor when selected"
|
||||||
);
|
);
|
||||||
|
@ -60,7 +61,7 @@ acceptance("EmojiPicker", function (needs) {
|
||||||
await click("button.emoji.btn");
|
await click("button.emoji.btn");
|
||||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"This is a test input :grinning:",
|
"This is a test input :grinning:",
|
||||||
"it adds the emoji code and a leading whitespace when there is text"
|
"it adds the emoji code and a leading whitespace when there is text"
|
||||||
);
|
);
|
||||||
|
@ -70,7 +71,7 @@ acceptance("EmojiPicker", function (needs) {
|
||||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
"This is a test input :grinning:",
|
"This is a test input :grinning:",
|
||||||
"it adds the emoji code and no leading whitespace when user already entered whitespace"
|
"it adds the emoji code and no leading whitespace when user already entered whitespace"
|
||||||
);
|
);
|
||||||
|
@ -122,15 +123,14 @@ acceptance("EmojiPicker", function (needs) {
|
||||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll('.section[data-section="recent"] .section-group img.emoji')
|
count('.section[data-section="recent"] .section-group img.emoji'),
|
||||||
.length,
|
|
||||||
2,
|
2,
|
||||||
"it has multiple recent emojis"
|
"it has multiple recent emojis"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
/grinning/.test(
|
/grinning/.test(
|
||||||
queryAll(".section.recent .section-group img.emoji").first().attr("src")
|
query(".section.recent .section-group img.emoji").getAttribute("src")
|
||||||
),
|
),
|
||||||
true,
|
true,
|
||||||
"it puts the last used emoji in first"
|
"it puts the last used emoji in first"
|
||||||
|
|
|
@ -2,7 +2,8 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
normalizeHtml,
|
normalizeHtml,
|
||||||
queryAll,
|
query,
|
||||||
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -16,8 +17,9 @@ acceptance("Emoji", function (needs) {
|
||||||
await click("#topic-footer-buttons .btn.create");
|
await click("#topic-footer-buttons .btn.create");
|
||||||
|
|
||||||
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:");
|
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:");
|
||||||
|
assert.ok(visible(".d-editor-preview"));
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
normalizeHtml(queryAll(".d-editor-preview:visible").html().trim()),
|
normalizeHtml(query(".d-editor-preview").innerHTML.trim()),
|
||||||
normalizeHtml(
|
normalizeHtml(
|
||||||
`<p>this is an emoji <img src="/images/emoji/google_classic/blonde_woman.png?v=${v}" title=":blonde_woman:" class="emoji" alt=":blonde_woman:" loading="lazy" width="20" height="20" style="aspect-ratio: 20 / 20;"></p>`
|
`<p>this is an emoji <img src="/images/emoji/google_classic/blonde_woman.png?v=${v}" title=":blonde_woman:" class="emoji" alt=":blonde_woman:" loading="lazy" width="20" height="20" style="aspect-ratio: 20 / 20;"></p>`
|
||||||
)
|
)
|
||||||
|
@ -30,8 +32,9 @@ acceptance("Emoji", function (needs) {
|
||||||
|
|
||||||
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:");
|
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:");
|
||||||
|
|
||||||
|
assert.ok(visible(".d-editor-preview"));
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
normalizeHtml(queryAll(".d-editor-preview:visible").html().trim()),
|
normalizeHtml(query(".d-editor-preview").innerHTML.trim()),
|
||||||
normalizeHtml(
|
normalizeHtml(
|
||||||
`<p>this is an emoji <img src="/images/emoji/google_classic/blonde_woman/5.png?v=${v}" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:" loading="lazy" width="20" height="20" style="aspect-ratio: 20 / 20;"></p>`
|
`<p>this is an emoji <img src="/images/emoji/google_classic/blonde_woman/5.png?v=${v}" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:" loading="lazy" width="20" height="20" style="aspect-ratio: 20 / 20;"></p>`
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,15 +43,22 @@ acceptance("Encoded Sub Category Discovery", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Visit subcategory by slug", async function (assert) {
|
test("Visit subcategory by slug", async function (assert) {
|
||||||
let bodySelector =
|
const bodyClass =
|
||||||
"body.category-\\%E6\\%BC\\%A2\\%E5\\%AD\\%97-parent-\\%E6\\%BC\\%A2\\%E5\\%AD\\%97-subcategory";
|
"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");
|
await visit("/c/%E6%BC%A2%E5%AD%97-parent/%E6%BC%A2%E5%AD%97-subcategory");
|
||||||
assert.ok($(bodySelector).length, "has the default navigation");
|
assert.ok(
|
||||||
|
document.body.classList.contains(bodyClass),
|
||||||
|
"has the default navigation"
|
||||||
|
);
|
||||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||||
|
|
||||||
await visit("/c/漢字-parent/漢字-subcategory");
|
await visit("/c/漢字-parent/漢字-subcategory");
|
||||||
assert.ok($(bodySelector).length, "has the default navigation");
|
assert.ok(
|
||||||
|
document.body.classList.contains(bodyClass),
|
||||||
|
"has the default navigation"
|
||||||
|
);
|
||||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
@ -23,9 +23,8 @@ acceptance("Forgot password", function (needs) {
|
||||||
await click("header .login-button");
|
await click("header .login-button");
|
||||||
await click("#forgot-password-link");
|
await click("#forgot-password-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
queryAll(".forgot-password-reset").attr("disabled"),
|
query(".forgot-password-reset").disabled,
|
||||||
"disabled",
|
|
||||||
"it should disable the button until the field is filled"
|
"it should disable the button until the field is filled"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -33,7 +32,7 @@ acceptance("Forgot password", function (needs) {
|
||||||
await click(".forgot-password-reset");
|
await click(".forgot-password-reset");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-error").html().trim(),
|
query(".alert-error").innerHTML.trim(),
|
||||||
I18n.t("forgot_password.complete_username_not_found", {
|
I18n.t("forgot_password.complete_username_not_found", {
|
||||||
username: "someuser",
|
username: "someuser",
|
||||||
}),
|
}),
|
||||||
|
@ -44,7 +43,7 @@ acceptance("Forgot password", function (needs) {
|
||||||
await click(".forgot-password-reset");
|
await click(".forgot-password-reset");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-error").html().trim(),
|
query(".alert-error").innerHTML.trim(),
|
||||||
I18n.t("forgot_password.complete_email_not_found", {
|
I18n.t("forgot_password.complete_email_not_found", {
|
||||||
email: "someuser@gmail.com",
|
email: "someuser@gmail.com",
|
||||||
}),
|
}),
|
||||||
|
@ -63,7 +62,7 @@ acceptance("Forgot password", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".modal-body").html().trim(),
|
query(".modal-body").innerHTML.trim(),
|
||||||
I18n.t("forgot_password.complete_username_found", {
|
I18n.t("forgot_password.complete_username_found", {
|
||||||
username: "someuser",
|
username: "someuser",
|
||||||
}),
|
}),
|
||||||
|
@ -77,7 +76,7 @@ acceptance("Forgot password", function (needs) {
|
||||||
await click(".forgot-password-reset");
|
await click(".forgot-password-reset");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".modal-body").html().trim(),
|
query(".modal-body").innerHTML.trim(),
|
||||||
I18n.t("forgot_password.complete_email_found", {
|
I18n.t("forgot_password.complete_email_found", {
|
||||||
email: "someuser@gmail.com",
|
email: "someuser@gmail.com",
|
||||||
}),
|
}),
|
||||||
|
@ -100,9 +99,8 @@ acceptance(
|
||||||
await click("header .login-button");
|
await click("header .login-button");
|
||||||
await click("#forgot-password-link");
|
await click("#forgot-password-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
queryAll(".forgot-password-reset").attr("disabled"),
|
query(".forgot-password-reset").disabled,
|
||||||
"disabled",
|
|
||||||
"it should disable the button until the field is filled"
|
"it should disable the button until the field is filled"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -110,7 +108,7 @@ acceptance(
|
||||||
await click(".forgot-password-reset");
|
await click(".forgot-password-reset");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".modal-body").html().trim(),
|
query(".modal-body").innerHTML.trim(),
|
||||||
I18n.t("forgot_password.complete_username", {
|
I18n.t("forgot_password.complete_username", {
|
||||||
username: "someuser",
|
username: "someuser",
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
count,
|
count,
|
||||||
exists,
|
exists,
|
||||||
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
@ -14,8 +15,9 @@ acceptance("Group Members - Anonymous", function () {
|
||||||
test("Viewing Members as anon user", async function (assert) {
|
test("Viewing Members as anon user", async function (assert) {
|
||||||
await visit("/g/discourse");
|
await visit("/g/discourse");
|
||||||
|
|
||||||
assert.ok(
|
assert.strictEqual(
|
||||||
count(".avatar-flair .d-icon-adjust") === 1,
|
count(".avatar-flair .d-icon-adjust"),
|
||||||
|
1,
|
||||||
"it displays the group's avatar flair"
|
"it displays the group's avatar flair"
|
||||||
);
|
);
|
||||||
assert.ok(exists(".group-members tr"), "it lists group members");
|
assert.ok(exists(".group-members tr"), "it lists group members");
|
||||||
|
@ -26,7 +28,7 @@ acceptance("Group Members - Anonymous", function () {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".group-username-filter").attr("placeholder"),
|
query(".group-username-filter").getAttribute("placeholder"),
|
||||||
I18n.t("groups.members.filter_placeholder"),
|
I18n.t("groups.members.filter_placeholder"),
|
||||||
"it should display the right filter placeholder"
|
"it should display the right filter placeholder"
|
||||||
);
|
);
|
||||||
|
@ -64,7 +66,7 @@ acceptance("Group Members", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".group-username-filter").attr("placeholder"),
|
query(".group-username-filter").getAttribute("placeholder"),
|
||||||
I18n.t("groups.members.filter_placeholder_admin"),
|
I18n.t("groups.members.filter_placeholder_admin"),
|
||||||
"it should display the right filter placeholder"
|
"it should display the right filter placeholder"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -22,7 +22,7 @@ acceptance("Login with email - hide email address taken", function (needs) {
|
||||||
await click("#email-login-link");
|
await click("#email-login-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-success").html().trim(),
|
query(".alert-success").innerHTML.trim(),
|
||||||
I18n.t("email_login.complete_email_found", {
|
I18n.t("email_login.complete_email_found", {
|
||||||
email: "someuser@example.com",
|
email: "someuser@example.com",
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
@ -38,7 +38,7 @@ acceptance("Login with email", function (needs) {
|
||||||
await click("#email-login-link");
|
await click("#email-login-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-error").html(),
|
query(".alert-error").innerHTML,
|
||||||
I18n.t("email_login.complete_username_not_found", {
|
I18n.t("email_login.complete_username_not_found", {
|
||||||
username: "someuser",
|
username: "someuser",
|
||||||
}),
|
}),
|
||||||
|
@ -49,7 +49,7 @@ acceptance("Login with email", function (needs) {
|
||||||
await click("#email-login-link");
|
await click("#email-login-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-error").html(),
|
query(".alert-error").innerHTML,
|
||||||
I18n.t("email_login.complete_email_not_found", {
|
I18n.t("email_login.complete_email_not_found", {
|
||||||
email: "someuser@gmail.com",
|
email: "someuser@gmail.com",
|
||||||
}),
|
}),
|
||||||
|
@ -63,7 +63,7 @@ acceptance("Login with email", function (needs) {
|
||||||
await click("#email-login-link");
|
await click("#email-login-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-success").html().trim(),
|
query(".alert-success").innerHTML.trim(),
|
||||||
I18n.t("email_login.complete_username_found", { username: "someuser" }),
|
I18n.t("email_login.complete_username_found", { username: "someuser" }),
|
||||||
"it should display a success message for a valid username"
|
"it should display a success message for a valid username"
|
||||||
);
|
);
|
||||||
|
@ -74,7 +74,7 @@ acceptance("Login with email", function (needs) {
|
||||||
await click("#email-login-link");
|
await click("#email-login-link");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".alert-success").html().trim(),
|
query(".alert-success").innerHTML.trim(),
|
||||||
I18n.t("email_login.complete_email_found", {
|
I18n.t("email_login.complete_email_found", {
|
||||||
email: "someuser@gmail.com",
|
email: "someuser@gmail.com",
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
@ -14,7 +14,9 @@ acceptance("Topic Discovery - Mobile", function (needs) {
|
||||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll("a[data-user-card=codinghorror] img.avatar").attr("loading"),
|
query("a[data-user-card=codinghorror] img.avatar").getAttribute(
|
||||||
|
"loading"
|
||||||
|
),
|
||||||
"lazy",
|
"lazy",
|
||||||
"it adds loading=`lazy` to topic list avatars"
|
"it adds loading=`lazy` to topic list avatars"
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
@ -27,12 +27,12 @@ acceptance("New Message - Authenticated", function (needs) {
|
||||||
|
|
||||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll("#reply-title").val().trim(),
|
query("#reply-title").value.trim(),
|
||||||
"message title",
|
"message title",
|
||||||
"it pre-fills message title"
|
"it pre-fills message title"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
"message body",
|
"message body",
|
||||||
"it pre-fills message body"
|
"it pre-fills message body"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -24,12 +24,12 @@ acceptance("New Topic - Authenticated", function (needs) {
|
||||||
|
|
||||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll("#reply-title").val().trim(),
|
query("#reply-title").value.trim(),
|
||||||
"topic title",
|
"topic title",
|
||||||
"it pre-fills topic title"
|
"it pre-fills topic title"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
"topic body",
|
"topic body",
|
||||||
"it pre-fills topic body"
|
"it pre-fills topic body"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
@ -73,9 +73,9 @@ acceptance("Password Reset", function (needs) {
|
||||||
await fillIn(".password-reset input", "123");
|
await fillIn(".password-reset input", "123");
|
||||||
assert.ok(exists(".password-reset .tip.bad"), "input is not valid");
|
assert.ok(exists(".password-reset .tip.bad"), "input is not valid");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".password-reset .tip.bad")
|
query(".password-reset .tip.bad").innerHTML.includes(
|
||||||
.html()
|
I18n.t("user.password.too_short")
|
||||||
.indexOf(I18n.t("user.password.too_short")) > -1,
|
),
|
||||||
"password too short"
|
"password too short"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -83,9 +83,9 @@ acceptance("Password Reset", function (needs) {
|
||||||
await click(".password-reset form button");
|
await click(".password-reset form button");
|
||||||
assert.ok(exists(".password-reset .tip.bad"), "input is not valid");
|
assert.ok(exists(".password-reset .tip.bad"), "input is not valid");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".password-reset .tip.bad")
|
query(".password-reset .tip.bad").innerHTML.includes(
|
||||||
.html()
|
"is the name of your cat"
|
||||||
.indexOf("is the name of your cat") > -1,
|
),
|
||||||
"server validation error message shows"
|
"server validation error message shows"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ acceptance("Password Reset", function (needs) {
|
||||||
assert.ok(exists(".alert-error"), "shows 2 factor error");
|
assert.ok(exists(".alert-error"), "shows 2 factor error");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".alert-error").html().indexOf("invalid token") > -1,
|
query(".alert-error").innerHTML.includes("invalid token"),
|
||||||
"shows server validation error message"
|
"shows server validation error message"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,17 @@ acceptance("Plugin Keyboard Shortcuts - Logged In", function (needs) {
|
||||||
|
|
||||||
withPluginApi("0.8.38", (api) => {
|
withPluginApi("0.8.38", (api) => {
|
||||||
api.addKeyboardShortcut("]", () => {
|
api.addKeyboardShortcut("]", () => {
|
||||||
$("#qunit-fixture").html(
|
document.querySelector(
|
||||||
"<div id='added-element'>Test adding plugin shortcut</div>"
|
"#qunit-fixture"
|
||||||
);
|
).innerHTML = `<div id="added-element">Test adding plugin shortcut</div>`;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit("/t/this-is-a-test-topic/9");
|
await visit("/t/this-is-a-test-topic/9");
|
||||||
await triggerKeyEvent(document, "keypress", "]".charCodeAt(0));
|
await triggerKeyEvent(document, "keypress", "]".charCodeAt(0));
|
||||||
assert.strictEqual(
|
|
||||||
$("#added-element").length,
|
assert.ok(
|
||||||
1,
|
document.querySelector("#added-element"),
|
||||||
"the keyboard shortcut callback fires successfully"
|
"the keyboard shortcut callback fires successfully"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -70,6 +70,7 @@ acceptance("Plugin Keyboard Shortcuts - Anonymous", function () {
|
||||||
});
|
});
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));
|
await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));
|
||||||
|
|
||||||
assert.ok(exists(".shortcut-category-new_category"));
|
assert.ok(exists(".shortcut-category-new_category"));
|
||||||
assert.strictEqual(count(".shortcut-category-new_category li"), 1);
|
assert.strictEqual(count(".shortcut-category-new_category li"), 1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,9 +41,15 @@ acceptance("Post controls", function () {
|
||||||
I18n.t("post.actions.people.sr_post_likers_list_description"),
|
I18n.t("post.actions.people.sr_post_likers_list_description"),
|
||||||
"likes container has aria-label"
|
"likes container has aria-label"
|
||||||
);
|
);
|
||||||
const likesAvatars = Array.from(
|
assert.equal(
|
||||||
likesContainer.querySelectorAll("a.trigger-user-card")
|
likesContainer
|
||||||
|
.querySelector(".list-description")
|
||||||
|
.getAttribute("aria-hidden"),
|
||||||
|
"true",
|
||||||
|
"list description is aria-hidden"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const likesAvatars = likesContainer.querySelectorAll("a.trigger-user-card");
|
||||||
assert.ok(likesAvatars.length > 0, "avatars are rendered");
|
assert.ok(likesAvatars.length > 0, "avatars are rendered");
|
||||||
likesAvatars.forEach((avatar) => {
|
likesAvatars.forEach((avatar) => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -57,13 +63,6 @@ acceptance("Post controls", function () {
|
||||||
"avatars have listitem role"
|
"avatars have listitem role"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
assert.equal(
|
|
||||||
likesContainer
|
|
||||||
.querySelector(".list-description")
|
|
||||||
.getAttribute("aria-hidden"),
|
|
||||||
"true",
|
|
||||||
"list description is aria-hidden"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("accessibility of the embedded replies below the post", async function (assert) {
|
test("accessibility of the embedded replies below the post", async function (assert) {
|
||||||
|
|
|
@ -240,7 +240,7 @@ acceptance("User Preferences", function (needs) {
|
||||||
await click(".add-security-key");
|
await click(".add-security-key");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
query(".alert-error").innerHTML.indexOf("provide a name") > -1,
|
query(".alert-error").innerHTML.includes("provide a name"),
|
||||||
"shows name missing error message"
|
"shows name missing error message"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import {
|
||||||
|
acceptance,
|
||||||
|
count,
|
||||||
|
exists,
|
||||||
|
query,
|
||||||
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
|
@ -8,17 +13,17 @@ acceptance("Reports", function (needs) {
|
||||||
test("Visit reports page", async function (assert) {
|
test("Visit reports page", async function (assert) {
|
||||||
await visit("/admin/reports");
|
await visit("/admin/reports");
|
||||||
|
|
||||||
assert.strictEqual($(".reports-list .report").length, 1);
|
assert.strictEqual(count(".reports-list .report"), 1);
|
||||||
|
|
||||||
const $report = $(".reports-list .report:first-child");
|
const report = query(".reports-list .report:first-child");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
$report.find(".report-title").html().trim(),
|
report.querySelector(".report-title").innerHTML.trim(),
|
||||||
"My report"
|
"My report"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
$report.find(".report-description").html().trim(),
|
report.querySelector(".report-description").innerHTML.trim(),
|
||||||
"List of my activities"
|
"List of my activities"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
count,
|
count,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
selectDate,
|
selectDate,
|
||||||
visible,
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
@ -112,7 +112,10 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
test("perform various searches", async function (assert) {
|
test("perform various searches", async function (assert) {
|
||||||
await visit("/search");
|
await visit("/search");
|
||||||
|
|
||||||
assert.ok($("body.search-page").length, "has body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("search-page"),
|
||||||
|
"has body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".search-container"), "has container class");
|
assert.ok(exists(".search-container"), "has container class");
|
||||||
assert.ok(exists(".search-query"));
|
assert.ok(exists(".search-query"));
|
||||||
assert.ok(!exists(".fps-topic"));
|
assert.ok(!exists(".fps-topic"));
|
||||||
|
@ -177,7 +180,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
'has "faq" populated'
|
'has "faq" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none #faq",
|
"none #faq",
|
||||||
'has updated search term to "none #faq"'
|
'has updated search term to "none #faq"'
|
||||||
);
|
);
|
||||||
|
@ -201,7 +204,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
'has "快乐的" populated'
|
'has "快乐的" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none category:240",
|
"none category:240",
|
||||||
'has updated search term to "none category:240"'
|
'has updated search term to "none category:240"'
|
||||||
);
|
);
|
||||||
|
@ -217,7 +220,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
'has "in title" populated'
|
'has "in title" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none in:title",
|
"none in:title",
|
||||||
'has updated search term to "none in:title"'
|
'has updated search term to "none in:title"'
|
||||||
);
|
);
|
||||||
|
@ -240,7 +243,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
'has "I liked" populated'
|
'has "I liked" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none in:likes",
|
"none in:likes",
|
||||||
'has updated search term to "none in:likes"'
|
'has updated search term to "none in:likes"'
|
||||||
);
|
);
|
||||||
|
@ -257,7 +260,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none in:messages",
|
"none in:messages",
|
||||||
'has updated search term to "none in:messages"'
|
'has updated search term to "none in:messages"'
|
||||||
);
|
);
|
||||||
|
@ -281,7 +284,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none in:seen",
|
"none in:seen",
|
||||||
"it should update the search term"
|
"it should update the search term"
|
||||||
);
|
);
|
||||||
|
@ -310,7 +313,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
'has "I bookmarked" populated'
|
'has "I bookmarked" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none in:bookmarks",
|
"none in:bookmarks",
|
||||||
'has updated search term to "none in:bookmarks"'
|
'has updated search term to "none in:bookmarks"'
|
||||||
);
|
);
|
||||||
|
@ -334,7 +337,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
'has "are closed" populated'
|
'has "are closed" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none status:closed",
|
"none status:closed",
|
||||||
'has updated search term to "none status:closed"'
|
'has updated search term to "none status:closed"'
|
||||||
);
|
);
|
||||||
|
@ -376,7 +379,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
await visit("/search?expanded=true&q=after:2018-08-22");
|
await visit("/search?expanded=true&q=after:2018-08-22");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"after:2018-08-22",
|
"after:2018-08-22",
|
||||||
"it should update the search term correctly"
|
"it should update the search term correctly"
|
||||||
);
|
);
|
||||||
|
@ -400,7 +403,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none after:2016-10-05",
|
"none after:2016-10-05",
|
||||||
'has updated search term to "none after:2016-10-05"'
|
'has updated search term to "none after:2016-10-05"'
|
||||||
);
|
);
|
||||||
|
@ -413,14 +416,12 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
await fillIn("#search-min-post-count", "5");
|
await fillIn("#search-min-post-count", "5");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(
|
query(".search-advanced-additional-options #search-min-post-count").value,
|
||||||
".search-advanced-additional-options #search-min-post-count"
|
|
||||||
).val(),
|
|
||||||
"5",
|
"5",
|
||||||
'has "5" populated'
|
'has "5" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none min_posts:5",
|
"none min_posts:5",
|
||||||
'has updated search term to "none min_posts:5"'
|
'has updated search term to "none min_posts:5"'
|
||||||
);
|
);
|
||||||
|
@ -433,14 +434,12 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
await fillIn("#search-max-post-count", "5");
|
await fillIn("#search-max-post-count", "5");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(
|
query(".search-advanced-additional-options #search-max-post-count").value,
|
||||||
".search-advanced-additional-options #search-max-post-count"
|
|
||||||
).val(),
|
|
||||||
"5",
|
"5",
|
||||||
'has "5" populated'
|
'has "5" populated'
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"none max_posts:5",
|
"none max_posts:5",
|
||||||
'has updated search term to "none max_posts:5"'
|
'has updated search term to "none max_posts:5"'
|
||||||
);
|
);
|
||||||
|
@ -456,7 +455,7 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".search-query").val(),
|
query(".search-query").value,
|
||||||
"in:likes",
|
"in:likes",
|
||||||
'has updated search term to "in:likes"'
|
'has updated search term to "in:likes"'
|
||||||
);
|
);
|
||||||
|
@ -583,11 +582,11 @@ acceptance("Search - Full Page", function (needs) {
|
||||||
|
|
||||||
await fillIn(".search-query", "discourse");
|
await fillIn(".search-query", "discourse");
|
||||||
await click(".search-cta");
|
await click(".search-cta");
|
||||||
assert.equal(queryAll(".visited").length, 0);
|
assert.equal(count(".visited"), 0);
|
||||||
|
|
||||||
await fillIn(".search-query", "discourse visited");
|
await fillIn(".search-query", "discourse visited");
|
||||||
await click(".search-cta");
|
await click(".search-cta");
|
||||||
assert.equal(queryAll(".visited").length, 1);
|
assert.equal(count(".visited"), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("result link click tracking is invoked", async function (assert) {
|
test("result link click tracking is invoked", async function (assert) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
count,
|
count,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -42,7 +42,7 @@ acceptance("Search - Mobile", function (needs) {
|
||||||
await click("#search-button");
|
await click("#search-button");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll("input.full-page-search").val(),
|
query("input.full-page-search").value,
|
||||||
"discourse",
|
"discourse",
|
||||||
"it does not reset input when hitting search icon again"
|
"it does not reset input when hitting search icon again"
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -45,9 +44,9 @@ acceptance("Share and Invite modal", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll("input.invite-link")
|
query("input.invite-link").value.includes(
|
||||||
.val()
|
"/t/internationalization-localization/280?u=eviltrout"
|
||||||
.includes("/t/internationalization-localization/280?u=eviltrout"),
|
),
|
||||||
"it shows the topic sharing url"
|
"it shows the topic sharing url"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ acceptance("Share url with badges disabled - desktop", function (needs) {
|
||||||
await click("#topic-footer-button-share-and-invite");
|
await click("#topic-footer-button-share-and-invite");
|
||||||
|
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
queryAll("input.invite-link").val().includes("?u=eviltrout"),
|
query("input.invite-link").value.includes("?u=eviltrout"),
|
||||||
"it doesn't add the username param when badges are disabled"
|
"it doesn't add the username param when badges are disabled"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
publishToMessageBus,
|
publishToMessageBus,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import Site from "discourse/models/site";
|
import Site from "discourse/models/site";
|
||||||
|
@ -39,7 +37,7 @@ acceptance(
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link").length,
|
count(".sidebar-section-categories .sidebar-section-link"),
|
||||||
1,
|
1,
|
||||||
"there should only be one section link under the section"
|
"there should only be one section link under the section"
|
||||||
);
|
);
|
||||||
|
@ -161,7 +159,7 @@ acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link").length,
|
count(".sidebar-section-categories .sidebar-section-link"),
|
||||||
2,
|
2,
|
||||||
"there should only be two section link under the section"
|
"there should only be two section link under the section"
|
||||||
);
|
);
|
||||||
|
@ -186,8 +184,7 @@ acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link.active")
|
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -206,8 +203,7 @@ acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link.active")
|
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -224,8 +220,7 @@ acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
await visit(`/c/${category1.slug}/${category1.id}/l/new`);
|
await visit(`/c/${category1.slug}/${category1.id}/l/new`);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link.active")
|
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -242,8 +237,7 @@ acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
await visit(`/c/${category1.slug}/${category1.id}/l/unread`);
|
await visit(`/c/${category1.slug}/${category1.id}/l/unread`);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link.active")
|
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -260,8 +254,7 @@ acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
await visit(`/c/${category1.slug}/${category1.id}/l/top`);
|
await visit(`/c/${category1.slug}/${category1.id}/l/top`);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-categories .sidebar-section-link.active")
|
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
publishToMessageBus,
|
publishToMessageBus,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||||
|
@ -71,7 +69,6 @@ acceptance(
|
||||||
|
|
||||||
test("clicking on section header button", async function (assert) {
|
test("clicking on section header button", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
await click(".sidebar-section-messages .sidebar-section-header-button");
|
await click(".sidebar-section-messages .sidebar-section-header-button");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -87,7 +84,7 @@ acceptance(
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/u/eviltrout/messages`,
|
`/u/eviltrout/messages`,
|
||||||
"it should transistion to the user's messages"
|
"it should transition to the user's messages"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -102,7 +99,7 @@ acceptance(
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link").length,
|
count(".sidebar-section-messages .sidebar-section-link"),
|
||||||
1,
|
1,
|
||||||
"only displays the personal message inbox link"
|
"only displays the personal message inbox link"
|
||||||
);
|
);
|
||||||
|
@ -119,7 +116,7 @@ acceptance(
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link").length,
|
count(".sidebar-section-messages .sidebar-section-link"),
|
||||||
5,
|
5,
|
||||||
"expands and displays the links for personal messages"
|
"expands and displays the links for personal messages"
|
||||||
);
|
);
|
||||||
|
@ -144,8 +141,7 @@ acceptance(
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.active")
|
count(".sidebar-section-messages .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
2,
|
2,
|
||||||
"only two links are marked as active in the sidebar"
|
"only two links are marked as active in the sidebar"
|
||||||
);
|
);
|
||||||
|
@ -203,14 +199,13 @@ acceptance(
|
||||||
await visit("/u/eviltrout/messages/group/GrOuP1");
|
await visit("/u/eviltrout/messages/group/GrOuP1");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link").length,
|
count(".sidebar-section-messages .sidebar-section-link"),
|
||||||
6,
|
6,
|
||||||
"expands and displays the links for group1 group messages"
|
"expands and displays the links for group1 group messages"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.group1")
|
count(".sidebar-section-messages .sidebar-section-link.group1"),
|
||||||
.length,
|
|
||||||
4,
|
4,
|
||||||
"expands the links for group1 group messages"
|
"expands the links for group1 group messages"
|
||||||
);
|
);
|
||||||
|
@ -220,15 +215,13 @@ acceptance(
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.group1")
|
count(".sidebar-section-messages .sidebar-section-link.group1"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"collapses the links for group1 group messages"
|
"collapses the links for group1 group messages"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.group3")
|
count(".sidebar-section-messages .sidebar-section-link.group3"),
|
||||||
.length,
|
|
||||||
4,
|
4,
|
||||||
"expands the links for group3 group messages"
|
"expands the links for group3 group messages"
|
||||||
);
|
);
|
||||||
|
@ -270,8 +263,7 @@ acceptance(
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.active")
|
count(".sidebar-section-messages .sidebar-section-link.active"),
|
||||||
.length,
|
|
||||||
2,
|
2,
|
||||||
"only two links are marked as active in the sidebar"
|
"only two links are marked as active in the sidebar"
|
||||||
);
|
);
|
||||||
|
@ -305,22 +297,21 @@ acceptance(
|
||||||
await visit("/t/130");
|
await visit("/t/130");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link").length,
|
count(".sidebar-section-messages .sidebar-section-link"),
|
||||||
5,
|
5,
|
||||||
"5 section links are displayed"
|
"5 section links are displayed"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(
|
count(
|
||||||
".sidebar-section-messages .sidebar-section-link.personal-messages"
|
".sidebar-section-messages .sidebar-section-link.personal-messages"
|
||||||
).length,
|
),
|
||||||
1,
|
1,
|
||||||
"personal messages inbox filter links are not shown"
|
"personal messages inbox filter links are not shown"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.foo_group")
|
count(".sidebar-section-messages .sidebar-section-link.foo_group"),
|
||||||
.length,
|
|
||||||
4,
|
4,
|
||||||
"foo_group messages inbox filter links are shown"
|
"foo_group messages inbox filter links are shown"
|
||||||
);
|
);
|
||||||
|
@ -339,22 +330,21 @@ acceptance(
|
||||||
await visit("/t/34");
|
await visit("/t/34");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link").length,
|
count(".sidebar-section-messages .sidebar-section-link"),
|
||||||
6,
|
6,
|
||||||
"6 section links are displayed"
|
"6 section links are displayed"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(
|
count(
|
||||||
".sidebar-section-messages .sidebar-section-link.personal-messages"
|
".sidebar-section-messages .sidebar-section-link.personal-messages"
|
||||||
).length,
|
),
|
||||||
5,
|
5,
|
||||||
"personal messages inbox filter links are shown"
|
"personal messages inbox filter links are shown"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-messages .sidebar-section-link.foo_group")
|
count(".sidebar-section-messages .sidebar-section-link.foo_group"),
|
||||||
.length,
|
|
||||||
1,
|
1,
|
||||||
"foo_group messages inbox filter links are not shown"
|
"foo_group messages inbox filter links are not shown"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
publishToMessageBus,
|
publishToMessageBus,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";
|
import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";
|
||||||
|
@ -104,7 +102,7 @@ acceptance("Sidebar - Tags section", function (needs) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-tags .sidebar-section-link").length,
|
count(".sidebar-section-tags .sidebar-section-link"),
|
||||||
3,
|
3,
|
||||||
"3 section links under the section"
|
"3 section links under the section"
|
||||||
);
|
);
|
||||||
|
@ -136,7 +134,7 @@ acceptance("Sidebar - Tags section", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-tags .sidebar-section-link.active").length,
|
count(".sidebar-section-tags .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -155,7 +153,7 @@ acceptance("Sidebar - Tags section", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-tags .sidebar-section-link.active").length,
|
count(".sidebar-section-tags .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -170,7 +168,7 @@ acceptance("Sidebar - Tags section", function (needs) {
|
||||||
await visit(`/tag/tag1/l/top`);
|
await visit(`/tag/tag1/l/top`);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-tags .sidebar-section-link.active").length,
|
count(".sidebar-section-tags .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -185,7 +183,7 @@ acceptance("Sidebar - Tags section", function (needs) {
|
||||||
await visit(`/tag/tag1/l/new`);
|
await visit(`/tag/tag1/l/new`);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-tags .sidebar-section-link.active").length,
|
count(".sidebar-section-tags .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -200,7 +198,7 @@ acceptance("Sidebar - Tags section", function (needs) {
|
||||||
await visit(`/tag/tag1/l/unread`);
|
await visit(`/tag/tag1/l/unread`);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-tags .sidebar-section-link.active").length,
|
count(".sidebar-section-tags .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
|
||||||
|
@ -8,9 +7,8 @@ acceptance("Sidebar - Anon User", function () {
|
||||||
test("sidebar is not displayed", async function (assert) {
|
test("sidebar is not displayed", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
document.querySelectorAll("body.has-sidebar-page").length,
|
!document.body.classList.contains("has-sidebar-page"),
|
||||||
0,
|
|
||||||
"does not add sidebar utility class to body"
|
"does not add sidebar utility class to body"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -24,9 +22,8 @@ acceptance("Sidebar - User with sidebar disabled", function (needs) {
|
||||||
test("sidebar is not displayed", async function (assert) {
|
test("sidebar is not displayed", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
document.querySelectorAll("body.has-sidebar-page").length,
|
!document.body.classList.contains("has-sidebar-page"),
|
||||||
0,
|
|
||||||
"does not add sidebar utility class to body"
|
"does not add sidebar utility class to body"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -40,9 +37,8 @@ acceptance("Sidebar - User with sidebar enabled", function (needs) {
|
||||||
test("hiding and displaying sidebar", async function (assert) {
|
test("hiding and displaying sidebar", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
document.querySelectorAll("body.has-sidebar-page").length,
|
document.body.classList.contains("has-sidebar-page"),
|
||||||
1,
|
|
||||||
"adds sidebar utility class to body"
|
"adds sidebar utility class to body"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -50,9 +46,8 @@ acceptance("Sidebar - User with sidebar enabled", function (needs) {
|
||||||
|
|
||||||
await click(".header-sidebar-toggle .btn");
|
await click(".header-sidebar-toggle .btn");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
document.querySelectorAll("body.has-sidebar-page").length,
|
!document.body.classList.contains("has-sidebar-page"),
|
||||||
0,
|
|
||||||
"removes sidebar utility class to body"
|
"removes sidebar utility class to body"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
import { click, currentURL, settled, visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
loggedInUser,
|
loggedInUser,
|
||||||
publishToMessageBus,
|
publishToMessageBus,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import topicFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
import topicFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
|
@ -88,11 +86,11 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
"/latest",
|
"/latest",
|
||||||
"it should transistion to the homepage"
|
"it should transition to the homepage"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -110,11 +108,11 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
"/latest",
|
"/latest",
|
||||||
"it should transistion to the latest page"
|
"it should transition to the latest page"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -132,11 +130,11 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
"/latest?f=tracked",
|
"/latest?f=tracked",
|
||||||
"it should transistion to the tracked url"
|
"it should transition to the tracked url"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -154,11 +152,11 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/u/${loggedInUser().username}/activity/bookmarks`,
|
`/u/${loggedInUser().username}/activity/bookmarks`,
|
||||||
"it should transistion to the bookmarked url"
|
"it should transition to the bookmarked url"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -176,11 +174,11 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/u/${loggedInUser().username}/activity`,
|
`/u/${loggedInUser().username}/activity`,
|
||||||
"it should transistion to the user's activity url"
|
"it should transition to the user's activity url"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -212,11 +210,11 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/u/${loggedInUser().username}/activity/drafts`,
|
`/u/${loggedInUser().username}/activity/drafts`,
|
||||||
"it transistions to the user's activity drafts url"
|
"it transitions to the user's activity drafts url"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -238,7 +236,7 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
await visit("/top");
|
await visit("/top");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -253,7 +251,7 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
await visit("/unread");
|
await visit("/unread");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -268,7 +266,7 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
await visit("/new");
|
await visit("/new");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -429,7 +427,7 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
await visit("/top?f=tracked");
|
await visit("/top?f=tracked");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -444,7 +442,7 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
await visit("/unread?f=tracked");
|
await visit("/unread?f=tracked");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
@ -459,7 +457,7 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
||||||
await visit("/new?f=tracked");
|
await visit("/new?f=tracked");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".sidebar-section-topics .sidebar-section-link.active").length,
|
count(".sidebar-section-topics .sidebar-section-link.active"),
|
||||||
1,
|
1,
|
||||||
"only one link is marked as active"
|
"only one link is marked as active"
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,19 +5,31 @@ import { test } from "qunit";
|
||||||
acceptance("Static", function () {
|
acceptance("Static", function () {
|
||||||
test("Static Pages", async function (assert) {
|
test("Static Pages", async function (assert) {
|
||||||
await visit("/faq");
|
await visit("/faq");
|
||||||
assert.ok($("body.static-faq").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("static-faq"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".body-page"), "The content is present");
|
assert.ok(exists(".body-page"), "The content is present");
|
||||||
|
|
||||||
await visit("/guidelines");
|
await visit("/guidelines");
|
||||||
assert.ok($("body.static-guidelines").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("static-guidelines"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".body-page"), "The content is present");
|
assert.ok(exists(".body-page"), "The content is present");
|
||||||
|
|
||||||
await visit("/tos");
|
await visit("/tos");
|
||||||
assert.ok($("body.static-tos").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("static-tos"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".body-page"), "The content is present");
|
assert.ok(exists(".body-page"), "The content is present");
|
||||||
|
|
||||||
await visit("/privacy");
|
await visit("/privacy");
|
||||||
assert.ok($("body.static-privacy").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("static-privacy"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".body-page"), "The content is present");
|
assert.ok(exists(".body-page"), "The content is present");
|
||||||
|
|
||||||
await visit("/login");
|
await visit("/login");
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
invisible,
|
invisible,
|
||||||
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
@ -30,82 +32,82 @@ acceptance("Topic - Bulk Actions", function (needs) {
|
||||||
await click(".bulk-select-actions");
|
await click(".bulk-select-actions");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll("#discourse-modal-title")
|
query("#discourse-modal-title").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.actions")
|
||||||
.includes(I18n.t("topics.bulk.actions")),
|
),
|
||||||
"it opens bulk-select modal"
|
"it opens bulk-select modal"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.change_category")
|
||||||
.includes(I18n.t("topics.bulk.change_category")),
|
),
|
||||||
"it shows an option to change category"
|
"it shows an option to change category"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.close_topics")
|
||||||
.includes(I18n.t("topics.bulk.close_topics")),
|
),
|
||||||
"it shows an option to close topics"
|
"it shows an option to close topics"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.archive_topics")
|
||||||
.includes(I18n.t("topics.bulk.archive_topics")),
|
),
|
||||||
"it shows an option to archive topics"
|
"it shows an option to archive topics"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.notification_level")
|
||||||
.includes(I18n.t("topics.bulk.notification_level")),
|
),
|
||||||
"it shows an option to update notification level"
|
"it shows an option to update notification level"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons").html().includes(I18n.t("topics.bulk.defer")),
|
query(".bulk-buttons").innerHTML.includes(I18n.t("topics.bulk.defer")),
|
||||||
"it shows an option to reset read"
|
"it shows an option to reset read"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.unlist_topics")
|
||||||
.includes(I18n.t("topics.bulk.unlist_topics")),
|
),
|
||||||
"it shows an option to unlist topics"
|
"it shows an option to unlist topics"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.reset_bump_dates")
|
||||||
.includes(I18n.t("topics.bulk.reset_bump_dates")),
|
),
|
||||||
"it shows an option to reset bump dates"
|
"it shows an option to reset bump dates"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.change_tags")
|
||||||
.includes(I18n.t("topics.bulk.change_tags")),
|
),
|
||||||
"it shows an option to replace tags"
|
"it shows an option to replace tags"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.append_tags")
|
||||||
.includes(I18n.t("topics.bulk.append_tags")),
|
),
|
||||||
"it shows an option to append tags"
|
"it shows an option to append tags"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons")
|
query(".bulk-buttons").innerHTML.includes(
|
||||||
.html()
|
I18n.t("topics.bulk.remove_tags")
|
||||||
.includes(I18n.t("topics.bulk.remove_tags")),
|
),
|
||||||
"it shows an option to remove all tags"
|
"it shows an option to remove all tags"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".bulk-buttons").html().includes(I18n.t("topics.bulk.delete")),
|
query(".bulk-buttons").innerHTML.includes(I18n.t("topics.bulk.delete")),
|
||||||
"it shows an option to delete topics"
|
"it shows an option to delete topics"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -136,8 +138,8 @@ acceptance("Topic - Bulk Actions", function (needs) {
|
||||||
await triggerEvent(queryAll("input.bulk-select")[3], "click", {
|
await triggerEvent(queryAll("input.bulk-select")[3], "click", {
|
||||||
shiftKey: true,
|
shiftKey: true,
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
queryAll("input.bulk-select:checked").length,
|
count("input.bulk-select:checked"),
|
||||||
4,
|
4,
|
||||||
"Shift click selects a range"
|
"Shift click selects a range"
|
||||||
);
|
);
|
||||||
|
@ -148,8 +150,8 @@ acceptance("Topic - Bulk Actions", function (needs) {
|
||||||
await triggerEvent(queryAll("input.bulk-select")[1], "click", {
|
await triggerEvent(queryAll("input.bulk-select")[1], "click", {
|
||||||
shiftKey: true,
|
shiftKey: true,
|
||||||
});
|
});
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
queryAll("input.bulk-select:checked").length,
|
count("input.bulk-select:checked"),
|
||||||
5,
|
5,
|
||||||
"Bottom-up Shift click range selection works"
|
"Bottom-up Shift click range selection works"
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,7 +22,7 @@ acceptance("Topic Discovery", function (needs) {
|
||||||
test("Visit Discovery Pages", async function (assert) {
|
test("Visit Discovery Pages", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
document.querySelectorAll("body.navigation-topics").length,
|
document.body.classList.contains("navigation-topics"),
|
||||||
"has the default navigation"
|
"has the default navigation"
|
||||||
);
|
);
|
||||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||||
|
@ -45,28 +45,28 @@ acceptance("Topic Discovery", function (needs) {
|
||||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||||
assert.ok(!exists(".category-list"), "doesn't render subcategories");
|
assert.ok(!exists(".category-list"), "doesn't render subcategories");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
document.querySelectorAll("body.category-bug").length,
|
document.body.classList.contains("category-bug"),
|
||||||
"has a custom css class for the category id on the body"
|
"has a custom css class for the category id on the body"
|
||||||
);
|
);
|
||||||
|
|
||||||
await visit("/categories");
|
await visit("/categories");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
document.querySelectorAll("body.navigation-categories").length,
|
document.body.classList.contains("navigation-categories"),
|
||||||
"has the body class"
|
"has the body class"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
document.querySelectorAll("body.category-bug").length === 0,
|
!document.body.classList.contains("category-bug"),
|
||||||
"removes the custom category class"
|
"removes the custom category class"
|
||||||
);
|
);
|
||||||
assert.ok(exists(".category"), "has a list of categories");
|
assert.ok(exists(".category"), "has a list of categories");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
document.querySelectorAll("body.categories-list").length,
|
document.body.classList.contains("categories-list"),
|
||||||
"has a custom class to indicate categories"
|
"has a custom class to indicate categories"
|
||||||
);
|
);
|
||||||
|
|
||||||
await visit("/top");
|
await visit("/top");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
document.querySelectorAll("body.categories-list").length === 0,
|
!document.body.classList.contains("categories-list"),
|
||||||
"removes the `categories-list` class"
|
"removes the `categories-list` class"
|
||||||
);
|
);
|
||||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
chromeTest,
|
chromeTest,
|
||||||
exists,
|
exists,
|
||||||
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
selectText,
|
selectText,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
@ -55,7 +56,7 @@ acceptance("Topic - Quote button - logged in", function (needs) {
|
||||||
await click(".insert-quote");
|
await click(".insert-quote");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
'[quote="group_moderator, post:3, topic:2480"]\nhttps://example.com/57350945\n[/quote]',
|
'[quote="group_moderator, post:3, topic:2480"]\nhttps://example.com/57350945\n[/quote]',
|
||||||
"quote only contains a link"
|
"quote only contains a link"
|
||||||
);
|
);
|
||||||
|
@ -135,7 +136,7 @@ acceptance("Topic - Quote button - keyboard shortcut", function (needs) {
|
||||||
assert.ok(exists(".d-editor-input"), "the editor is open");
|
assert.ok(exists(".d-editor-input"), "the editor is open");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
queryAll(".d-editor-input").val().includes("Any plans to support"),
|
query(".d-editor-input").value.includes("Any plans to support"),
|
||||||
"editor includes selected text"
|
"editor includes selected text"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,11 @@ import { test } from "qunit";
|
||||||
acceptance("User Anonymous", function () {
|
acceptance("User Anonymous", function () {
|
||||||
test("Root URL", async function (assert) {
|
test("Root URL", async function (assert) {
|
||||||
await visit("/u/eviltrout");
|
await visit("/u/eviltrout");
|
||||||
assert.ok($("body.user-summary-page").length, "has the body class");
|
|
||||||
|
assert.ok(
|
||||||
|
document.body.classList.contains("user-summary-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
"user.summary",
|
"user.summary",
|
||||||
|
@ -15,7 +19,10 @@ acceptance("User Anonymous", function () {
|
||||||
|
|
||||||
test("Filters", async function (assert) {
|
test("Filters", async function (assert) {
|
||||||
await visit("/u/eviltrout/activity");
|
await visit("/u/eviltrout/activity");
|
||||||
assert.ok($("body.user-activity-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("user-activity-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".user-main .about"), "it has the about section");
|
assert.ok(exists(".user-main .about"), "it has the about section");
|
||||||
assert.ok(exists(".user-stream .item"), "it has stream items");
|
assert.ok(exists(".user-stream .item"), "it has stream items");
|
||||||
|
|
||||||
|
@ -32,7 +39,11 @@ acceptance("User Anonymous", function () {
|
||||||
|
|
||||||
test("Badges", async function (assert) {
|
test("Badges", async function (assert) {
|
||||||
await visit("/u/eviltrout/badges");
|
await visit("/u/eviltrout/badges");
|
||||||
assert.ok($("body.user-badges-page").length, "has the body class");
|
|
||||||
|
assert.ok(
|
||||||
|
document.body.classList.contains("user-badges-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".badge-group-list .badge-card"), "shows a badge");
|
assert.ok(exists(".badge-group-list .badge-card"), "shows a badge");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
|
@ -60,13 +60,13 @@ acceptance("User's bookmarks - reminder", function (needs) {
|
||||||
test("bookmarks with reminders have a clear reminder option", async function (assert) {
|
test("bookmarks with reminders have a clear reminder option", async function (assert) {
|
||||||
await visit("/u/eviltrout/activity/bookmarks");
|
await visit("/u/eviltrout/activity/bookmarks");
|
||||||
|
|
||||||
assert.strictEqual(queryAll(".bookmark-reminder").length, 2);
|
assert.strictEqual(count(".bookmark-reminder"), 2);
|
||||||
|
|
||||||
const dropdown = selectKit(".bookmark-actions-dropdown");
|
const dropdown = selectKit(".bookmark-actions-dropdown");
|
||||||
await dropdown.expand();
|
await dropdown.expand();
|
||||||
await dropdown.selectRowByValue("clear_reminder");
|
await dropdown.selectRowByValue("clear_reminder");
|
||||||
|
|
||||||
assert.strictEqual(queryAll(".bookmark-reminder").length, 1);
|
assert.strictEqual(count(".bookmark-reminder"), 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
exists,
|
exists,
|
||||||
normalizeHtml,
|
normalizeHtml,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
visible,
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
|
@ -42,7 +41,7 @@ acceptance("User Drafts", function (needs) {
|
||||||
|
|
||||||
await click(".user-stream-item .resume-draft");
|
await click(".user-stream-item .resume-draft");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
"A fun new topic for testing drafts."
|
"A fun new topic for testing drafts."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
count,
|
count,
|
||||||
exists,
|
exists,
|
||||||
queryAll,
|
query,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
import cookie, { removeCookie } from "discourse/lib/cookie";
|
import cookie, { removeCookie } from "discourse/lib/cookie";
|
||||||
|
@ -22,7 +22,7 @@ acceptance("User Preferences - Interface", function (needs) {
|
||||||
assert.ok(!exists(".saved"), "it hasn't been saved yet");
|
assert.ok(!exists(".saved"), "it hasn't been saved yet");
|
||||||
await click(".save-changes");
|
await click(".save-changes");
|
||||||
assert.ok(exists(".saved"), "it displays the saved message");
|
assert.ok(exists(".saved"), "it displays the saved message");
|
||||||
queryAll(".saved").remove();
|
query(".saved").remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
await visit("/u/eviltrout/preferences/interface");
|
await visit("/u/eviltrout/preferences/interface");
|
||||||
|
@ -187,8 +187,8 @@ acceptance(
|
||||||
await visit("/u/eviltrout/preferences/interface");
|
await visit("/u/eviltrout/preferences/interface");
|
||||||
assert.ok(exists(".light-color-scheme"), "has light scheme dropdown");
|
assert.ok(exists(".light-color-scheme"), "has light scheme dropdown");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".light-color-scheme .selected-name").data("value"),
|
query(".light-color-scheme .selected-name").dataset.value,
|
||||||
session.userColorSchemeId,
|
session.userColorSchemeId.toString(),
|
||||||
"user's selected color scheme is selected value in light scheme dropdown"
|
"user's selected color scheme is selected value in light scheme dropdown"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -237,15 +237,15 @@ acceptance(
|
||||||
assert.ok(!exists(".saved"), "it hasn't been saved yet");
|
assert.ok(!exists(".saved"), "it hasn't been saved yet");
|
||||||
await click(".save-changes");
|
await click(".save-changes");
|
||||||
assert.ok(exists(".saved"), "it displays the saved message");
|
assert.ok(exists(".saved"), "it displays the saved message");
|
||||||
queryAll(".saved").remove();
|
query(".saved").remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
await visit("/u/eviltrout/preferences/interface");
|
await visit("/u/eviltrout/preferences/interface");
|
||||||
assert.ok(exists(".light-color-scheme"), "has regular dropdown");
|
assert.ok(exists(".light-color-scheme"), "has regular dropdown");
|
||||||
assert.ok(exists(".dark-color-scheme"), "has dark color scheme dropdown");
|
assert.ok(exists(".dark-color-scheme"), "has dark color scheme dropdown");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".dark-color-scheme .selected-name").data("value"),
|
query(".dark-color-scheme .selected-name").dataset.value,
|
||||||
session.userDarkSchemeId,
|
session.userDarkSchemeId.toString(),
|
||||||
"sets site default as selected dark scheme"
|
"sets site default as selected dark scheme"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
|
|
@ -43,12 +43,18 @@ acceptance("User Routes", function (needs) {
|
||||||
|
|
||||||
test("Invites", async function (assert) {
|
test("Invites", async function (assert) {
|
||||||
await visit("/u/eviltrout/invited/pending");
|
await visit("/u/eviltrout/invited/pending");
|
||||||
assert.ok($("body.user-invites-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("user-invites-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Notifications", async function (assert) {
|
test("Notifications", async function (assert) {
|
||||||
await visit("/u/eviltrout/notifications");
|
await visit("/u/eviltrout/notifications");
|
||||||
assert.ok($("body.user-notifications-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("user-notifications-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
|
|
||||||
const $links = queryAll(".item.notification a");
|
const $links = queryAll(".item.notification a");
|
||||||
|
|
||||||
|
@ -75,7 +81,10 @@ acceptance("User Routes", function (needs) {
|
||||||
|
|
||||||
test("Root URL - Viewing Self", async function (assert) {
|
test("Root URL - Viewing Self", async function (assert) {
|
||||||
await visit("/u/eviltrout");
|
await visit("/u/eviltrout");
|
||||||
assert.ok($("body.user-activity-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("user-activity-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
"userActivity.index",
|
"userActivity.index",
|
||||||
|
@ -209,8 +218,11 @@ acceptance("User Routes - Moderator viewing warnings", function (needs) {
|
||||||
|
|
||||||
test("Messages - Warnings", async function (assert) {
|
test("Messages - Warnings", async function (assert) {
|
||||||
await visit("/u/eviltrout/messages/warnings");
|
await visit("/u/eviltrout/messages/warnings");
|
||||||
assert.ok($("body.user-messages-page").length, "has the body class");
|
assert.ok(
|
||||||
assert.ok($("div.alert-info").length, "has the permissions alert");
|
document.body.classList.contains("user-messages-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
|
assert.ok(exists("div.alert-info"), "has the permissions alert");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,10 @@ import { click, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||||
acceptance("User Directory", function () {
|
acceptance("User Directory", function () {
|
||||||
test("Visit Page", async function (assert) {
|
test("Visit Page", async function (assert) {
|
||||||
await visit("/u");
|
await visit("/u");
|
||||||
assert.ok($("body.users-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("users-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".directory table tr"), "has a list of users");
|
assert.ok(exists(".directory table tr"), "has a list of users");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,13 +24,19 @@ acceptance("User Directory", function () {
|
||||||
|
|
||||||
test("Visit Without Usernames", async function (assert) {
|
test("Visit Without Usernames", async function (assert) {
|
||||||
await visit("/u?exclude_usernames=system");
|
await visit("/u?exclude_usernames=system");
|
||||||
assert.ok($("body.users-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("users-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".directory table tr"), "has a list of users");
|
assert.ok(exists(".directory table tr"), "has a list of users");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Visit With Group Filter", async function (assert) {
|
test("Visit With Group Filter", async function (assert) {
|
||||||
await visit("/u?group=trust_level_0");
|
await visit("/u?group=trust_level_0");
|
||||||
assert.ok($("body.users-page").length, "has the body class");
|
assert.ok(
|
||||||
|
document.body.classList.contains("users-page"),
|
||||||
|
"has the body class"
|
||||||
|
);
|
||||||
assert.ok(exists(".directory table tr"), "has a list of users");
|
assert.ok(exists(".directory table tr"), "has a list of users");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -656,18 +656,14 @@ third line`
|
||||||
testCase(
|
testCase(
|
||||||
`doesn't jump to bottom with long text`,
|
`doesn't jump to bottom with long text`,
|
||||||
async function (assert, textarea) {
|
async function (assert, textarea) {
|
||||||
let longText = "hello world.";
|
this.set("value", "hello world.".repeat(8));
|
||||||
for (let i = 0; i < 8; i++) {
|
|
||||||
longText = longText + longText;
|
|
||||||
}
|
|
||||||
this.set("value", longText);
|
|
||||||
|
|
||||||
$(textarea).scrollTop(0);
|
textarea.scrollTop = 0;
|
||||||
textarea.selectionStart = 3;
|
textarea.selectionStart = 3;
|
||||||
textarea.selectionEnd = 3;
|
textarea.selectionEnd = 3;
|
||||||
|
|
||||||
await click("button.bold");
|
await click("button.bold");
|
||||||
assert.strictEqual($(textarea).scrollTop(), 0, "it stays scrolled up");
|
assert.strictEqual(textarea.scrollTop, 0, "it stays scrolled up");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1021,7 +1017,7 @@ third line`
|
||||||
for (let i = 0; i < CASES.length; i++) {
|
for (let i = 0; i < CASES.length; i++) {
|
||||||
const CASE = CASES[i];
|
const CASE = CASES[i];
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
composerTestCase(`replace-text event: ${CASE.description}`, async function( // eslint-disable-line no-loop-func
|
composerTestCase(`replace-text event: ${CASE.description}`, async function(
|
||||||
assert,
|
assert,
|
||||||
textarea
|
textarea
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -56,9 +56,8 @@ discourseModule("Unit | Utility | category-badge", function () {
|
||||||
const store = createStore();
|
const store = createStore();
|
||||||
const category = store.createRecord("category", { name: "hello", id: 123 });
|
const category = store.createRecord("category", { name: "hello", id: 123 });
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
categoryBadgeHTML(category).indexOf("topic-count"),
|
!categoryBadgeHTML(category).includes("topic-count"),
|
||||||
-1,
|
|
||||||
"it does not include topic count by default"
|
"it does not include topic count by default"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -136,41 +135,21 @@ discourseModule("Unit | Utility | category-badge", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.siteSettings.max_category_nesting = 0;
|
this.siteSettings.max_category_nesting = 0;
|
||||||
assert.ok(
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("baz") !== -1
|
assert.ok(!categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
|
||||||
);
|
|
||||||
assert.ok(
|
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("bar") === -1
|
|
||||||
);
|
|
||||||
|
|
||||||
this.siteSettings.max_category_nesting = 1;
|
this.siteSettings.max_category_nesting = 1;
|
||||||
assert.ok(
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("baz") !== -1
|
assert.ok(!categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
|
||||||
);
|
|
||||||
assert.ok(
|
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("bar") === -1
|
|
||||||
);
|
|
||||||
|
|
||||||
this.siteSettings.max_category_nesting = 2;
|
this.siteSettings.max_category_nesting = 2;
|
||||||
assert.ok(
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("baz") !== -1
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
|
||||||
);
|
assert.ok(!categoryBadgeHTML(baz, { recursive: true }).includes("foo"));
|
||||||
assert.ok(
|
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("bar") !== -1
|
|
||||||
);
|
|
||||||
assert.ok(
|
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("foo") === -1
|
|
||||||
);
|
|
||||||
|
|
||||||
this.siteSettings.max_category_nesting = 3;
|
this.siteSettings.max_category_nesting = 3;
|
||||||
assert.ok(
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("baz") !== -1
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
|
||||||
);
|
assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("foo"));
|
||||||
assert.ok(
|
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("bar") !== -1
|
|
||||||
);
|
|
||||||
assert.ok(
|
|
||||||
categoryBadgeHTML(baz, { recursive: true }).indexOf("foo") !== -1
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { module, test } from "qunit";
|
||||||
|
|
||||||
module("Unit | Utility | icon-library", function () {
|
module("Unit | Utility | icon-library", function () {
|
||||||
test("return icon markup", function (assert) {
|
test("return icon markup", function (assert) {
|
||||||
assert.ok(iconHTML("bars").indexOf('use href="#bars"') > -1);
|
assert.ok(iconHTML("bars").includes('use href="#bars"'));
|
||||||
|
|
||||||
const nodeIcon = iconNode("bars");
|
const nodeIcon = iconNode("bars");
|
||||||
assert.strictEqual(nodeIcon.tagName, "svg");
|
assert.strictEqual(nodeIcon.tagName, "svg");
|
||||||
|
@ -19,10 +19,10 @@ module("Unit | Utility | icon-library", function () {
|
||||||
|
|
||||||
test("convert icon names", function (assert) {
|
test("convert icon names", function (assert) {
|
||||||
const fa5Icon = convertIconClass("fab fa-facebook");
|
const fa5Icon = convertIconClass("fab fa-facebook");
|
||||||
assert.ok(iconHTML(fa5Icon).indexOf("fab-facebook") > -1, "FA 5 syntax");
|
assert.ok(iconHTML(fa5Icon).includes("fab-facebook"), "FA 5 syntax");
|
||||||
|
|
||||||
const iconC = convertIconClass(" fab fa-facebook ");
|
const iconC = convertIconClass(" fab fa-facebook ");
|
||||||
assert.ok(iconHTML(iconC).indexOf(" ") === -1, "trims whitespace");
|
assert.ok(!iconHTML(iconC).includes(" "), "trims whitespace");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("escape icon names, classes and titles", function (assert) {
|
test("escape icon names, classes and titles", function (assert) {
|
||||||
|
|
|
@ -40,13 +40,13 @@ module("Unit | Utility | oneboxer", function () {
|
||||||
await loadOnebox(element);
|
await loadOnebox(element);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
localCache["http://somegoodurl.com"].outerHTML.indexOf(
|
localCache["http://somegoodurl.com"].outerHTML.includes(
|
||||||
"Yet another collaboration tool"
|
"Yet another collaboration tool"
|
||||||
) !== -1,
|
),
|
||||||
"stores the html of the onebox in a local cache"
|
"stores the html of the onebox in a local cache"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
loadOnebox(element).indexOf("Yet another collaboration tool") !== -1,
|
loadOnebox(element).includes("Yet another collaboration tool"),
|
||||||
"it returns the html from the cache"
|
"it returns the html from the cache"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,9 +31,9 @@ module("Unit | Utility | search", function () {
|
||||||
const results = await translateResults(source);
|
const results = await translateResults(source);
|
||||||
const blurb = results.posts[0].get("blurb");
|
const blurb = results.posts[0].get("blurb");
|
||||||
|
|
||||||
assert.ok(blurb.indexOf("thinking.png"));
|
assert.ok(blurb.includes("thinking.png"));
|
||||||
assert.ok(blurb.indexOf('<img width="20" height="20" src') === 0);
|
assert.ok(blurb.startsWith('<img width="20" height="20" src'));
|
||||||
assert.ok(blurb.indexOf(":thinking:") === -1);
|
assert.ok(!blurb.includes(":thinking:"));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("searchContextDescription", function (assert) {
|
test("searchContextDescription", function (assert) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ function stubUrls(imageSrcs, attachmentSrcs, otherMediaSrcs) {
|
||||||
`<div class="scoped-area"><img data-orig-src="${imageSrcs[2].url}"></div>` +
|
`<div class="scoped-area"><img data-orig-src="${imageSrcs[2].url}"></div>` +
|
||||||
otherMediaSrcs
|
otherMediaSrcs
|
||||||
.map((src) => {
|
.map((src) => {
|
||||||
if (src.short_url.indexOf("mp3") > -1) {
|
if (src.short_url.includes("mp3")) {
|
||||||
return `<audio controls><source data-orig-src="${src.short_url}"></audio>`;
|
return `<audio controls><source data-orig-src="${src.short_url}"></audio>`;
|
||||||
} else {
|
} else {
|
||||||
return `<video controls><source data-orig-src="${src.short_url}"></video>`;
|
return `<video controls><source data-orig-src="${src.short_url}"></video>`;
|
||||||
|
|
|
@ -74,13 +74,13 @@ module("Unit | Model | report", function () {
|
||||||
|
|
||||||
test("yesterdayCountTitle with valid values", function (assert) {
|
test("yesterdayCountTitle with valid values", function (assert) {
|
||||||
const title = reportWithData([6, 8, 5, 2, 1]).get("yesterdayCountTitle");
|
const title = reportWithData([6, 8, 5, 2, 1]).get("yesterdayCountTitle");
|
||||||
assert.ok(title.indexOf("+60%") !== -1);
|
assert.ok(title.includes("+60%"));
|
||||||
assert.ok(title.match(/Was 5/));
|
assert.ok(title.match(/Was 5/));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("yesterdayCountTitle when two days ago was 0", function (assert) {
|
test("yesterdayCountTitle when two days ago was 0", function (assert) {
|
||||||
const title = reportWithData([6, 8, 0, 2, 1]).get("yesterdayCountTitle");
|
const title = reportWithData([6, 8, 0, 2, 1]).get("yesterdayCountTitle");
|
||||||
assert.strictEqual(title.indexOf("%"), -1);
|
assert.ok(!title.includes("%"));
|
||||||
assert.ok(title.match(/Was 0/));
|
assert.ok(title.match(/Was 0/));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -97,14 +97,14 @@ module("Unit | Model | report", function () {
|
||||||
report.set("prev30Days", 10);
|
report.set("prev30Days", 10);
|
||||||
let title = report.get("thirtyDaysCountTitle");
|
let title = report.get("thirtyDaysCountTitle");
|
||||||
|
|
||||||
assert.ok(title.indexOf("+50%") !== -1);
|
assert.ok(title.includes("+50%"));
|
||||||
assert.ok(title.match(/Was 10/));
|
assert.ok(title.match(/Was 10/));
|
||||||
|
|
||||||
report = reportWithData([5, 5, 5, 5]);
|
report = reportWithData([5, 5, 5, 5]);
|
||||||
report.set("prev_period", 20);
|
report.set("prev_period", 20);
|
||||||
title = report.get("thirtyDaysCountTitle");
|
title = report.get("thirtyDaysCountTitle");
|
||||||
|
|
||||||
assert.ok(title.indexOf("-25%") !== -1);
|
assert.ok(title.includes("-25%"));
|
||||||
assert.ok(title.match(/Was 20/));
|
assert.ok(title.match(/Was 20/));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topic.tags && topic.tags.indexOf("random") > -1) {
|
if (topic.tags?.includes("random")) {
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
randomNew += 1;
|
randomNew += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
import {
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
acceptance,
|
|
||||||
query,
|
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
|
@ -23,7 +19,7 @@ acceptance("Details Button", function (needs) {
|
||||||
await popupMenu.selectRowByValue("insertDetails");
|
await popupMenu.selectRowByValue("insertDetails");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
`\n[details="${I18n.t("composer.details_title")}"]\n${I18n.t(
|
`\n[details="${I18n.t("composer.details_title")}"]\n${I18n.t(
|
||||||
"composer.details_text"
|
"composer.details_text"
|
||||||
)}\n[/details]\n`,
|
)}\n[/details]\n`,
|
||||||
|
@ -40,7 +36,7 @@ acceptance("Details Button", function (needs) {
|
||||||
await popupMenu.selectRowByValue("insertDetails");
|
await popupMenu.selectRowByValue("insertDetails");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
`\n[details="${I18n.t(
|
`\n[details="${I18n.t(
|
||||||
"composer.details_title"
|
"composer.details_title"
|
||||||
)}"]\nThis is my title\n[/details]\n`,
|
)}"]\nThis is my title\n[/details]\n`,
|
||||||
|
@ -67,7 +63,7 @@ acceptance("Details Button", function (needs) {
|
||||||
await popupMenu.selectRowByValue("insertDetails");
|
await popupMenu.selectRowByValue("insertDetails");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
`Before \n[details="${I18n.t(
|
`Before \n[details="${I18n.t(
|
||||||
"composer.details_title"
|
"composer.details_title"
|
||||||
)}"]\nsome text in between\n[/details]\n After`,
|
)}"]\nsome text in between\n[/details]\n After`,
|
||||||
|
@ -94,7 +90,7 @@ acceptance("Details Button", function (needs) {
|
||||||
await popupMenu.selectRowByValue("insertDetails");
|
await popupMenu.selectRowByValue("insertDetails");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
`Before \n\n[details="${I18n.t(
|
`Before \n\n[details="${I18n.t(
|
||||||
"composer.details_title"
|
"composer.details_title"
|
||||||
)}"]\nsome text in between\n[/details]\n\n After`,
|
)}"]\nsome text in between\n[/details]\n\n After`,
|
||||||
|
@ -129,7 +125,7 @@ acceptance("Details Button", function (needs) {
|
||||||
await popupMenu.selectRowByValue("insertDetails");
|
await popupMenu.selectRowByValue("insertDetails");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val(),
|
query(".d-editor-input").value,
|
||||||
`\n[details="${I18n.t(
|
`\n[details="${I18n.t(
|
||||||
"composer.details_title"
|
"composer.details_title"
|
||||||
)}"]\n${multilineInput}\n[/details]\n`,
|
)}"]\n${multilineInput}\n[/details]\n`,
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
import {
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
acceptance,
|
|
||||||
query,
|
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
|
@ -13,9 +9,9 @@ acceptance("Local Dates - composer", function (needs) {
|
||||||
|
|
||||||
test("composer bbcode", async function (assert) {
|
test("composer bbcode", async function (assert) {
|
||||||
const getAttr = (attr) => {
|
const getAttr = (attr) => {
|
||||||
return queryAll(
|
return query(
|
||||||
".d-editor-preview .discourse-local-date.cooked-date"
|
".d-editor-preview .discourse-local-date.cooked-date"
|
||||||
).attr(`data-${attr}`);
|
).getAttribute(`data-${attr}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { cloneJSON } from "discourse-common/lib/object";
|
||||||
import topicFixtures from "discourse/tests/fixtures/topic";
|
import topicFixtures from "discourse/tests/fixtures/topic";
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
queryAll,
|
query,
|
||||||
selectText,
|
selectText,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
@ -48,7 +48,7 @@ acceptance("Local Dates - quoting", function (needs) {
|
||||||
await selectText("#post_1 .select-local-date-test");
|
await selectText("#post_1 .select-local-date-test");
|
||||||
await click(".insert-quote");
|
await click(".insert-quote");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||||
This is a test [date=2022-06-17 time=10:00:00 timezone="Australia/Brisbane" displayedTimezone="Australia/Perth"]
|
This is a test [date=2022-06-17 time=10:00:00 timezone="Australia/Brisbane" displayedTimezone="Australia/Perth"]
|
||||||
[/quote]`,
|
[/quote]`,
|
||||||
|
@ -87,7 +87,7 @@ acceptance("Local Dates - quoting range", function (needs) {
|
||||||
await selectText("#post_1 .select-local-date-test");
|
await selectText("#post_1 .select-local-date-test");
|
||||||
await click(".insert-quote");
|
await click(".insert-quote");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||||
Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL" timezone="Australia/Brisbane" timezones="Africa/Accra|Australia/Brisbane|Europe/Paris"]
|
Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL" timezone="Australia/Brisbane" timezones="Africa/Accra|Australia/Brisbane|Europe/Paris"]
|
||||||
[/quote]`,
|
[/quote]`,
|
||||||
|
@ -129,7 +129,7 @@ acceptance(
|
||||||
await selectText("#post_1 .select-local-date-test");
|
await selectText("#post_1 .select-local-date-test");
|
||||||
await click(".insert-quote");
|
await click(".insert-quote");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".d-editor-input").val().trim(),
|
query(".d-editor-input").value.trim(),
|
||||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||||
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
|
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
count,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
@ -25,7 +25,7 @@ acceptance("Rendering polls with pie charts", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".info-number", poll)[1].innerHTML,
|
poll.querySelectorAll(".info-number")[1].innerHTML,
|
||||||
"5",
|
"5",
|
||||||
"it should display the right number of votes"
|
"it should display the right number of votes"
|
||||||
);
|
);
|
||||||
|
@ -37,7 +37,7 @@ acceptance("Rendering polls with pie charts", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
queryAll(".poll-results-chart", poll).length,
|
count(".poll-results-chart", poll),
|
||||||
1,
|
1,
|
||||||
"Renders the chart div instead of bar container"
|
"Renders the chart div instead of bar container"
|
||||||
);
|
);
|
||||||
|
|
|
@ -196,8 +196,9 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||||
controller.currentUser = { staff: false };
|
controller.currentUser = { staff: false };
|
||||||
controller.notifyPropertyChange("pollResults");
|
controller.notifyPropertyChange("pollResults");
|
||||||
|
|
||||||
assert.ok(
|
assert.strictEqual(
|
||||||
controller.pollResults.filterBy("value", "staff_only").length === 0,
|
controller.pollResults.filterBy("value", "staff_only").length,
|
||||||
|
0,
|
||||||
"staff_only is not present"
|
"staff_only is not present"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -212,8 +213,9 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||||
controller.currentUser = { staff: true };
|
controller.currentUser = { staff: true };
|
||||||
controller.notifyPropertyChange("pollResults");
|
controller.notifyPropertyChange("pollResults");
|
||||||
|
|
||||||
assert.ok(
|
assert.strictEqual(
|
||||||
controller.pollResults.filterBy("value", "staff_only").length === 1,
|
controller.pollResults.filterBy("value", "staff_only").length,
|
||||||
|
1,
|
||||||
"staff_only is present"
|
"staff_only is present"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue