From 9347108f0294916e43aeb70b8c60e944132e2234 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 23 Oct 2019 13:25:25 -0400 Subject: [PATCH] Support for importing jQuery Also remove Ember.Qunit error about Ember.$ for now --- app/assets/javascripts/discourse-loader.js | 1 + app/assets/javascripts/wizard/lib/ajax.js.es6 | 3 ++- vendor/assets/javascripts/ember-qunit.js | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index f20e7d1ab73..7831db85c8c 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -5,6 +5,7 @@ var define, requirejs; var EMBER_MODULES = {}; if (typeof Ember !== "undefined") { EMBER_MODULES = { + jquery: { default: $ }, "@ember/component": { default: Ember.Component }, "@ember/controller": { default: Ember.Controller }, "@ember/object": { default: Ember.Object }, diff --git a/app/assets/javascripts/wizard/lib/ajax.js.es6 b/app/assets/javascripts/wizard/lib/ajax.js.es6 index e1a79338057..9112c3787ff 100644 --- a/app/assets/javascripts/wizard/lib/ajax.js.es6 +++ b/app/assets/javascripts/wizard/lib/ajax.js.es6 @@ -1,4 +1,5 @@ import getUrl from "discourse-common/lib/get-url"; +import jQuery from "jquery"; let token; @@ -16,6 +17,6 @@ export function ajax(args) { args.success = data => Ember.run(null, resolve, data); args.error = xhr => Ember.run(null, reject, xhr); args.url = getUrl(args.url); - Ember.$.ajax(args); + jQuery.ajax(args); }); } diff --git a/vendor/assets/javascripts/ember-qunit.js b/vendor/assets/javascripts/ember-qunit.js index fd722360ee7..37e2d05067e 100644 --- a/vendor/assets/javascripts/ember-qunit.js +++ b/vendor/assets/javascripts/ember-qunit.js @@ -1874,7 +1874,7 @@ define('ember-test-helpers/wait', ['exports', 'ember'], function (exports, _embe exports._setupAJAXHooks = _setupAJAXHooks; exports['default'] = wait; - var jQuery = _ember['default'].$; + var jQuery = $; var requests; function incrementAjaxPendingRequests(_, xhr) { @@ -1988,4 +1988,4 @@ for (var exportName in emberQUnit) { } })(); -//# sourceMappingURL=ember-qunit.map \ No newline at end of file +//# sourceMappingURL=ember-qunit.map