mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
DEV: Remove all use of Ember/jQuery globals in core (#18670)
This commit is contained in:
parent
6b788d7329
commit
58e59e3579
|
@ -13,18 +13,15 @@ export function setEnvironment(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isTesting() {
|
export function isTesting() {
|
||||||
// eslint-disable-next-line no-undef
|
return environment === "testing";
|
||||||
return Ember.testing || environment === "testing";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generally means "before we migrated to Ember CLI"
|
// Generally means "before we migrated to Ember CLI"
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
let _isLegacy = Ember.VERSION.startsWith("3.12");
|
|
||||||
export function isLegacyEmber() {
|
export function isLegacyEmber() {
|
||||||
deprecated("`isLegacyEmber()` is now deprecated and always returns true", {
|
deprecated("`isLegacyEmber()` is now deprecated and always returns false", {
|
||||||
dropFrom: "3.0.0.beta1",
|
dropFrom: "3.0.0.beta1",
|
||||||
});
|
});
|
||||||
return _isLegacy;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDevelopment() {
|
export function isDevelopment() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global Ember */
|
import Ember from "ember";
|
||||||
import { classify, dasherize, decamelize } from "@ember/string";
|
import { classify, dasherize, decamelize } from "@ember/string";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
import deprecated from "discourse-common/lib/deprecated";
|
||||||
import { findHelper } from "discourse-common/lib/helpers";
|
import { findHelper } from "discourse-common/lib/helpers";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global Ember */
|
import Ember from "ember";
|
||||||
import { dasherize, decamelize } from "@ember/string";
|
import { dasherize, decamelize } from "@ember/string";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
import deprecated from "discourse-common/lib/deprecated";
|
||||||
import { findHelper } from "discourse-common/lib/helpers";
|
import { findHelper } from "discourse-common/lib/helpers";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import tippy from "tippy.js";
|
import tippy from "tippy.js";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
export default class DiscourseTooltip extends Component {
|
export default class DiscourseTooltip extends Component {
|
||||||
tagName = "";
|
tagName = "";
|
||||||
|
@ -20,7 +21,6 @@ export default class DiscourseTooltip extends Component {
|
||||||
// Ember.ViewUtils.getViewBounds is a private API,
|
// Ember.ViewUtils.getViewBounds is a private API,
|
||||||
// but it's not going to be dropped without a public deprecation warning,
|
// but it's not going to be dropped without a public deprecation warning,
|
||||||
// see: https://stackoverflow.com/a/50125938/3206146
|
// see: https://stackoverflow.com/a/50125938/3206146
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
const viewBounds = Ember.ViewUtils.getViewBounds(this);
|
const viewBounds = Ember.ViewUtils.getViewBounds(this);
|
||||||
const element = viewBounds.firstNode;
|
const element = viewBounds.firstNode;
|
||||||
const parent = viewBounds.parentElement;
|
const parent = viewBounds.parentElement;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { action, set } from "@ember/object";
|
import { action, set } from "@ember/object";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
let _components = {};
|
let _components = {};
|
||||||
|
|
||||||
|
@ -108,9 +109,7 @@ export default Component.extend({
|
||||||
let dasherized = dasherize(type);
|
let dasherized = dasherize(type);
|
||||||
let templatePath = `components/${dasherized}`;
|
let templatePath = `components/${dasherized}`;
|
||||||
let template =
|
let template =
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[`${templatePath}`] ||
|
Ember.TEMPLATES[`${templatePath}`] ||
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[`javascripts/${templatePath}`];
|
Ember.TEMPLATES[`javascripts/${templatePath}`];
|
||||||
_components[type] = template ? dasherized : null;
|
_components[type] = template ? dasherized : null;
|
||||||
return _components[type];
|
return _components[type];
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
let initializedOnce = false;
|
let initializedOnce = false;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -10,7 +12,6 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.EventDispatcher.reopen({
|
Ember.EventDispatcher.reopen({
|
||||||
events: {
|
events: {
|
||||||
touchend: "touchEnd",
|
touchend: "touchEnd",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Ember from "ember";
|
||||||
let initializedOnce = false;
|
let initializedOnce = false;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -8,7 +9,6 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.LinkComponent.reopen({
|
Ember.LinkComponent.reopen({
|
||||||
attributeBindings: ["name"],
|
attributeBindings: ["name"],
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,9 +10,9 @@ import { selectedText } from "discourse/lib/utilities";
|
||||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
import deprecated from "discourse-common/lib/deprecated";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
import jQuery from "jquery";
|
||||||
|
|
||||||
export function isValidLink(link) {
|
export function isValidLink(link) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
if (link instanceof jQuery) {
|
if (link instanceof jQuery) {
|
||||||
link = link[0];
|
link = link[0];
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { helperContext, makeArray } from "discourse-common/lib/helpers";
|
import { helperContext, makeArray } from "discourse-common/lib/helpers";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
import deprecated from "discourse-common/lib/deprecated";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import jQuery from "jquery";
|
||||||
|
|
||||||
export function shortDate(date) {
|
export function shortDate(date) {
|
||||||
return moment(date).format(I18n.t("dates.medium.date_year"));
|
return moment(date).format(I18n.t("dates.medium.date_year"));
|
||||||
|
@ -50,7 +51,6 @@ export function longDateNoYear(dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateRelativeAge(elems) {
|
export function updateRelativeAge(elems) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
if (elems instanceof jQuery) {
|
if (elems instanceof jQuery) {
|
||||||
elems = elems.toArray();
|
elems = elems.toArray();
|
||||||
deprecated("updateRelativeAge now expects a DOM NodeList", {
|
deprecated("updateRelativeAge now expects a DOM NodeList", {
|
||||||
|
|
|
@ -34,8 +34,7 @@ export default function (elem, siteSettings) {
|
||||||
mainClass: "mfp-zoom-in",
|
mainClass: "mfp-zoom-in",
|
||||||
tClose: I18n.t("lightbox.close"),
|
tClose: I18n.t("lightbox.close"),
|
||||||
tLoading: spinnerHTML,
|
tLoading: spinnerHTML,
|
||||||
// eslint-disable-next-line no-undef
|
prependTo: isTesting() && document.getElementById("ember-testing"),
|
||||||
prependTo: Ember.testing && document.getElementById("ember-testing"),
|
|
||||||
|
|
||||||
gallery: {
|
gallery: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
|
@ -2,13 +2,13 @@ import deprecated from "discourse-common/lib/deprecated";
|
||||||
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { replaceSpan } from "discourse/lib/category-hashtags";
|
import { replaceSpan } from "discourse/lib/category-hashtags";
|
||||||
|
import jQuery from "jquery";
|
||||||
|
|
||||||
const categoryHashtags = {};
|
const categoryHashtags = {};
|
||||||
const tagHashtags = {};
|
const tagHashtags = {};
|
||||||
const checkedHashtags = new Set();
|
const checkedHashtags = new Set();
|
||||||
|
|
||||||
export function linkSeenHashtags(elem) {
|
export function linkSeenHashtags(elem) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
if (elem instanceof jQuery) {
|
if (elem instanceof jQuery) {
|
||||||
elem = elem[0];
|
elem = elem[0];
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
import { formatUsername } from "discourse/lib/utilities";
|
import { formatUsername } from "discourse/lib/utilities";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
|
import jQuery from "jquery";
|
||||||
|
|
||||||
let maxGroupMention;
|
let maxGroupMention;
|
||||||
|
|
||||||
|
@ -67,7 +68,6 @@ function updateFound(mentions, usernames) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function linkSeenMentions(elem, siteSettings) {
|
export function linkSeenMentions(elem, siteSettings) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
if (elem instanceof jQuery) {
|
if (elem instanceof jQuery) {
|
||||||
elem = elem[0];
|
elem = elem[0];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { buildRawConnectorCache } from "discourse-common/lib/raw-templates";
|
import { buildRawConnectorCache } from "discourse-common/lib/raw-templates";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
import deprecated from "discourse-common/lib/deprecated";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
let _connectorCache;
|
let _connectorCache;
|
||||||
let _rawConnectorCache;
|
let _rawConnectorCache;
|
||||||
|
@ -65,14 +66,12 @@ function findClass(outletName, uniqueName) {
|
||||||
function buildConnectorCache() {
|
function buildConnectorCache() {
|
||||||
_connectorCache = {};
|
_connectorCache = {};
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
findOutlets(Ember.TEMPLATES, (outletName, resource, uniqueName) => {
|
findOutlets(Ember.TEMPLATES, (outletName, resource, uniqueName) => {
|
||||||
_connectorCache[outletName] = _connectorCache[outletName] || [];
|
_connectorCache[outletName] = _connectorCache[outletName] || [];
|
||||||
|
|
||||||
_connectorCache[outletName].push({
|
_connectorCache[outletName].push({
|
||||||
outletName,
|
outletName,
|
||||||
templateName: resource.replace("javascripts/", ""),
|
templateName: resource.replace("javascripts/", ""),
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
template: Ember.TEMPLATES[resource],
|
template: Ember.TEMPLATES[resource],
|
||||||
classNames: `${outletName}-outlet ${uniqueName}`,
|
classNames: `${outletName}-outlet ${uniqueName}`,
|
||||||
connectorClass: findClass(outletName, uniqueName),
|
connectorClass: findClass(outletName, uniqueName),
|
||||||
|
|
|
@ -8,6 +8,7 @@ import identifySource, {
|
||||||
consolePrefix,
|
consolePrefix,
|
||||||
getThemeInfo,
|
getThemeInfo,
|
||||||
} from "discourse/lib/source-identifier";
|
} from "discourse/lib/source-identifier";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
const showingErrors = new Set();
|
const showingErrors = new Set();
|
||||||
|
|
||||||
|
@ -52,7 +53,6 @@ function reportToLogster(name, error) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: To be moved out into a logster-provided lib
|
// TODO: To be moved out into a logster-provided lib
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.$.ajax(getURL("/logs/report_js_error"), {
|
Ember.$.ajax(getURL("/logs/report_js_error"), {
|
||||||
data,
|
data,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|
|
@ -2,15 +2,14 @@ import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
acceptance("CustomHTML template", function (needs) {
|
acceptance("CustomHTML template", function (needs) {
|
||||||
needs.hooks.beforeEach(() => {
|
needs.hooks.beforeEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES["top"] = hbs`<span class='top-span'>TOP</span>`;
|
Ember.TEMPLATES["top"] = hbs`<span class='top-span'>TOP</span>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.hooks.afterEach(() => {
|
needs.hooks.afterEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES["top"];
|
delete Ember.TEMPLATES["top"];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { test } from "qunit";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
acceptance("Modal", function (needs) {
|
acceptance("Modal", function (needs) {
|
||||||
let _translations;
|
let _translations;
|
||||||
|
@ -53,7 +54,6 @@ acceptance("Modal", function (needs) {
|
||||||
await triggerKeyEvent("#main-outlet", "keydown", "Escape");
|
await triggerKeyEvent("#main-outlet", "keydown", "Escape");
|
||||||
assert.ok(!exists(".d-modal:visible"), "ESC should close the modal");
|
assert.ok(!exists(".d-modal:visible"), "ESC should close the modal");
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[
|
Ember.TEMPLATES[
|
||||||
"modal/not-dismissable"
|
"modal/not-dismissable"
|
||||||
] = hbs`{{#d-modal-body title="" class="" dismissable=false}}test{{/d-modal-body}}`;
|
] = hbs`{{#d-modal-body title="" class="" dismissable=false}}test{{/d-modal-body}}`;
|
||||||
|
@ -78,7 +78,6 @@ acceptance("Modal", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("rawTitle in modal panels", async function (assert) {
|
test("rawTitle in modal panels", async function (assert) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES["modal/test-raw-title-panels"] = hbs``;
|
Ember.TEMPLATES["modal/test-raw-title-panels"] = hbs``;
|
||||||
const panels = [
|
const panels = [
|
||||||
{ id: "test1", rawTitle: "Test 1" },
|
{ id: "test1", rawTitle: "Test 1" },
|
||||||
|
@ -97,9 +96,7 @@ acceptance("Modal", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("modal title", async function (assert) {
|
test("modal title", async function (assert) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES["modal/test-title"] = hbs``;
|
Ember.TEMPLATES["modal/test-title"] = hbs``;
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[
|
Ember.TEMPLATES[
|
||||||
"modal/test-title-with-body"
|
"modal/test-title-with-body"
|
||||||
] = hbs`{{#d-modal-body}}test{{/d-modal-body}}`;
|
] = hbs`{{#d-modal-body}}test{{/d-modal-body}}`;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { action } from "@ember/object";
|
||||||
import { extraConnectorClass } from "discourse/lib/plugin-connectors";
|
import { extraConnectorClass } from "discourse/lib/plugin-connectors";
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
const PREFIX = "javascripts/single-test/connectors";
|
const PREFIX = "javascripts/single-test/connectors";
|
||||||
|
|
||||||
|
@ -48,29 +49,23 @@ acceptance("Plugin Outlet - Connector Class", function (needs) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[
|
Ember.TEMPLATES[
|
||||||
`${PREFIX}/user-profile-primary/hello`
|
`${PREFIX}/user-profile-primary/hello`
|
||||||
] = hbs`<span class='hello-username'>{{model.username}}</span>
|
] = hbs`<span class='hello-username'>{{model.username}}</span>
|
||||||
<button class='say-hello' {{on "click" (action "sayHello")}}></button>
|
<button class='say-hello' {{on "click" (action "sayHello")}}></button>
|
||||||
<span class='hello-result'>{{hello}}</span>`;
|
<span class='hello-result'>{{hello}}</span>`;
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[
|
Ember.TEMPLATES[
|
||||||
`${PREFIX}/user-profile-primary/hi`
|
`${PREFIX}/user-profile-primary/hi`
|
||||||
] = hbs`<button class='say-hi' {{on "click" (action "sayHi")}}></button>
|
] = hbs`<button class='say-hi' {{on "click" (action "sayHi")}}></button>
|
||||||
<span class='hi-result'>{{hi}}</span>`;
|
<span class='hi-result'>{{hi}}</span>`;
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[
|
Ember.TEMPLATES[
|
||||||
`${PREFIX}/user-profile-primary/dont-render`
|
`${PREFIX}/user-profile-primary/dont-render`
|
||||||
] = hbs`I'm not rendered!`;
|
] = hbs`I'm not rendered!`;
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.hooks.afterEach(() => {
|
needs.hooks.afterEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`];
|
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`];
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hi`];
|
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hi`];
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
|
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { hbs } from "ember-cli-htmlbars";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
const PREFIX = "javascripts/single-test/connectors";
|
const PREFIX = "javascripts/single-test/connectors";
|
||||||
|
|
||||||
|
@ -14,9 +15,7 @@ acceptance("Plugin Outlet - Decorator", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
|
||||||
needs.hooks.beforeEach(() => {
|
needs.hooks.beforeEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/foo`] = hbs`FOO`;
|
Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/foo`] = hbs`FOO`;
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/bar`] = hbs`BAR`;
|
Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/bar`] = hbs`BAR`;
|
||||||
|
|
||||||
withPluginApi("0.8.38", (api) => {
|
withPluginApi("0.8.38", (api) => {
|
||||||
|
@ -39,9 +38,7 @@ acceptance("Plugin Outlet - Decorator", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.hooks.afterEach(() => {
|
needs.hooks.afterEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/foo`];
|
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/foo`];
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/bar`];
|
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/bar`];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
const HELLO = "javascripts/multi-test/connectors/user-profile-primary/hello";
|
const HELLO = "javascripts/multi-test/connectors/user-profile-primary/hello";
|
||||||
const GOODBYE =
|
const GOODBYE =
|
||||||
|
@ -13,16 +14,12 @@ const GOODBYE =
|
||||||
|
|
||||||
acceptance("Plugin Outlet - Multi Template", function (needs) {
|
acceptance("Plugin Outlet - Multi Template", function (needs) {
|
||||||
needs.hooks.beforeEach(() => {
|
needs.hooks.beforeEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[HELLO] = hbs`<span class='hello-span'>Hello</span>`;
|
Ember.TEMPLATES[HELLO] = hbs`<span class='hello-span'>Hello</span>`;
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[GOODBYE] = hbs`<span class='bye-span'>Goodbye</span>`;
|
Ember.TEMPLATES[GOODBYE] = hbs`<span class='bye-span'>Goodbye</span>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.hooks.afterEach(() => {
|
needs.hooks.afterEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[HELLO];
|
delete Ember.TEMPLATES[HELLO];
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[GOODBYE];
|
delete Ember.TEMPLATES[GOODBYE];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,20 +6,19 @@ import {
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
const CONNECTOR =
|
const CONNECTOR =
|
||||||
"javascripts/single-test/connectors/user-profile-primary/hello";
|
"javascripts/single-test/connectors/user-profile-primary/hello";
|
||||||
|
|
||||||
acceptance("Plugin Outlet - Single Template", function (needs) {
|
acceptance("Plugin Outlet - Single Template", function (needs) {
|
||||||
needs.hooks.beforeEach(() => {
|
needs.hooks.beforeEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[
|
Ember.TEMPLATES[
|
||||||
CONNECTOR
|
CONNECTOR
|
||||||
] = hbs`<span class='hello-username'>{{model.username}}</span>`;
|
] = hbs`<span class='hello-username'>{{model.username}}</span>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.hooks.afterEach(() => {
|
needs.hooks.afterEach(() => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
delete Ember.TEMPLATES[CONNECTOR];
|
delete Ember.TEMPLATES[CONNECTOR];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { click, fillIn, triggerEvent } from "@ember/test-helpers";
|
||||||
import { exists, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
import { exists, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { moduleForComponent } from "ember-qunit";
|
import { moduleForComponent } from "ember-qunit";
|
||||||
|
import jQuery from "jquery";
|
||||||
|
|
||||||
function checkSelectKitIsNotExpanded(selector) {
|
function checkSelectKitIsNotExpanded(selector) {
|
||||||
if (query(selector).classList.contains("is-expanded")) {
|
if (query(selector).classList.contains("is-expanded")) {
|
||||||
|
@ -65,7 +66,6 @@ async function keyboardHelper(value, target, selector) {
|
||||||
|
|
||||||
if (value === "selectAll") {
|
if (value === "selectAll") {
|
||||||
// special casing the only one not working with triggerEvent
|
// special casing the only one not working with triggerEvent
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
const event = jQuery.Event("keydown");
|
const event = jQuery.Event("keydown");
|
||||||
event.key = "A";
|
event.key = "A";
|
||||||
event.keyCode = 65;
|
event.keyCode = 65;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import { disableCloaking } from "discourse/widgets/post-stream";
|
||||||
import { clearState as clearPresenceState } from "discourse/tests/helpers/presence-pretender";
|
import { clearState as clearPresenceState } from "discourse/tests/helpers/presence-pretender";
|
||||||
import { addModuleExcludeMatcher } from "ember-cli-test-loader/test-support/index";
|
import { addModuleExcludeMatcher } from "ember-cli-test-loader/test-support/index";
|
||||||
import SiteSettingService from "discourse/services/site-settings";
|
import SiteSettingService from "discourse/services/site-settings";
|
||||||
|
import jQuery from "jquery";
|
||||||
|
|
||||||
const Plugin = $.fn.modal;
|
const Plugin = $.fn.modal;
|
||||||
const Modal = Plugin.Constructor;
|
const Modal = Plugin.Constructor;
|
||||||
|
@ -389,7 +390,6 @@ export default function setupTests(config) {
|
||||||
addModuleExcludeMatcher((name) => !shouldLoadModule(name));
|
addModuleExcludeMatcher((name) => !shouldLoadModule(name));
|
||||||
|
|
||||||
// forces 0 as duration for all jquery animations
|
// forces 0 as duration for all jquery animations
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
jQuery.fx.off = true;
|
jQuery.fx.off = true;
|
||||||
|
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { start } from "ember-qunit";
|
||||||
import loadEmberExam from "ember-exam/test-support/load";
|
import loadEmberExam from "ember-exam/test-support/load";
|
||||||
import * as QUnit from "qunit";
|
import * as QUnit from "qunit";
|
||||||
import { setup } from "qunit-dom";
|
import { setup } from "qunit-dom";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
setEnvironment("testing");
|
setEnvironment("testing");
|
||||||
|
|
||||||
|
@ -27,7 +28,6 @@ document.addEventListener("discourse-booted", () => {
|
||||||
const skipCore = params.get("qunit_skip_core") === "1";
|
const skipCore = params.get("qunit_skip_core") === "1";
|
||||||
const disableAutoStart = params.get("qunit_disable_auto_start") === "1";
|
const disableAutoStart = params.get("qunit_disable_auto_start") === "1";
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION = false;
|
Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION = false;
|
||||||
|
|
||||||
document.body.insertAdjacentHTML(
|
document.body.insertAdjacentHTML(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { buildResolver, setResolverOption } from "discourse-common/resolver";
|
import { buildResolver, setResolverOption } from "discourse-common/resolver";
|
||||||
import { module, test } from "qunit";
|
import { module, test } from "qunit";
|
||||||
|
import Ember from "ember";
|
||||||
|
|
||||||
let originalTemplates;
|
let originalTemplates;
|
||||||
let resolver;
|
let resolver;
|
||||||
|
@ -12,7 +13,6 @@ function lookupTemplate(assert, name, expectedTemplate, message) {
|
||||||
|
|
||||||
function setTemplates(lookupTemplateStrings) {
|
function setTemplates(lookupTemplateStrings) {
|
||||||
lookupTemplateStrings.forEach(function (lookupTemplateString) {
|
lookupTemplateStrings.forEach(function (lookupTemplateString) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES[lookupTemplateString] = lookupTemplateString;
|
Ember.TEMPLATES[lookupTemplateString] = lookupTemplateString;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,7 @@ const DiscourseResolver = buildResolver("discourse");
|
||||||
|
|
||||||
module("Unit | Ember | resolver", function (hooks) {
|
module("Unit | Ember | resolver", function (hooks) {
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
originalTemplates = Ember.TEMPLATES;
|
originalTemplates = Ember.TEMPLATES;
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES = {};
|
Ember.TEMPLATES = {};
|
||||||
|
|
||||||
resolver = DiscourseResolver.create({
|
resolver = DiscourseResolver.create({
|
||||||
|
@ -32,7 +30,6 @@ module("Unit | Ember | resolver", function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
hooks.afterEach(function () {
|
hooks.afterEach(function () {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
Ember.TEMPLATES = originalTemplates;
|
Ember.TEMPLATES = originalTemplates;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user