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";
acceptance("Rendering polls with pie charts", function (needs) {
needs.user();
@ -10,10 +14,10 @@ acceptance("Rendering polls with pie charts", function (needs) {
test("Displays the pie chart", async function (assert) {
await visit("/t/-/topic_with_pie_chart_poll");
const poll = queryAll(".poll")[0];
const poll = query(".poll");
assert.equal(
queryAll(".info-number", poll)[0].innerHTML,
query(".info-number", poll).innerHTML,
"2",
"it should display the right number of voters"
);