FIX: Lots of plugin tests were using old, non-Ember compat CLI APIs (#13320)

This commit is contained in:
Robin Ward
2021-06-09 10:58:55 -04:00
committed by GitHub
parent 3b6d6c7024
commit 77d33ebe21
24 changed files with 514 additions and 422 deletions
@@ -1,10 +1,12 @@
import {
acceptance,
count,
exists,
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Poll breakdown", function (needs) {
needs.user();
@@ -65,19 +67,14 @@ acceptance("Poll breakdown", function (needs) {
test("Displaying the poll breakdown modal", async function (assert) {
await visit("/t/-/topic_with_pie_chart_poll");
assert.equal(
queryAll(".poll-show-breakdown").text(),
"Show breakdown",
assert.ok(
exists(".poll-show-breakdown"),
"shows the breakdown button when poll_groupable_user_fields is non-empty"
);
await click(".poll-show-breakdown");
assert.equal(
query(".poll-breakdown-total-votes").textContent.trim(),
"2 votes",
"display the correct total vote count"
);
assert.ok(exists(".poll-breakdown-total-votes"), "displays the vote count");
assert.equal(
count(".poll-breakdown-chart-container"),
@@ -5,6 +5,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
import { test } from "qunit";
acceptance("Poll Builder - polls are disabled", function (needs) {
needs.user();
@@ -20,7 +21,7 @@ acceptance("Poll Builder - polls are disabled", function (needs) {
await displayPollBuilderButton();
assert.ok(
!exists(".select-kit-row[title='Build Poll']"),
!exists(".select-kit-row[data-value='showPollBuilder']"),
"it hides the builder button"
);
});
@@ -31,7 +32,7 @@ acceptance("Poll Builder - polls are disabled", function (needs) {
await displayPollBuilderButton();
assert.ok(
!exists(".select-kit-row[title='Build Poll']"),
!exists(".select-kit-row[data-value='showPollBuilder']"),
"it hides the builder button"
);
});
@@ -42,7 +43,7 @@ acceptance("Poll Builder - polls are disabled", function (needs) {
await displayPollBuilderButton();
assert.ok(
!exists(".select-kit-row[title='Build Poll']"),
!exists(".select-kit-row[data-value='showPollBuilder']"),
"it hides the builder button"
);
});
@@ -5,6 +5,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
import { test } from "qunit";
acceptance("Poll Builder - polls are enabled", function (needs) {
needs.user();
@@ -20,7 +21,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
await displayPollBuilderButton();
assert.ok(
exists(".select-kit-row[title='Build Poll']"),
exists(".select-kit-row[data-value='showPollBuilder']"),
"it shows the builder button"
);
});
@@ -31,7 +32,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
await displayPollBuilderButton();
assert.ok(
!exists(".select-kit-row[title='Build Poll']"),
!exists(".select-kit-row[data-value='showPollBuilder]"),
"it hides the builder button"
);
});
@@ -42,7 +43,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
await displayPollBuilderButton();
assert.ok(
exists(".select-kit-row[title='Build Poll']"),
exists(".select-kit-row[data-value='showPollBuilder']"),
"it shows the builder button"
);
});
@@ -1,5 +1,7 @@
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Poll in a post reply history", function (needs) {
needs.user();
@@ -3,6 +3,8 @@ import {
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Rendering polls with pie charts", function (needs) {
needs.user();
@@ -1,5 +1,7 @@
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Poll quote", function (needs) {
needs.user();
@@ -1,5 +1,7 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Rendering polls with bar charts - desktop", function (needs) {
needs.user();
@@ -1,5 +1,7 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Rendering polls with bar charts - mobile", function (needs) {
needs.user();