DEV: Clean up QUnit tests (#13328)

* DEV: Use `query` helper instead of `queryAll()[0]`
* DEV: Replace `queryAll().length` w/ `exists()`/`count()`
* DEV: Use `exists()` instead of `count() > 0`, `count() === 0`
* DEV: Use `count()`/`exists()` instead of `find().length`
This commit is contained in:
Jarek Radosz
2021-06-08 17:54:12 +02:00
committed by GitHub
parent 9811a1c5d9
commit 21e8a33177
98 changed files with 976 additions and 1070 deletions

View File

@ -1,4 +1,8 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import {
acceptance,
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@ -26,7 +30,7 @@ acceptance("Details Button", function (needs) {
await fillIn(".d-editor-input", "This is my title");
const textarea = queryAll(".d-editor-input")[0];
const textarea = query(".d-editor-input");
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;
@ -115,7 +119,7 @@ acceptance("Details Button", function (needs) {
await click("#create-topic");
await fillIn(".d-editor-input", multilineInput);
const textarea = queryAll(".d-editor-input")[0];
const textarea = query(".d-editor-input");
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;