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

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

diff --git a/app/assets/javascripts/discourse/app/models/post.js b/app/assets/javascripts/discourse/app/models/post.js
index 5da002a..97642f0 100644
--- a/app/assets/javascripts/discourse/app/models/post.js
+++ b/app/assets/javascripts/discourse/app/models/post.js
@@ -19,8 +19,14 @@ import { resolveShareUrl } from "discourse/helpers/share-url";
 import { userPath } from "discourse/lib/url";
 
 const Post = RestModel.extend({
-  @discourseComputed("url")
+  customShare: null,
+
+  @discourseComputed("url", "customShare")
   shareUrl(url) {
+    if (this.customShare) {
+      return this.customShare;
+    }
+
     const user = User.current();
     return resolveShareUrl(url, user);
   },
diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js
index 42aee81..f03364e 100644
--- a/app/assets/javascripts/discourse/app/widgets/post.js
+++ b/app/assets/javascripts/discourse/app/widgets/post.js
@@ -701,7 +701,17 @@ createWidget("post-article", {
         .then((posts) => {
           this.state.repliesAbove = posts.map((p) => {
             let result = transformWithCallbacks(p);
-            result.shareUrl = `${topicUrl}/${p.post_number}`;
+
+            // We don't want to overwrite CPs - we are doing something a bit weird
+            // here by creating a post object from a transformed post. They aren't
+            // 100% the same.
+            delete result.new_user;
+            delete result.deleted;
+            delete result.shareUrl;
+            delete result.firstPost;
+            delete result.usernameUrl;
+
+            result.customShare = `${topicUrl}/${p.post_number}`;
             result.asPost = this.store.createRecord("post", result);
             return result;
           });
diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js
index 137b9a2..98d33e1 100644
--- a/app/assets/javascripts/discourse/ember-cli-build.js
+++ b/app/assets/javascripts/discourse/ember-cli-build.js
@@ -35,6 +35,7 @@ module.exports = function (defaults) {
   app.import(vendorJs + "jquery.ui.widget.js");
   app.import(vendorJs + "jquery.fileupload.js");
   app.import(vendorJs + "jquery.autoellipsis-1.0.10.js");
+  app.import(vendorJs + "show-html.js");
 
   let adminVendor = funnel(vendorJs, {
     files: ["resumable.js"],
diff --git a/app/assets/javascripts/discourse/tests/helpers/widget-test.js b/app/assets/javascripts/discourse/tests/helpers/widget-test.js
index ed1514e..93f16c3 100644
--- a/app/assets/javascripts/discourse/tests/helpers/widget-test.js
+++ b/app/assets/javascripts/discourse/tests/helpers/widget-test.js
@@ -1,8 +1,16 @@
 import { addPretenderCallback } from "discourse/tests/helpers/qunit-helpers";
 import componentTest from "discourse/tests/helpers/component-test";
 import { moduleForComponent } from "ember-qunit";
+import { warn } from "@ember/debug";
+import deprecated from "discourse-common/lib/deprecated";
 
 export function moduleForWidget(name, options = {}) {
+  warn(
+    "moduleForWidget will not work in the Ember CLI environment. Please upgrade your tests.",
+    { id: "module-for-widget" }
+  );
+  return;
+
   let fullName = `widget:${name}`;
   addPretenderCallback(fullName, options.pretend);
 
@@ -17,5 +25,6 @@ export function moduleForWidget(name, options = {}) {
 }
 
 export function widgetTest(name, opts) {
+  deprecated("Use `componentTest` instead of `widgetTest`");
   return componentTest(name, opts);
 }
diff --git a/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js b/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js
index 63204bd..fbc2e8d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js
@@ -12,7 +12,7 @@ discourseModule("Integration | Component | slow-mode-info", function (hooks) {
   setupRenderingTest(hooks);
 
   componentTest("doesn't render if the topic is closed", {
-    template: "{{slow-mode-info topic=topic}}",
+    template: hbs`{{slow-mode-info topic=topic}}`,
 
     beforeEach() {
       this.set("topic", { slow_mode_seconds: 3600, closed: true });
diff --git a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6 b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6
index 25c310d..5c475de 100644
--- a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6
+++ b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6
@@ -6,6 +6,7 @@ import {
 import I18n from "I18n";
 import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
 import selectKit from "discourse/tests/helpers/select-kit-helper";
+import { test } from "qunit";
 
 acceptance("Details Button", function (needs) {
   needs.user();
diff --git a/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6 b/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
index 1962054..28df628 100644
--- a/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
+++ b/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
@@ -1,4 +1,5 @@
 import PrettyText, { buildOptions } from "pretty-text/pretty-text";
+import { module, test } from "qunit";
 
 module("lib:details-cooked-test");
 
diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js.es6 b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js.es6
index bd0b794..1ca18d5 100644
--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js.es6
+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js.es6
@@ -1,4 +1,5 @@
 import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
+import { test } from "qunit";
 
 acceptance("Local Dates - composer", function (needs) {
   needs.user();
diff --git a/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js.es6 b/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js.es6
index af43d09..71848a1 100644
--- a/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js.es6
+++ b/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js.es6
@@ -1,4 +1,5 @@
 import DateWithZoneHelper from "./date-with-zone-helper";
+import { module, test } from "qunit";
 
 const PARIS = "Europe/Paris";
 const SYDNEY = "Australia/Sydney";
diff --git a/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js.es6 b/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js.es6
index 74fb290..9764dac 100644
--- a/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js.es6
+++ b/plugins/discourse-local-dates/test/javascripts/lib/local-date-builder-test.js.es6
@@ -1,6 +1,7 @@
 import I18n from "I18n";
 import LocalDateBuilder from "./local-date-builder";
 import sinon from "sinon";
+import { module, test } from "qunit";
 
 const UTC = "Etc/UTC";
 const SYDNEY = "Australia/Sydney";
diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6
index a067838..04a51d7 100644
--- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6
+++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6
@@ -98,7 +98,8 @@ export default Controller.extend(ModalFunctionality, {
 
   @discourseComputed("pollOptions.@each.value")
   pollOptionsCount(pollOptions) {
-    return pollOptions.filter((option) => option.value.length > 0).length;
+    return (pollOptions || []).filter((option) => option.value.length > 0)
+      .length;
   },
 

[... diff too long, it was truncated ...]

GitHub sha: 77d33ebe21c2994825624b64c367732a23f98537

This commit appears in #13320 which was approved by CvX. It was merged by eviltrout.