mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Replace global find with queryAll
In newer Embers jQuery is removed. There is a `find` but it only returns one element and not a jQuery selector. This patch migrates our code to a new helper `queryAll` which allows us to remove the global.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import I18n from "I18n";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
@@ -17,7 +17,7 @@ acceptance("Details Button", function (needs) {
|
||||
await popupMenu.selectRowByValue("insertDetails");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
queryAll(".d-editor-input").val(),
|
||||
`\n[details="${I18n.t("composer.details_title")}"]\n${I18n.t(
|
||||
"composer.details_text"
|
||||
)}\n[/details]\n`,
|
||||
@@ -26,7 +26,7 @@ acceptance("Details Button", function (needs) {
|
||||
|
||||
await fillIn(".d-editor-input", "This is my title");
|
||||
|
||||
const textarea = find(".d-editor-input")[0];
|
||||
const textarea = queryAll(".d-editor-input")[0];
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
||||
@@ -34,7 +34,7 @@ acceptance("Details Button", function (needs) {
|
||||
await popupMenu.selectRowByValue("insertDetails");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
queryAll(".d-editor-input").val(),
|
||||
`\n[details="${I18n.t(
|
||||
"composer.details_title"
|
||||
)}"]\nThis is my title\n[/details]\n`,
|
||||
@@ -61,7 +61,7 @@ acceptance("Details Button", function (needs) {
|
||||
await popupMenu.selectRowByValue("insertDetails");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
queryAll(".d-editor-input").val(),
|
||||
`Before \n[details="${I18n.t(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n After`,
|
||||
@@ -88,7 +88,7 @@ acceptance("Details Button", function (needs) {
|
||||
await popupMenu.selectRowByValue("insertDetails");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
queryAll(".d-editor-input").val(),
|
||||
`Before \n\n[details="${I18n.t(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n\n After`,
|
||||
@@ -115,7 +115,7 @@ acceptance("Details Button", function (needs) {
|
||||
await click("#create-topic");
|
||||
await fillIn(".d-editor-input", multilineInput);
|
||||
|
||||
const textarea = find(".d-editor-input")[0];
|
||||
const textarea = queryAll(".d-editor-input")[0];
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
||||
@@ -123,7 +123,7 @@ acceptance("Details Button", function (needs) {
|
||||
await popupMenu.selectRowByValue("insertDetails");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input").val(),
|
||||
queryAll(".d-editor-input").val(),
|
||||
`\n[details="${I18n.t(
|
||||
"composer.details_title"
|
||||
)}"]\n${multilineInput}\n[/details]\n`,
|
||||
|
||||
Reference in New Issue
Block a user