REFACTOR: Test assertions should be imported.

Previously they were global functions.
This commit is contained in:
Robin Ward 2020-10-27 14:54:38 -04:00
parent f809e6eda7
commit b302321451
98 changed files with 147 additions and 36 deletions

View File

@ -12,6 +12,5 @@ public/
vendor/
app/assets/javascripts/discourse/tests/test_helper.js
app/assets/javascripts/discourse/tests/fixtures
app/assets/javascripts/discourse/tests/helpers/assertions.js
node_modules/
dist/

View File

@ -10,5 +10,8 @@
"testDone": "off",
"sinon": "off",
"currentURL": "off",
"invisible": "off",
"visible": "off",
"count": "off",
}
}

View File

@ -20,7 +20,6 @@ public/
vendor/
app/assets/javascripts/discourse/tests/test_helper.js
app/assets/javascripts/discourse/tests/fixtures
app/assets/javascripts/discourse/tests/helpers/assertions.js
node_modules/
dist/
**/*.rb

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, click, fillIn } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,6 +1,7 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, click, visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import siteSettingFixture from "discourse/tests/fixtures/site-settings";
acceptance("Admin - Site Settings", function (needs) {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, click, visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, click, fillIn } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,6 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { acceptance, visible } from "discourse/tests/helpers/qunit-helpers";
import DiscoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
acceptance("Category Banners", function (needs) {

View File

@ -1,9 +1,9 @@
import { click, fillIn, visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import DiscourseURL from "discourse/lib/url";
import sinon from "sinon";
import { acceptance, visible } from "discourse/tests/helpers/qunit-helpers";
acceptance("Category Edit", function (needs) {
needs.user();

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,10 +1,14 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit, currentURL } from "@ember/test-helpers";
import { skip } from "qunit";
import { test } from "qunit";
import { skip, test } from "qunit";
import I18n from "I18n";
import { run } from "@ember/runloop";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import {
acceptance,
invisible,
visible,
} from "discourse/tests/helpers/qunit-helpers";
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
import Draft from "discourse/models/draft";
import { Promise } from "rsvp";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -4,6 +4,7 @@ import I18n from "I18n";
import {
acceptance,
updateCurrentUser,
count,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Group Members - Anonymous", function () {

View File

@ -3,6 +3,7 @@ import { test } from "qunit";
import {
acceptance,
updateCurrentUser,
count,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Managing Group Category Notification Defaults", function () {

View File

@ -3,6 +3,7 @@ import { test } from "qunit";
import {
acceptance,
updateCurrentUser,
count,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Managing Group Profile", function () {

View File

@ -3,6 +3,7 @@ import { test } from "qunit";
import {
acceptance,
updateCurrentUser,
count,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Managing Group Tag Notification Defaults", function () {

View File

@ -2,7 +2,7 @@ import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
function setupGroupPretender(server, helper) {
server.post("/groups/Macdonald/request_membership", () => {

View File

@ -1,6 +1,11 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import {
acceptance,
invisible,
count,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Groups", function () {
test("Browsing Groups", async (assert) => {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,6 +1,7 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { acceptance, invisible } from "discourse/tests/helpers/qunit-helpers";
acceptance("Login Required", function (needs) {
needs.settings({ login_required: true });

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, click, fillIn } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, click } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, currentURL, click, fillIn } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,11 +1,12 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, fillIn, click } from "@ember/test-helpers";
import { skip } from "qunit";
import { test } from "qunit";
import { skip, test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import {
selectDate,
acceptance,
waitFor,
visible,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Search - Full Page", function (needs) {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import DiscourseURL from "discourse/lib/url";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,6 +1,7 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
acceptance("User Anonymous", function () {
test("Root URL", async (assert) => {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

View File

@ -1,21 +0,0 @@
// discourse-skip-module
function exists(selector) {
return count(selector) > 0;
}
function count(selector) {
return find(selector).length;
}
function visible(selector) {
return find(selector + ":visible").length > 0;
}
function invisible(selector) {
const $items = find(selector + ":visible");
return (
$items.length === 0 ||
$items.css("opacity") !== "1" ||
$items.css("visibility") === "hidden"
);
}

View File

@ -374,3 +374,24 @@ export async function selectDate(selector, date) {
resolve();
});
}
export function invisible(selector) {
const $items = find(selector + ":visible");
return (
$items.length === 0 ||
$items.css("opacity") !== "1" ||
$items.css("visibility") === "hidden"
);
}
export function visible(selector) {
return find(selector + ":visible").length > 0;
}
export function count(selector) {
return find(selector).length;
}
export function exists(selector) {
return count(selector) > 0;
}

View File

@ -1,6 +1,7 @@
import { moduleForComponent } from "ember-qunit";
import { isEmpty } from "@ember/utils";
import { click, fillIn } from "@ember/test-helpers";
import { exists } from "discourse/tests/helpers/qunit-helpers";
function checkSelectKitIsNotExpanded(selector) {
if (find(selector).hasClass("is-expanded")) {

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import componentTest from "discourse/tests/helpers/component-test";
import pretender from "discourse/tests/helpers/create-pretender";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import I18n from "I18n";
import componentTest from "discourse/tests/helpers/component-test";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import componentTest from "discourse/tests/helpers/component-test";
import { click } from "@ember/test-helpers";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import componentTest from "discourse/tests/helpers/component-test";
moduleForComponent("html-safe-helper", { integration: true });

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";
import DiscourseURL from "discourse/lib/url";
import Category from "discourse/models/category";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import componentTest from "discourse/tests/helpers/component-test";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import componentTest from "discourse/tests/helpers/component-test";

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import {
moduleForWidget,
widgetTest,

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import {
moduleForWidget,
widgetTest,

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import {
moduleForWidget,
widgetTest,

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";
import {
moduleForWidget,

View File

@ -15,6 +15,7 @@ import { ScrollingDOMMethods } from "discourse/mixins/scrolling";
import {
resetSite,
applyPretender,
exists,
} from "discourse/tests/helpers/qunit-helpers";
import PreloadStore from "discourse/lib/preload-store";
import User from "discourse/models/user";
@ -78,6 +79,18 @@ export default function setupTests(app, container) {
return window.sinon;
},
});
Object.defineProperty(window, "exists", {
get() {
deprecated(
"Accessing the global function `exists` is deprecated. Import it instead.",
{
since: "2.6.0.beta.4",
dropFrom: "2.6.0",
}
);
return exists;
},
});
QUnit.testStart(function (ctx) {
let settings = resetSettings();

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { afterRender } from "discourse-common/utils/decorators";
import Component from "@ember/component";
import componentTest from "discourse/tests/helpers/component-test";

View File

@ -14,6 +14,10 @@ module("Acceptance: wizard", {
},
});
function exists(selector) {
return document.querySelector(selector) !== null;
}
test("Wizard starts", async (assert) => {
await visit("/");
assert.ok(exists(".wizard-column-contents"));

View File

@ -17,7 +17,6 @@
//= require ember-template-compiler
//= require wizard-application
//= require wizard-vendor
//= require helpers/assertions
//= require_tree ./helpers
//= require_tree ./acceptance
//= require_tree ./models

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import {
acceptance,
updateCurrentUser,

View File

@ -1,3 +1,4 @@
import { exists } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import {
acceptance,