A platform for community discussion. Free, open, simple.
DEV: Migrate more tests to our Ember CLI format. (#11899)
Robin Wardf1136481078b
diff --git a/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js b/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.jsindex 6d8de06da14..3ec8ac87517 100644--- a/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js@@ -1,4 +1,8 @@-import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";+import {+ acceptance,+ exists,+ queryAll,+} from "discourse/tests/helpers/qunit-helpers";import { click, fillIn, visit } from "@ember/test-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import { test } from "qunit";diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.jsindex 8d0670b0c8d..c720d94dd25 100644--- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js@@ -388,7 +388,7 @@ acceptance("Tag info", function (needs) {test("composer will not set tags if user cannot create them", async function (assert) {await visit("/tag/planters");await click("#create-topic");- const composer = this.container.lookup("controller:composer");- assert.equal(composer.model.tags, null);+ let composer = this.owner.lookup("controller:composer");+ assert.equal(composer.get("model").tags, null);});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-test.jsindex 68f80fd134f..0b54c403f38 100644--- a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js@@ -1,5 +1,6 @@import {acceptance,+ exists,queryAll,visible,} from "discourse/tests/helpers/qunit-helpers";diff --git a/app/assets/javascripts/discourse/tests/helpers/component-test.js b/app/assets/javascripts/discourse/tests/helpers/component-test.jsindex 963e0df05e7..a7604c3e61e 100644--- a/app/assets/javascripts/discourse/tests/helpers/component-test.js+++ b/app/assets/javascripts/discourse/tests/helpers/component-test.js@@ -1,7 +1,8 @@+import { TestModuleForComponent, render } from "@ember/test-helpers";import EmberObject from "@ember/object";+import { setupRenderingTest as EmberSetupRenderingTest } from "ember-qunit";import Session from "discourse/models/session";import Site from "discourse/models/site";-import { TestModuleForComponent } from "@ember/test-helpers";import TopicTrackingState from "discourse/models/topic-tracking-state";import User from "discourse/models/user";import { autoLoadModules } from "discourse/initializers/auto-load-modules";@@ -9,7 +10,13 @@ import createStore from "discourse/tests/helpers/create-store";import { currentSettings } from "discourse/tests/helpers/site-settings";import { test } from "qunit";+const LEGACY_ENV = !EmberSetupRenderingTest;+export function setupRenderingTest(hooks) {+ if (!LEGACY_ENV) {+ return EmberSetupRenderingTest.apply(this, arguments);+ }+let testModule;hooks.before(function () {@@ -40,60 +47,87 @@ export default function (name, opts) {return;}- test(name, function (assert) {+ if (typeof opts.template === "string") {+ let testName = QUnit.config.currentModule.name + " " + name;+ // eslint-disable-next-line+ console.warn(+ `${testName} skipped; template must be compiled and not a string`+ );+ return;+ }++ test(name, async function (assert) {this.site = Site.current();this.session = Session.current();- this.registry.register("site-settings:main", currentSettings(), {- instantiate: false,- });- this.registry.register("capabilities:main", EmberObject);- this.registry.register("site:main", this.site, { instantiate: false });- this.registry.register("session:main", this.session, {- instantiate: false,- });- this.registry.injection("component", "siteSettings", "site-settings:main");- this.registry.injection("component", "appEvents", "service:app-events");- this.registry.injection("component", "capabilities", "capabilities:main");- this.registry.injection("component", "site", "site:main");- this.registry.injection("component", "session", "session:main");+ let owner = LEGACY_ENV ? this.registry : this.owner;+ let store;+ if (LEGACY_ENV) {+ this.registry.register("site-settings:main", currentSettings(), {+ instantiate: false,+ });+ this.registry.register("capabilities:main", EmberObject);+ this.registry.register("site:main", this.site, { instantiate: false });+ this.registry.register("session:main", this.session, {+ instantiate: false,+ });+ this.registry.injection(+ "component",+ "siteSettings",+ "site-settings:main"+ );+ this.registry.injection("component", "appEvents", "service:app-events");+ this.registry.injection("component", "capabilities", "capabilities:main");+ this.registry.injection("component", "site", "site:main");+ this.registry.injection("component", "session", "session:main");- this.siteSettings = currentSettings();+ this.siteSettings = currentSettings();+ store = createStore();+ this.registry.register("service:store", store, { instantiate: false });+ } else {+ this.container = owner;+ store = this.container.lookup("service:store");+ }autoLoadModules(this.container, this.registry);- const store = createStore();if (!opts.anonymous) {const currentUser = User.create({username: "eviltrout",timezone: "Australia/Brisbane",});this.currentUser = currentUser;- this.registry.register("current-user:main", this.currentUser, {++ owner.unregister("current-user:main");+ owner.register("current-user:main", currentUser, {instantiate: false,});- this.registry.injection("component", "currentUser", "current-user:main");- this.registry.register(+ if (LEGACY_ENV) {+ owner.injection("component", "currentUser", "current-user:main");+ } else {+ owner.inject("component", "currentUser", "current-user:main");+ }+ owner.unregister("topic-tracking-state:main");+ owner.register("topic-tracking-state:main",TopicTrackingState.create({ currentUser }),{ instantiate: false });}- this.registry.register("service:store", store, { instantiate: false });-if (opts.beforeEach) {opts.beforeEach.call(this, store);}+ $.fn.autocomplete = function () {};andThen(() => {- return this.render(opts.template);+ return LEGACY_ENV ? this.render(opts.template) : render(opts.template);});andThen(() => {return opts.test.call(this, assert);- }).finally(() => {+ }).finally(async () => {if (opts.afterEach) {- andThen(() => {+ await andThen(() => {return opts.afterEach.call(opts);});}diff --git a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js b/app/assets/javascripts/discourse/tests/helpers/create-pretender.jsindex 80997d6f075..bd46cfe2c1e 100644--- a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js+++ b/app/assets/javascripts/discourse/tests/helpers/create-pretender.js@@ -290,14 +290,24 @@ export function applyDefaultHandlers(pretender) {});});+ // TODO: Remove this old path when no longer using old emberpretender.get("/post_replies", () => {return response({ post_replies: [{ id: 1234, cooked: "wat" }] });});+ pretender.get("/posts/:id/replies", () => {+ return response([{ id: 1234, cooked: "wat" }]);+ });++ // TODO: Remove this old path when no longer using old emberpretender.get("/post_reply_histories", () => {return response({ post_reply_histories: [{ id: 1234, cooked: "wat" }] });});+ pretender.get("/posts/:id/reply-history", () => {+ return response([{ id: 1234, cooked: "wat" }]);+ });+pretender.get("/categories_and_latest", () =>response(fixturesByUrl["/categories_and_latest.json"]));diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.jsindex b0eb8d32670..3b43662264b 100644--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js@@ -9,8 +9,10 @@ import {mergeSettings,} from "discourse/tests/helpers/site-settings";import { forceMobile, resetMobile } from "discourse/lib/mobile";+import { getApplication, getContext } from "@ember/test-helpers";import { getOwner, setDefaultOwner } from "discourse-common/lib/get-owner";import { later, run } from "@ember/runloop";+import { moduleFor, setupApplicationTest } from "ember-qunit";import HeaderComponent from "discourse/components/site-header";import { Promise } from "rsvp";import Site from "discourse/models/site";@@ -20,11 +22,9 @@ import { clearHTMLCache } from "discourse/helpers/custom-html";import createStore from "discourse/tests/helpers/create-store";import deprecated from "discourse-common/lib/deprecated";import { flushMap } from "discourse/models/store";-import { getApplication } from "@ember/test-helpers";import { initSearchData } from "discourse/widgets/search-menu";import { isEmpty } from "@ember/utils";import { mapRoutes } from "discourse/mapping-router";-import { moduleFor } from "ember-qunit";import { resetCustomPostMessageCallbacks } from "discourse/controllers/topic";import { resetDecorators } from "discourse/widgets/widget";import { resetCache as resetOneboxCache } from "pretty-text/oneboxer";@@ -38,6 +38,8 @@ import { setTopicList } from "discourse/lib/topic-list-tracker";import sinon from "sinon";import siteFixtures from "discourse/tests/fixtures/site-fixtures";+const LEGACY_ENV = !setupApplicationTest;+export function currentUser() {return User.create(sessionFixtures["/session/current.json"].current_user);}@@ -112,6 +114,18 @@ export function discourseModule(name, options) {this.siteSettings = currentSettings();});+ this.getController = function (controllerName, properties) {+ let controller = this.container.lookup(`controller:${controllerName}`);+ if (!LEGACY_ENV) {+ controller.application = {};+ }+ controller.siteSettings = this.siteSettings;+ if (properties) {+ controller.setProperties(properties);+ }+ return controller;+ };+this.moduleName = name;options.call(this, hooks);@@ -201,16 +215,22 @@ export function acceptance(name, optionsOrCallback) {resetSite(currentSettings(), siteChanges);}- getApplication().__registeredObjects__ = false;- getApplication().reset();+ if (LEGACY_ENV) {+ getApplication().__registeredObjects__ = false;+ getApplication().reset();+ }this.container = getOwner(this);- if (loggedIn) {+ if (LEGACY_ENV && loggedIn) {updateCurrentUser({appEvents: this.container.lookup("service:app-events"),});}+setURLContainer(this.container);setDefaultOwner(this.container);+ if (!this.owner) {+ this.owner = this.container;+ }if (options.beforeEach) {options.beforeEach.call(this);@@ -247,8 +267,11 @@ export function acceptance(name, optionsOrCallback) {initializer.teardown(this.container);}});- app.__registeredObjects__ = false;- app.reset();++ if (LEGACY_ENV) {+ app.__registeredObjects__ = false;+ app.reset();+ }// We do this after reset so that the willClearRender will have already firedresetWidgetCleanCallbacks();@@ -290,10 +313,23 @@ export function acceptance(name, optionsOrCallback) {if (callback) {// New, preferred waymodule(name, function (hooks) {+ needs.hooks = hooks;hooks.beforeEach(setup.beforeEach);hooks.afterEach(setup.afterEach);- needs.hooks = hooks;callback(needs);++ if (!LEGACY_ENV && getContext) {+ setupApplicationTest(hooks);++ hooks.beforeEach(function () {+ // This hack seems necessary to allow `DiscourseURL` to use the testing router+ let ctx = getContext();+ this.container.registry.unregister("router:main");+ this.container.registry.register("router:main", ctx.owner.router, {+ instantiate: false,+ });+ });+ }});} else {// Old way@@ -371,8 +407,9 @@ export async function selectDate(selector, date) {});}-export function queryAll() {- return window.find(...arguments);+export function queryAll(selector, context) {+ context = context || "#ember-testing";+ return $(selector, context);}export function query() {diff --git a/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js b/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.jsindex 5058dd9e1aa..87cb47cdda9 100644--- a/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js+++ b/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js@@ -1,4 +1,4 @@-import { click, fillIn } from "@ember/test-helpers";+import { click, fillIn, triggerEvent } from "@ember/test-helpers";import { exists, queryAll } from "discourse/tests/helpers/qunit-helpers";import { isEmpty } from "@ember/utils";import { moduleForComponent } from "ember-qunit";@@ -57,7 +57,7 @@ async function selectKitSelectNoneRow(selector) {async function selectKitSelectRowByIndex(index, selector) {checkSelectKitIsNotCollapsed(selector);- await click(queryAll(`${selector} .select-kit-row`).eq(index));+ await click(queryAll(`${selector} .select-kit-row`)[index]);}async function keyboardHelper(value, target, selector) {@@ -80,7 +80,7 @@ async function keyboardHelper(value, target, selector) {};await triggerEvent(- target,+ target[0],"keydown",mapping[value] || { keyCode: value.charCodeAt(0) });@@ -286,7 +286,7 @@ export default function selectKit(selector) {await click(queryAll(selector).find(".select-kit-header")- .find(`[data-value="${value}"]`)+ .find(`[data-value="${value}"]`)[0]);},diff --git a/app/assets/javascripts/discourse/tests/index.html b/app/assets/javascripts/discourse/tests/index.htmlnew file mode 100644index 00000000000..526fa4bef6a--- /dev/null+++ b/app/assets/javascripts/discourse/tests/index.html@@ -0,0 +1,47 @@+<!DOCTYPE html>+<html>+ <head>+ <meta charset="utf-8">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ <title>Discourse Tests</title>+ <meta name="description" content="">+ <meta name="viewport" content="width=device-width, initial-scale=1">+ <meta property="og:title" content="Discourse Tests">+ <meta property="og:url" content="{{rootURL}}">++ {{content-for "head"}}+ {{content-for "test-head"}}++ <link rel="stylesheet" href="{{rootURL}}assets/vendor.css">+ <link rel="stylesheet" href="{{rootURL}}assets/test-support.css">++ {{content-for "head-footer"}}+ {{content-for "test-head-footer"}}++ <style>+ #ember-testing * {+ -webkit-transition: none !important;+ -moz-transition: none !important;+ -o-transition: none !important;+ transition: none !important;+ }+ </style>++ </head>+ <body>+ {{content-for "body"}}+ {{content-for "test-body"}}++ <script src="/testem.js" integrity=""></script>+ <script src="{{rootURL}}assets/vendor.js"></script>+ <script src="{{rootURL}}assets/test-support.js"></script>+ <script src="{{rootURL}}assets/discourse.js"></script>+ <script src="{{rootURL}}assets/discourse-markdown.js"></script>+ <script src="{{rootURL}}assets/admin.js"></script>+ <script src="{{rootURL}}assets/tests.js"></script>+ <script src="{{rootURL}}assets/scripts/discourse-boot.js"></script>++ {{content-for "body-footer"}}+ {{content-for "test-body-footer"}}+ </body>+</html>diff --git a/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.jsindex e711a2b2799..30105cf388f 100644--- a/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js@@ -5,13 +5,14 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | ace-editor", function (hooks) {setupRenderingTest(hooks);componentTest("css editor", {skip: true,- template: '{{ace-editor mode="css"}}',+ template: hbs`{{ace-editor mode="css"}}`,test(assert) {assert.expect(1);assert.ok(queryAll(".ace_editor").length, "it renders the ace editor");@@ -20,7 +21,7 @@ discourseModule("Integration | Component | ace-editor", function (hooks) {componentTest("html editor", {skip: true,- template: '{{ace-editor mode="html" content="<b>wat</b>"}}',+ template: hbs`{{ace-editor mode="html" content="<b>wat</b>"}}`,test(assert) {assert.expect(1);assert.ok(queryAll(".ace_editor").length, "it renders the ace editor");@@ -29,7 +30,7 @@ discourseModule("Integration | Component | ace-editor", function (hooks) {componentTest("sql editor", {skip: true,- template: '{{ace-editor mode="sql" content="SELECT * FROM users"}}',+ template: hbs`{{ace-editor mode="sql" content="SELECT * FROM users"}}`,test(assert) {assert.expect(1);assert.ok(queryAll(".ace_editor").length, "it renders the ace editor");@@ -38,8 +39,9 @@ discourseModule("Integration | Component | ace-editor", function (hooks) {componentTest("disabled editor", {skip: true,- template:- '{{ace-editor mode="sql" content="SELECT * FROM users" disabled=true}}',+ template: hbs`+ {{ace-editor mode="sql" content="SELECT * FROM users" disabled=true}}+ `,test(assert) {const $ace = queryAll(".ace_editor");assert.expect(3);diff --git a/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.js b/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.jsindex b97c72aecdc..f8a1668a102 100644--- a/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | activation-controls",@@ -12,7 +13,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("hides change email button", {- template: `{{activation-controls}}`,+ template: hbs`{{activation-controls}}`,beforeEach() {this.siteSettings.enable_local_logins = false;this.siteSettings.email_editable = false;diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.jsindex fdc398de9ae..284f5dcd5c0 100644--- a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js@@ -7,13 +7,14 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";import pretender from "discourse/tests/helpers/create-pretender";discourseModule("Integration | Component | admin-report", function (hooks) {setupRenderingTest(hooks);componentTest("default", {- template: "{{admin-report dataSourceName='signups'}}",+ template: hbs`{{admin-report dataSourceName='signups'}}`,async test(assert) {assert.ok(exists(".admin-report.signups"));@@ -79,7 +80,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});componentTest("options", {- template: "{{admin-report dataSourceName='signups' reportOptions=options}}",+ template: hbs`{{admin-report dataSourceName='signups' reportOptions=options}}`,beforeEach() {this.set("options", {@@ -103,7 +104,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});componentTest("switch modes", {- template: "{{admin-report dataSourceName='signups' showFilteringUI=true}}",+ template: hbs`{{admin-report dataSourceName='signups' showFilteringUI=true}}`,async test(assert) {await click(".mode-btn.chart");@@ -114,7 +115,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});componentTest("timeout", {- template: "{{admin-report dataSourceName='signups_timeout'}}",+ template: hbs`{{admin-report dataSourceName='signups_timeout'}}`,test(assert) {assert.ok(exists(".alert-error.timeout"), "it displays a timeout error");@@ -122,7 +123,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});componentTest("no data", {- template: "{{admin-report dataSourceName='posts'}}",+ template: hbs`{{admin-report dataSourceName='posts'}}`,test(assert) {assert.ok(exists(".no-data"), "it displays a no data alert");@@ -130,7 +131,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});componentTest("exception", {- template: "{{admin-report dataSourceName='signups_exception'}}",+ template: hbs`{{admin-report dataSourceName='signups_exception'}}`,test(assert) {assert.ok(exists(".alert-error.exception"), "it displays an error");@@ -154,7 +155,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});},- template: "{{admin-report dataSourceName='signups_rate_limited'}}",+ template: hbs`{{admin-report dataSourceName='signups_rate_limited'}}`,test(assert) {assert.ok(@@ -165,7 +166,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) {});componentTest("not found", {- template: "{{admin-report dataSourceName='not_found'}}",+ template: hbs`{{admin-report dataSourceName='not_found'}}`,test(assert) {assert.ok(diff --git a/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js b/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.jsindex a2ffe1ab182..64317f85ed0 100644--- a/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js@@ -4,6 +4,7 @@ import componentTest, {import EmberObject from "@ember/object";import { click } from "@ember/test-helpers";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import pretender from "discourse/tests/helpers/create-pretender";import selectKit from "discourse/tests/helpers/select-kit-helper";@@ -11,8 +12,9 @@ discourseModule("Integration | Component | badge-title", function (hooks) {setupRenderingTest(hooks);componentTest("badge title", {- template:- "{{badge-title selectableUserBadges=selectableUserBadges user=user}}",+ template: hbs`+ {{badge-title selectableUserBadges=selectableUserBadges user=user}}+ `,beforeEach() {this.set("subject", selectKit());diff --git a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.jsindex c349bcac79d..05e87b82361 100644--- a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import pretender from "discourse/tests/helpers/create-pretender";import { resetCache } from "pretty-text/upload-short-url";@@ -12,7 +13,7 @@ discourseModule("Integration | Component | cook-text", function (hooks) {setupRenderingTest(hooks);componentTest("renders markdown", {- template: '{{cook-text "_foo_" class="post-body"}}',+ template: hbs`{{cook-text "_foo_" class="post-body"}}`,test(assert) {const html = queryAll(".post-body")[0].innerHTML.trim();@@ -21,7 +22,7 @@ discourseModule("Integration | Component | cook-text", function (hooks) {});componentTest("resolves short URLs", {- template: `{{cook-text "" class="post-body"}}`,+ template: hbs`{{cook-text "" class="post-body"}}`,beforeEach() {pretender.post("/uploads/lookup-urls", () => {diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.jsindex 3341ecc19e5..668b608b929 100644--- a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js@@ -7,12 +7,13 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import I18n from "I18n";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | d-button", function (hooks) {setupRenderingTest(hooks);componentTest("icon only button", {- template: '{{d-button icon="plus" tabindex="3"}}',+ template: hbs`{{d-button icon="plus" tabindex="3"}}`,test(assert) {assert.ok(@@ -32,7 +33,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("icon and text button", {- template: '{{d-button icon="plus" label="topic.create"}}',+ template: hbs`{{d-button icon="plus" label="topic.create"}}`,test(assert) {assert.ok(@@ -51,7 +52,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("text only button", {- template: '{{d-button label="topic.create"}}',+ template: hbs`{{d-button label="topic.create"}}`,test(assert) {assert.ok(@@ -66,7 +67,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("form attribute", {- template: '{{d-button form="login-form"}}',+ template: hbs`{{d-button form="login-form"}}`,test(assert) {assert.ok(exists("button[form=login-form]"), "it has the form attribute");@@ -74,7 +75,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("link-styled button", {- template: '{{d-button display="link"}}',+ template: hbs`{{d-button display="link"}}`,test(assert) {assert.ok(@@ -85,7 +86,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("isLoading button", {- template: "{{d-button isLoading=isLoading}}",+ template: hbs`{{d-button isLoading=isLoading}}`,beforeEach() {this.set("isLoading", true);@@ -115,7 +116,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("disabled button", {- template: "{{d-button disabled=disabled}}",+ template: hbs`{{d-button disabled=disabled}}`,beforeEach() {this.set("disabled", true);@@ -134,8 +135,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("aria-label", {- template:- "{{d-button ariaLabel=ariaLabel translatedAriaLabel=translatedAriaLabel}}",+ template: hbs`{{d-button ariaLabel=ariaLabel translatedAriaLabel=translatedAriaLabel}}`,beforeEach() {I18n.translations[I18n.locale].js.test = { fooAriaLabel: "foo" };@@ -159,7 +159,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("title", {- template: "{{d-button title=title translatedTitle=translatedTitle}}",+ template: hbs`{{d-button title=title translatedTitle=translatedTitle}}`,beforeEach() {I18n.translations[I18n.locale].js.test = { fooTitle: "foo" };@@ -182,7 +182,7 @@ discourseModule("Integration | Component | d-button", function (hooks) {});componentTest("label", {- template: "{{d-button label=label translatedLabel=translatedLabel}}",+ template: hbs`{{d-button label=label translatedLabel=translatedLabel}}`,beforeEach() {I18n.translations[I18n.locale].js.test = { fooLabel: "foo" };diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.jsindex c6408ba2aab..1f82ba0e164 100644--- a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js@@ -13,6 +13,7 @@ import {import I18n from "I18n";import { clearToolbarCallbacks } from "discourse/components/d-editor";import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper";+import hbs from "htmlbars-inline-precompile";import { next } from "@ember/runloop";import { withPluginApi } from "discourse/lib/plugin-api";@@ -20,7 +21,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {setupRenderingTest(hooks);componentTest("preview updates with markdown", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,async test(assert) {assert.ok(queryAll(".d-editor-button-bar").length);@@ -35,7 +36,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {});componentTest("preview sanitizes HTML", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,async test(assert) {await fillIn(".d-editor-input", `"><svg onload="prompt(/xss/)"></svg>`);@@ -44,7 +45,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {});componentTest("updating the value refreshes the preview", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.set("value", "evil trout");@@ -72,7 +73,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {function testCase(title, testFunc) {componentTest(title, {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.set("value", "hello world.");},@@ -85,7 +86,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {function composerTestCase(title, testFunc) {componentTest(title, {- template: "{{d-editor value=value composerEvents=true}}",+ template: hbs`{{d-editor value=value composerEvents=true}}`,beforeEach() {this.set("value", "hello world.");},@@ -217,7 +218,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {);componentTest("advanced code", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.siteSettings.code_formatting_style = "4-spaces-indent";this.set(@@ -252,7 +253,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) {});componentTest("code button", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.siteSettings.code_formatting_style = "4-spaces-indent";},@@ -337,7 +338,7 @@ third line`});componentTest("code fences", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.set("value", "");},@@ -450,7 +451,7 @@ third line`});componentTest("quote button - empty lines", {- template: "{{d-editor value=value composerEvents=true}}",+ template: hbs`{{d-editor value=value composerEvents=true}}`,beforeEach() {this.set("value", "one\n\ntwo\n\nthree");},@@ -471,7 +472,7 @@ third line`});componentTest("quote button - selecting empty lines", {- template: "{{d-editor value=value composerEvents=true}}",+ template: hbs`{{d-editor value=value composerEvents=true}}`,beforeEach() {this.set("value", "one\n\n\n\ntwo");},@@ -605,7 +606,7 @@ third line`});componentTest("clicking the toggle-direction changes dir from ltr to rtl", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.siteSettings.support_mixed_text_direction = true;this.siteSettings.default_locale = "en";@@ -619,7 +620,7 @@ third line`});componentTest("clicking the toggle-direction changes dir from ltr to rtl", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {this.siteSettings.support_mixed_text_direction = true;this.siteSettings.default_locale = "en";@@ -652,7 +653,7 @@ third line`);componentTest("emoji", {- template: "{{d-editor value=value}}",+ template: hbs`{{d-editor value=value}}`,beforeEach() {// Test adding a custom buttonwithPluginApi("0.1", (api) => {@@ -710,7 +711,7 @@ third line`}componentTest("paste table", {- template: "{{d-editor value=value composerEvents=true}}",+ template: hbs`{{d-editor value=value composerEvents=true}}`,beforeEach() {this.set("value", "");this.siteSettings.enable_rich_text_paste = true;diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.jsindex 8a6c97e0054..319157d629d 100644--- a/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js@@ -5,12 +5,13 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | d-icon", function (hooks) {setupRenderingTest(hooks);componentTest("default", {- template: '<div class="test">{{d-icon "bars"}}</div>',+ template: hbs`<div class="test">{{d-icon "bars"}}</div>`,test(assert) {const html = queryAll(".test").html().trim();@@ -22,7 +23,7 @@ discourseModule("Integration | Component | d-icon", function (hooks) {});componentTest("with replacement", {- template: '<div class="test">{{d-icon "d-watching"}}</div>',+ template: hbs`<div class="test">{{d-icon "d-watching"}}</div>`,test(assert) {const html = queryAll(".test").html().trim();diff --git a/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/date-input-test.jsindex 22dd41ac425..07ba1ad35be 100644--- a/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js@@ -6,9 +6,10 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";function dateInput() {- return queryAll(".date-picker");+ return queryAll(".date-picker")[0];}function setDate(date) {@@ -29,19 +30,19 @@ discourseModule("Integration | Component | date-input", function (hooks) {setupRenderingTest(hooks);componentTest("default", {- template: `{{date-input date=date}}`,+ template: hbs`{{date-input date=date}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE });},test(assert) {- assert.equal(dateInput().val(), "January 29, 2019");+ assert.equal(dateInput().value, "January 29, 2019");},});componentTest("prevents mutations", {- template: `{{date-input date=date onChange=onChange}}`,+ template: hbs`{{date-input date=date onChange=onChange}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE });@@ -57,7 +58,7 @@ discourseModule("Integration | Component | date-input", function (hooks) {});componentTest("allows mutations through actions", {- template: `{{date-input date=date onChange=onChange}}`,+ template: hbs`{{date-input date=date onChange=onChange}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE });diff --git a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.jsindex f7b2ca1af94..e3070886f74 100644--- a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";function fromDateInput() {return queryAll(".from.d-date-time-input .date-picker")[0];@@ -30,7 +31,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("default", {- template: `{{date-time-input-range from=from to=to}}`,+ template: hbs`{{date-time-input-range from=from to=to}}`,beforeEach() {this.setProperties({ from: DEFAULT_DATE_TIME, to: null });diff --git a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.jsindex a660917a36f..19796313d99 100644--- a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js@@ -7,6 +7,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";function dateInput() {return queryAll(".date-picker")[0];@@ -32,7 +33,7 @@ discourseModule("Integration | Component | date-time-input", function (hooks) {setupRenderingTest(hooks);componentTest("default", {- template: `{{date-time-input date=date}}`,+ template: hbs`{{date-time-input date=date}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE_TIME });@@ -45,7 +46,7 @@ discourseModule("Integration | Component | date-time-input", function (hooks) {});componentTest("prevents mutations", {- template: `{{date-time-input date=date}}`,+ template: hbs`{{date-time-input date=date}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE_TIME });@@ -60,7 +61,7 @@ discourseModule("Integration | Component | date-time-input", function (hooks) {});componentTest("allows mutations through actions", {- template: `{{date-time-input date=date onChange=onChange}}`,+ template: hbs`{{date-time-input date=date onChange=onChange}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE_TIME });@@ -76,7 +77,7 @@ discourseModule("Integration | Component | date-time-input", function (hooks) {});componentTest("can hide time", {- template: `{{date-time-input date=date showTime=false}}`,+ template: hbs`{{date-time-input date=date showTime=false}}`,beforeEach() {this.setProperties({ date: DEFAULT_DATE_TIME });diff --git a/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js b/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.jsindex 85aed0811fc..83882694eb4 100644--- a/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";const LONG_CODE_BLOCK = "puts a\n".repeat(15000);@@ -12,7 +13,7 @@ discourseModule("Integration | Component | highlighted-code", function (hooks) {setupRenderingTest(hooks);componentTest("highlighting code", {- template: "{{highlighted-code lang='ruby' code=code}}",+ template: hbs`{{highlighted-code lang='ruby' code=code}}`,beforeEach() {this.session.highlightJsPath =@@ -29,7 +30,7 @@ discourseModule("Integration | Component | highlighted-code", function (hooks) {});componentTest("large code blocks are not highlighted", {- template: "{{highlighted-code lang='ruby' code=code}}",+ template: hbs`{{highlighted-code lang='ruby' code=code}}`,beforeEach() {this.session.highlightJsPath =diff --git a/app/assets/javascripts/discourse/tests/integration/components/html-safe-helper-test.js b/app/assets/javascripts/discourse/tests/integration/components/html-safe-helper-test.jsindex eda366d2953..2c99c132791 100644--- a/app/assets/javascripts/discourse/tests/integration/components/html-safe-helper-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/html-safe-helper-test.js@@ -2,12 +2,13 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | html-safe-helper", function (hooks) {setupRenderingTest(hooks);componentTest("default", {- template: "{{html-safe string}}",+ template: hbs`{{html-safe string}}`,beforeEach() {this.set("string", "<p class='cookies'>biscuits</p>");diff --git a/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js b/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.jsindex c9312f99bc6..f829c61f5e1 100644--- a/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js@@ -5,12 +5,13 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | iframed-html", function (hooks) {setupRenderingTest(hooks);componentTest("appends the html into the iframe", {- template: `{{iframed-html html="<h1 id='find-me'>hello</h1>" className='this-is-an-iframe'}}`,+ template: hbs`{{iframed-html html="<h1 id='find-me'>hello</h1>" className='this-is-an-iframe'}}`,async test(assert) {const iframe = queryAll("iframe.this-is-an-iframe");diff --git a/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js b/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.jsindex b100fb4b851..61af90d0fd8 100644--- a/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js@@ -6,13 +6,15 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | image-uploader", function (hooks) {setupRenderingTest(hooks);componentTest("with image", {- template:- "{{image-uploader imageUrl='/images/avatar.png' placeholderUrl='/not/used.png'}}",+ template: hbs`+ {{image-uploader imageUrl='/images/avatar.png' placeholderUrl='/not/used.png'}}+ `,async test(assert) {assert.equal(@@ -44,7 +46,7 @@ discourseModule("Integration | Component | image-uploader", function (hooks) {});componentTest("without image", {- template: "{{image-uploader}}",+ template: hbs`{{image-uploader}}`,test(assert) {assert.equal(@@ -68,7 +70,7 @@ discourseModule("Integration | Component | image-uploader", function (hooks) {});componentTest("with placeholder", {- template: "{{image-uploader placeholderUrl='/images/avatar.png'}}",+ template: hbs`{{image-uploader placeholderUrl='/images/avatar.png'}}`,test(assert) {assert.equal(diff --git a/app/assets/javascripts/discourse/tests/integration/components/load-more-test.js b/app/assets/javascripts/discourse/tests/integration/components/load-more-test.jsindex cdfc720f8ef..9ff074d046b 100644--- a/app/assets/javascripts/discourse/tests/integration/components/load-more-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/load-more-test.js@@ -3,15 +3,17 @@ import componentTest, {} from "discourse/tests/helpers/component-test";import { configureEyeline } from "discourse/lib/eyeline";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | load-more", function (hooks) {setupRenderingTest(hooks);componentTest("updates once after initialization", {- template: `+ template: hbs`{{#load-more selector=".numbers tr" action=loadMore}}<table class="numbers"><tr></tr></table>- {{/load-more}}`,+ {{/load-more}}+ `,beforeEach() {this.set("loadMore", () => this.set("loadedMore", true));diff --git a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.jsindex bc3bc78a74a..6e5fb866e30 100644--- a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js@@ -7,6 +7,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import I18n from "I18n";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | secret-value-list",@@ -14,7 +15,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("adding a value", {- template: "{{secret-value-list values=values}}",+ template: hbs`{{secret-value-list values=values}}`,async test(assert) {this.set("values", "firstKey|FirstValue\nsecondKey|secondValue");@@ -54,7 +55,7 @@ discourseModule(});componentTest("adding an invalid value", {- template: "{{secret-value-list values=values}}",+ template: hbs`{{secret-value-list values=values}}`,async test(assert) {await fillIn(".new-value-input.key", "someString");@@ -83,7 +84,7 @@ discourseModule(});componentTest("removing a value", {- template: "{{secret-value-list values=values}}",+ template: hbs`{{secret-value-list values=values}}`,async test(assert) {this.set("values", "firstKey|FirstValue\nsecondKey|secondValue");diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.jsindex e352e97fee1..d8c99d06b67 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js@@ -10,6 +10,7 @@ import selectKit, {setDefaultState,} from "discourse/tests/helpers/select-kit-helper";import { clearCallbacks } from "select-kit/mixins/plugin-api";+import hbs from "htmlbars-inline-precompile";import { withPluginApi } from "discourse/lib/plugin-api";discourseModule("Integration | Component | select-kit:api", function (hooks) {@@ -28,7 +29,7 @@ discourseModule("Integration | Component | select-kit:api", function (hooks) {});componentTest("modifySelectKit(identifier).appendContent", {- template: `+ template: hbs`{{combo-box value=value content=content onChange=onChange}}{{single-select value=value content=content onChange=onChange}}`,@@ -63,7 +64,7 @@ discourseModule("Integration | Component | select-kit:api", function (hooks) {});componentTest("modifySelectKit(identifier).prependContent", {- template: `+ template: hbs`{{combo-box value=value content=content onChange=onChange}}{{single-select value=value content=content onChange=onChange}}`,@@ -98,7 +99,7 @@ discourseModule("Integration | Component | select-kit:api", function (hooks) {});componentTest("modifySelectKit(identifier).onChange", {- template: `+ template: hbs`<div id="test"></div>{{combo-box value=value content=content onChange=onChange}}`,diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.jsindex 080838a6568..c695a350b58 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js@@ -4,19 +4,9 @@ import componentTest, {import I18n from "I18n";import createStore from "discourse/tests/helpers/create-store";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";-function template(options = []) {- return `- {{category-chooser- value=value- options=(hash- ${options.join("\n")}- )- }}- `;-}-discourseModule("Integration | Component | select-kit/category-chooser",function (hooks) {@@ -27,7 +17,11 @@ discourseModule(});componentTest("with value", {- template: template(),+ template: hbs`+ {{category-chooser+ value=value+ }}+ `,beforeEach() {this.set("value", 2);@@ -40,7 +34,15 @@ discourseModule(});componentTest("with excludeCategoryId", {- template: template(["excludeCategoryId=2"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ excludeCategoryId=2+ )+ }}+ `,+async test(assert) {await this.subject.expand();@@ -49,7 +51,14 @@ discourseModule(});componentTest("with scopedCategoryId", {- template: template(["scopedCategoryId=2"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ scopedCategoryId=2+ )+ }}+ `,async test(assert) {await this.subject.expand();@@ -81,7 +90,14 @@ discourseModule(});componentTest("with allowUncategorized=null", {- template: template(["allowUncategorized=null"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ allowUncategorized=null+ )+ }}+ `,beforeEach() {this.siteSettings.allow_uncategorized_topics = false;@@ -94,7 +110,15 @@ discourseModule(});componentTest("with allowUncategorized=null rootNone=true", {- template: template(["allowUncategorized=null", "none=true"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ allowUncategorized=null+ none=true+ )+ }}+ `,beforeEach() {this.siteSettings.allow_uncategorized_topics = false;@@ -107,7 +131,15 @@ discourseModule(});componentTest("with disallowed uncategorized, none", {- template: template(["allowUncategorized=null", "none='test.root'"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ allowUncategorized=null+ none="test.root"+ )+ }}+ `,beforeEach() {I18n.translations[I18n.locale].js.test = { root: "root none label" };@@ -121,7 +153,14 @@ discourseModule(});componentTest("with allowed uncategorized", {- template: template(["allowUncategorized=true"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ allowUncategorized=true+ )+ }}+ `,beforeEach() {this.siteSettings.allow_uncategorized_topics = true;@@ -134,7 +173,15 @@ discourseModule(});componentTest("with allowed uncategorized and none=true", {- template: template(["allowUncategorized=true", "none=true"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ allowUncategorized=true+ none=true+ )+ }}+ `,beforeEach() {this.siteSettings.allow_uncategorized_topics = true;@@ -147,7 +194,15 @@ discourseModule(});componentTest("with allowed uncategorized and none", {- template: template(["allowUncategorized=true", "none='test.root'"]),+ template: hbs`+ {{category-chooser+ value=value+ options=(hash+ allowUncategorized=true+ none="test.root"+ )+ }}+ `,beforeEach() {I18n.translations[I18n.locale].js.test = { root: "root none label" };@@ -161,7 +216,11 @@ discourseModule(});componentTest("filter is case insensitive", {- template: template(),+ template: hbs`+ {{category-chooser+ value=value+ }}+ `,async test(assert) {await this.subject.expand();@@ -179,11 +238,11 @@ discourseModule(});componentTest("filter works with non english characters", {- template: `- {{category-chooser- value=value- }}- `,+ template: hbs`+ {{category-chooser+ value=value+ }}+ `,beforeEach() {const store = createStore();@@ -203,12 +262,12 @@ discourseModule(});componentTest("decodes entities in row title", {- template: `- {{category-chooser- value=value- options=(hash scopedCategoryId=1)- }}- `,+ template: hbs`+ {{category-chooser+ value=value+ options=(hash scopedCategoryId=1)+ }}+ `,beforeEach() {const store = createStore();diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.jsindex b3611c36701..c72b67f9720 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js@@ -9,6 +9,7 @@ import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";import Category from "discourse/models/category";import DiscourseURL from "discourse/lib/url";import I18n from "I18n";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";import { set } from "@ember/object";import sinon from "sinon";@@ -34,19 +35,6 @@ function initCategoriesWithParentCategory(context) {});}-function template(options = []) {- return `- {{category-drop- category=category- categories=categories- parentCategory=parentCategory- options=(hash- ${options.join("\n")}- )- }}- `;-}-discourseModule("Integration | Component | select-kit/category-drop",function (hooks) {@@ -57,7 +45,7 @@ discourseModule(});componentTest("caretUpIcon", {- template: `+ template: hbs`{{category-dropcategory=valuecategories=content@@ -75,7 +63,7 @@ discourseModule(});componentTest("none", {- template: `+ template: hbs`{{category-dropcategory=valuecategories=content@@ -93,7 +81,13 @@ discourseModule(});componentTest("[not staff - TL0] displayCategoryDescription", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {set(this.currentUser, "staff", false);@@ -114,7 +108,13 @@ discourseModule(});componentTest("[not staff - TL1] displayCategoryDescription", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {set(this.currentUser, "moderator", false);@@ -135,7 +135,13 @@ discourseModule(});componentTest("[staff - TL0] displayCategoryDescription", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {set(this.currentUser, "moderator", true);@@ -156,7 +162,13 @@ discourseModule(});componentTest("hideParentCategory (default: false)", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {initCategories(this);@@ -172,7 +184,16 @@ discourseModule(});componentTest("hideParentCategory (true)", {- template: template(["hideParentCategory=true"]),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ options=(hash+ hideParentCategory=true+ )+ }}+ `,beforeEach() {initCategoriesWithParentCategory(this);@@ -195,7 +216,13 @@ discourseModule(});componentTest("allow_uncategorized_topics (true)", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {this.siteSettings.allow_uncategorized_topics = true;@@ -212,7 +239,13 @@ discourseModule(});componentTest("allow_uncategorized_topics (false)", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {this.siteSettings.allow_uncategorized_topics = false;@@ -229,7 +262,13 @@ discourseModule(});componentTest("countSubcategories (default: false)", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {initCategories(this);@@ -251,7 +290,16 @@ discourseModule(});componentTest("countSubcategories (true)", {- template: template(["countSubcategories=true"]),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ options=(hash+ countSubcategories=true+ )+ }}+ `,beforeEach() {initCategories(this);@@ -273,7 +321,13 @@ discourseModule(});componentTest("shortcuts:default", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {initCategories(this);@@ -292,7 +346,13 @@ discourseModule(});componentTest("shortcuts:category is set", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {initCategories(this);@@ -306,7 +366,16 @@ discourseModule(});componentTest("shortcuts with parentCategory/subCategory=true:default", {- template: template(["subCategory=true"]),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ options=(hash+ subCategory=true+ )+ }}+ `,beforeEach() {initCategoriesWithParentCategory(this);@@ -322,7 +391,16 @@ discourseModule(componentTest("shortcuts with parentCategory/subCategory=true:category is selected",{- template: template(["subCategory=true"]),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ options=(hash+ subCategory=true+ )+ }}+ `,beforeEach() {initCategoriesWithParentCategory(this);@@ -339,7 +417,13 @@ discourseModule();componentTest("category url", {- template: template(),+ template: hbs`+ {{category-drop+ category=category+ categories=categories+ parentCategory=parentCategory+ }}+ `,beforeEach() {initCategoriesWithParentCategory(this);diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.jsindex 67176a1818a..8b68b09a1c3 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js@@ -3,6 +3,7 @@ import componentTest, {} from "discourse/tests/helpers/component-test";import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";const DEFAULT_CONTENT = [@@ -34,7 +35,7 @@ discourseModule(});componentTest("options.clearable", {- template: `+ template: hbs`{{combo-boxvalue=valuecontent=content@@ -61,7 +62,7 @@ discourseModule();assert.equal($header.value(), DEFAULT_VALUE);- await click($header.el().find(".btn-clear"));+ await click($header.el().find(".btn-clear")[0]);assert.notOk(exists($header.el().find(".btn-clear")),@@ -72,7 +73,7 @@ discourseModule(});componentTest("options.{caretUpIcon,caretDownIcon}", {- template: `+ template: hbs`{{combo-boxvalue=valuecontent=contentdiff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.jsindex b7e8247b27f..e2e2129a154 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js@@ -2,6 +2,7 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";const DEFAULT_CONTENT = [@@ -36,7 +37,7 @@ discourseModule(});componentTest("selection behavior", {- template: `+ template: hbs`{{dropdown-select-boxvalue=valuecontent=content@@ -60,7 +61,7 @@ discourseModule(});componentTest("options.showFullTitle=false", {- template: `+ template: hbs`{{dropdown-select-boxvalue=valuecontent=content@@ -95,7 +96,7 @@ discourseModule(});componentTest("options.showFullTitle=true", {- template: `+ template: hbs`{{dropdown-select-boxvalue=valuecontent=contentdiff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.jsindex 0999e83e381..adda7e2fc55 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js@@ -2,20 +2,9 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";-function template(options = []) {- return `- {{list-setting- value=value- choices=choices- options=(hash- ${options.join("\n")}- )- }}- `;-}-discourseModule("Integration | Component | select-kit/list-setting",function (hooks) {@@ -26,7 +15,12 @@ discourseModule(});componentTest("default", {- template: template(),+ template: hbs`+ {{list-setting+ value=value+ choices=choices+ }}+ `,beforeEach() {this.set("value", ["bold", "italic"]);diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.jsindex 9eb3fb1574f..012e8ed3aa9 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js@@ -6,6 +6,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import I18n from "I18n";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";discourseModule(@@ -18,7 +19,7 @@ discourseModule(});componentTest("displays tags", {- template: `{{mini-tag-chooser value=value}}`,+ template: hbs`{{mini-tag-chooser value=value}}`,beforeEach() {this.set("value", ["foo", "bar"]);@@ -30,7 +31,7 @@ discourseModule(});componentTest("create a tag", {- template: `{{mini-tag-chooser value=value}}`,+ template: hbs`{{mini-tag-chooser value=value}}`,beforeEach() {this.set("value", ["foo", "bar"]);@@ -51,7 +52,7 @@ discourseModule(});componentTest("max_tags_per_topic", {- template: `{{mini-tag-chooser value=value}}`,+ template: hbs`{{mini-tag-chooser value=value}}`,beforeEach() {this.set("value", ["foo", "bar"]);diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.jsindex 38c934338dc..c6939fd3f1a 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js@@ -2,20 +2,9 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";-function template(options = []) {- return `- {{multi-select- value=value- content=content- options=(hash- ${options.join("\n")}- )- }}- `;-}-const DEFAULT_CONTENT = [{ id: 1, name: "foo" },{ id: 2, name: "bar" },@@ -43,7 +32,12 @@ discourseModule(});componentTest("content", {- template: template(),+ template: hbs`+ {{multi-select+ value=value+ content=content+ }}+ `,beforeEach() {setDefaultState(this);diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.jsindex a85589fa0d0..39592a80ba4 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.js@@ -5,6 +5,7 @@ import selectKit, {setDefaultState,} from "discourse/tests/helpers/select-kit-helper";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | select-kit/notifications-button",@@ -16,7 +17,7 @@ discourseModule(});componentTest("default", {- template: `+ template: hbs`{{notifications-buttonvalue=valueoptions=(hashdiff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.jsindex 8ac593a7682..567dfae951a 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js@@ -3,6 +3,7 @@ import componentTest, {} from "discourse/tests/helpers/component-test";import Topic from "discourse/models/topic";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";const buildTopic = function (pinned = true) {@@ -24,7 +25,7 @@ discourseModule(});componentTest("unpinning", {- template: "{{pinned-options value=topic.pinned topic=topic}}",+ template: hbs`{{pinned-options value=topic.pinned topic=topic}}`,beforeEach() {this.siteSettings.automatically_unpin_topics = false;@@ -42,7 +43,7 @@ discourseModule(});componentTest("pinning", {- template: "{{pinned-options value=topic.pinned topic=topic}}",+ template: hbs`{{pinned-options value=topic.pinned topic=topic}}`,beforeEach() {this.siteSettings.automatically_unpin_topics = false;diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.jsindex 8deb9d73d6c..ced1d3deb80 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js@@ -3,23 +3,9 @@ import componentTest, {} from "discourse/tests/helpers/component-test";import I18n from "I18n";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";-function template(options = []) {- return `- {{single-select- value=value- content=content- nameProperty=nameProperty- valueProperty=valueProperty- onChange=onChange- options=(hash- ${options.join("\n")}- )- }}- `;-}-const DEFAULT_CONTENT = [{ id: 1, name: "foo" },{ id: 2, name: "bar" },@@ -54,7 +40,7 @@ discourseModule(});componentTest("content", {- template: "{{single-select content=content}}",+ template: hbs`{{single-select content=content}}`,beforeEach() {setDefaultState(this);@@ -84,7 +70,15 @@ discourseModule(});componentTest("value", {- template: template(),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ }}+ `,beforeEach() {setDefaultState(this);@@ -100,7 +94,18 @@ discourseModule(});componentTest("options.filterable", {- template: template(["filterable=filterable"]),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ options=(hash+ filterable=filterable+ )+ }}+ `,beforeEach() {setDefaultState(this, { filterable: true });@@ -121,10 +126,19 @@ discourseModule(});componentTest("options.limitMatches", {- template: template([- "limitMatches=limitMatches",- "filterable=filterable",- ]),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ options=(hash+ limitMatches=limitMatches+ filterable=filterable+ )+ }}+ `,beforeEach() {setDefaultState(this, { limitMatches: 1, filterable: true });@@ -143,7 +157,7 @@ discourseModule(});componentTest("valueAttribute (deprecated)", {- template: `+ template: hbs`{{single-selectvalue=valuecontent=content@@ -172,7 +186,18 @@ discourseModule(});componentTest("none:string", {- template: template(['none="test.none"']),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ options=(hash+ none="test.none"+ )+ }}+ `,beforeEach() {I18n.translations[I18n.locale].js.test = { none: "(default)" };@@ -189,7 +214,18 @@ discourseModule(});componentTest("none:object", {- template: template(["none=none"]),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ options=(hash+ none=none+ )+ }}+ `,beforeEach() {setDefaultState(this, { none: { value: null, name: "(default)" } });@@ -205,7 +241,18 @@ discourseModule(});componentTest("content is a basic array", {- template: template(['none="test.none"']),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ options=(hash+ none="test.none"+ )+ }}+ `,beforeEach() {I18n.translations[I18n.locale].js.test = { none: "(default)" };@@ -232,7 +279,15 @@ discourseModule(});componentTest("selected value can be 0", {- template: template(),+ template: hbs`+ {{single-select+ value=value+ content=content+ nameProperty=nameProperty+ valueProperty=valueProperty+ onChange=onChange+ }}+ `,beforeEach() {setDefaultState(this, {@@ -255,8 +310,15 @@ discourseModule(});componentTest("prevents propagating click event on header", {- template:- "{{#d-button icon='times' action=onClick}}{{single-select options=(hash preventsClickPropagation=true) value=value content=content}}{{/d-button}}",+ template: hbs`+ {{#d-button icon='times' action=onClick}}+ {{single-select+ options=(hash preventsClickPropagation=true)+ value=value+ content=content+ }}+ {{/d-button}}+ `,beforeEach() {this.setProperties({@@ -274,8 +336,13 @@ discourseModule(});componentTest("labelProperty", {- template:- '{{single-select labelProperty="foo" value=value content=content}}',+ template: hbs`+ {{single-select+ labelProperty="foo"+ value=value+ content=content+ }}+ `,beforeEach() {this.setProperties({@@ -296,8 +363,13 @@ discourseModule(});componentTest("titleProperty", {- template:- '{{single-select titleProperty="foo" value=value content=content}}',+ template: hbs`+ {{single-select+ titleProperty="foo"+ value=value+ content=content+ }}+ `,beforeEach() {this.setProperties({@@ -318,8 +390,7 @@ discourseModule(});componentTest("langProperty", {- template:- '{{single-select langProperty="foo" value=value content=content}}',+ template: hbs`{{single-select langProperty="foo" value=value content=content}}`,beforeEach() {this.setProperties({diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.jsindex 5b6ca63707d..6415f96163c 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js@@ -4,6 +4,7 @@ import componentTest, {import I18n from "I18n";import Site from "discourse/models/site";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import pretender from "discourse/tests/helpers/create-pretender";import selectKit from "discourse/tests/helpers/select-kit-helper";import { set } from "@ember/object";@@ -23,19 +24,6 @@ function initTags(context) {});}-function template(options = []) {- return `- {{tag-drop- firstCategory=firstCategory- secondCategory=secondCategory- tagId=tagId- options=(hash- ${options.join("\n")}- )- }}- `;-}-discourseModule("Integration | Component | select-kit/tag-drop",function (hooks) {@@ -65,7 +53,16 @@ discourseModule(});componentTest("default", {- template: template(["tagId=tagId"]),+ template: hbs`+ {{tag-drop+ firstCategory=firstCategory+ secondCategory=secondCategory+ tagId=tagId+ options=(hash+ tagId=tagId+ )+ }}+ `,beforeEach() {initTags(this);diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.jsindex 3e991248cc2..a939555bf76 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js@@ -4,6 +4,7 @@ import componentTest, {import I18n from "I18n";import Topic from "discourse/models/topic";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";const buildTopic = function (level, archetype = "regular") {@@ -31,8 +32,12 @@ discourseModule(});componentTest("the header has a localized title", {- template:- "{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}",+ template: hbs`+ {{topic-notifications-button+ notificationLevel=topic.details.notification_level+ topic=topic+ }}+ `,beforeEach() {this.set("topic", buildTopic(1));@@ -56,8 +61,12 @@ discourseModule(});componentTest("the header has a localized title", {- template:- "{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}",+ template: hbs`+ {{topic-notifications-button+ notificationLevel=topic.details.notification_level+ topic=topic+ }}+ `,beforeEach() {I18n.translations.en.js.topic.notifications.tracking_pm.title = `${originalTranslation} PM`;diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.jsindex 5be20fc32b2..41be156071a 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js@@ -4,6 +4,7 @@ import componentTest, {import I18n from "I18n";import Topic from "discourse/models/topic";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";const buildTopic = function (archetype) {@@ -38,8 +39,12 @@ discourseModule(setupRenderingTest(hooks);componentTest("regular topic notification level descriptions", {- template:- "{{topic-notifications-options value=topic.details.notification_level topic=topic}}",+ template: hbs`+ {{topic-notifications-options+ value=topic.details.notification_level+ topic=topic+ }}+ `,beforeEach() {this.set("topic", buildTopic("regular"));@@ -67,8 +72,12 @@ discourseModule(});componentTest("PM topic notification level descriptions", {- template:- "{{topic-notifications-options value=topic.details.notification_level topic=topic}}",+ template: hbs`+ {{topic-notifications-options+ value=topic.details.notification_level+ topic=topic+ }}+ `,beforeEach() {this.set("topic", buildTopic("private_message"));diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.jsindex 7066ee74f16..54dee262543 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js@@ -2,6 +2,7 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";discourseModule(@@ -14,7 +15,7 @@ discourseModule(});componentTest("displays usernames", {- template: `{{user-chooser value=value}}`,+ template: hbs`{{user-chooser value=value}}`,beforeEach() {this.set("value", ["bob", "martin"]);@@ -26,7 +27,7 @@ discourseModule(});componentTest("can remove a username", {- template: `{{user-chooser value=value}}`,+ template: hbs`{{user-chooser value=value}}`,beforeEach() {this.set("value", ["bob", "martin"]);diff --git a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.jsindex c0cfb63b69b..1dabaf5c206 100644--- a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js@@ -6,12 +6,13 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | simple-list", function (hooks) {setupRenderingTest(hooks);componentTest("adding a value", {- template: "{{simple-list values=values}}",+ template: hbs`{{simple-list values=values}}`,beforeEach() {this.set("values", "vinkas\nosama");@@ -48,7 +49,7 @@ discourseModule("Integration | Component | simple-list", function (hooks) {});componentTest("removing a value", {- template: "{{simple-list values=values}}",+ template: hbs`{{simple-list values=values}}`,beforeEach() {this.set("values", "vinkas\nosama");@@ -71,7 +72,7 @@ discourseModule("Integration | Component | simple-list", function (hooks) {});componentTest("delimiter support", {- template: "{{simple-list values=values inputDelimiter='|'}}",+ template: hbs`{{simple-list values=values inputDelimiter='|'}}`,beforeEach() {this.set("values", "vinkas|osama");diff --git a/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js b/app/assets/javascripts/discourse/tests/integration/components/site-header-test.jsindex 7f61b95b42e..73eacaf5f5d 100644--- a/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js@@ -6,12 +6,13 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import pretender from "discourse/tests/helpers/create-pretender";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | site-header", function (hooks) {setupRenderingTest(hooks);componentTest("first notification mask", {- template: `{{site-header}}`,+ template: hbs`{{site-header}}`,beforeEach() {this.set("currentUser.unread_high_priority_notifications", 1);@@ -35,7 +36,7 @@ discourseModule("Integration | Component | site-header", function (hooks) {});componentTest("do not call authenticated endpoints as anonymous", {- template: `{{site-header}}`,+ template: hbs`{{site-header}}`,anonymous: true,async test(assert) {diff --git a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.jsindex ab9ba425ab6..91b419be434 100644--- a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js@@ -7,13 +7,14 @@ import {} from "discourse/tests/helpers/qunit-helpers";import I18n from "I18n";import { fillIn } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";import sinon from "sinon";discourseModule("Integration | Component | text-field", function (hooks) {setupRenderingTest(hooks);componentTest("renders correctly with no properties set", {- template: `{{text-field}}`,+ template: hbs`{{text-field}}`,test(assert) {assert.ok(queryAll("input[type=text]").length);@@ -21,7 +22,7 @@ discourseModule("Integration | Component | text-field", function (hooks) {});componentTest("support a placeholder", {- template: `{{text-field placeholderKey="placeholder.i18n.key"}}`,+ template: hbs`{{text-field placeholderKey="placeholder.i18n.key"}}`,beforeEach() {sinon.stub(I18n, "t").returnsArg(0);@@ -37,7 +38,7 @@ discourseModule("Integration | Component | text-field", function (hooks) {});componentTest("sets the dir attribute to ltr for Hebrew text", {- template: `{{text-field value='זהו שם עברי עם מקום עברי'}}`,+ template: hbs`{{text-field value='זהו שם עברי עם מקום עברי'}}`,beforeEach() {this.siteSettings.support_mixed_text_direction = true;},@@ -48,7 +49,7 @@ discourseModule("Integration | Component | text-field", function (hooks) {});componentTest("sets the dir attribute to ltr for English text", {- template: `{{text-field value='This is a ltr title'}}`,+ template: hbs`{{text-field value='This is a ltr title'}}`,beforeEach() {this.siteSettings.support_mixed_text_direction = true;},@@ -59,7 +60,7 @@ discourseModule("Integration | Component | text-field", function (hooks) {});componentTest("supports onChange", {- template: `{{text-field class="tf-test" value=value onChange=changed}}`,+ template: hbs`{{text-field class="tf-test" value=value onChange=changed}}`,beforeEach() {this.called = false;this.newValue = null;@@ -79,7 +80,7 @@ discourseModule("Integration | Component | text-field", function (hooks) {});componentTest("supports onChangeImmediate", {- template: `{{text-field class="tf-test" value=value onChangeImmediate=changed}}`,+ template: hbs`{{text-field class="tf-test" value=value onChangeImmediate=changed}}`,beforeEach() {this.called = false;this.newValue = null;diff --git a/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/time-input-test.jsindex f30a3968782..3a4da4eaf33 100644--- a/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js@@ -2,6 +2,7 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";function setTime(time) {@@ -16,7 +17,7 @@ discourseModule("Integration | Component | time-input", function (hooks) {});componentTest("default", {- template: `{{time-input hours=hours minutes=minutes}}`,+ template: hbs`{{time-input hours=hours minutes=minutes}}`,beforeEach() {this.setProperties({ hours: "14", minutes: "58" });@@ -28,7 +29,7 @@ discourseModule("Integration | Component | time-input", function (hooks) {});componentTest("prevents mutations", {- template: `{{time-input hours=hours minutes=minutes}}`,+ template: hbs`{{time-input hours=hours minutes=minutes}}`,beforeEach() {this.setProperties({ hours: "14", minutes: "58" });@@ -42,7 +43,7 @@ discourseModule("Integration | Component | time-input", function (hooks) {});componentTest("allows mutations through actions", {- template: `{{time-input hours=hours minutes=minutes onChange=onChange}}`,+ template: hbs`{{time-input hours=hours minutes=minutes onChange=onChange}}`,beforeEach() {this.setProperties({ hours: "14", minutes: "58" });diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.jsindex d3def0d2b80..f22fc3b17c1 100644--- a/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";function paste(element, text) {let e = new Event("paste");@@ -16,7 +17,7 @@ discourseModule("Integration | Component | user-selector", function (hooks) {setupRenderingTest(hooks);componentTest("pasting a list of usernames", {- template: `{{user-selector usernames=usernames class="test-selector"}}`,+ template: hbs`{{user-selector usernames=usernames class="test-selector"}}`,beforeEach() {this.set("usernames", "evil,trout");@@ -46,7 +47,7 @@ discourseModule("Integration | Component | user-selector", function (hooks) {});componentTest("excluding usernames", {- template: `{{user-selector usernames=usernames excludedUsernames=excludedUsernames class="test-selector"}}`,+ template: hbs`{{user-selector usernames=usernames excludedUsernames=excludedUsernames class="test-selector"}}`,beforeEach() {this.set("usernames", "mark");diff --git a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.jsindex b49b6ccc4e5..cd02aa0a20b 100644--- a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js@@ -6,13 +6,14 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";import selectKit from "discourse/tests/helpers/select-kit-helper";discourseModule("Integration | Component | value-list", function (hooks) {setupRenderingTest(hooks);componentTest("adding a value", {- template: "{{value-list values=values}}",+ template: hbs`{{value-list values=values}}`,skip: true,@@ -39,7 +40,7 @@ discourseModule("Integration | Component | value-list", function (hooks) {});componentTest("removing a value", {- template: "{{value-list values=values}}",+ template: hbs`{{value-list values=values}}`,beforeEach() {this.set("values", "vinkas\nosama");@@ -66,7 +67,7 @@ discourseModule("Integration | Component | value-list", function (hooks) {});componentTest("selecting a value", {- template: "{{value-list values=values choices=choices}}",+ template: hbs`{{value-list values=values choices=choices}}`,beforeEach() {this.setProperties({@@ -93,7 +94,7 @@ discourseModule("Integration | Component | value-list", function (hooks) {});componentTest("array support", {- template: "{{value-list values=values inputType='array'}}",+ template: hbs`{{value-list values=values inputType='array'}}`,beforeEach() {this.set("values", ["vinkas", "osama"]);@@ -120,7 +121,7 @@ discourseModule("Integration | Component | value-list", function (hooks) {});componentTest("delimiter support", {- template: "{{value-list values=values inputDelimiter='|'}}",+ template: hbs`{{value-list values=values inputDelimiter='|'}}`,beforeEach() {this.set("values", "vinkas|osama");diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.jsindex 9afee06d238..a7ff62bfab8 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | actions-summary",@@ -12,7 +13,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("post deleted", {- template: '{{mount-widget widget="actions-summary" args=args}}',+ template: hbs`{{mount-widget widget="actions-summary" args=args}}`,beforeEach() {this.set("args", {deleted_at: "2016-01-01",diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.jsindex 3267c811134..fd3bb7ac7df 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | avatar-flair",@@ -12,7 +13,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("avatar flair with an icon", {- template: '{{mount-widget widget="avatar-flair" args=args}}',+ template: hbs`{{mount-widget widget="avatar-flair" args=args}}`,beforeEach() {this.set("args", {primary_group_flair_url: "fa-bars",@@ -32,7 +33,7 @@ discourseModule(});componentTest("avatar flair with an image", {- template: '{{mount-widget widget="avatar-flair" args=args}}',+ template: hbs`{{mount-widget widget="avatar-flair" args=args}}`,beforeEach() {this.set("args", {primary_group_flair_url: "/images/avatar.png",diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/button-test.jsindex 4f73a310dbd..e280f5f0836 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js@@ -6,12 +6,13 @@ import {query,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | button", function (hooks) {setupRenderingTest(hooks);componentTest("icon only button", {- template: '{{mount-widget widget="button" args=args}}',+ template: hbs`{{mount-widget widget="button" args=args}}`,beforeEach() {this.set("args", { icon: "far-smile" });@@ -30,7 +31,7 @@ discourseModule("Integration | Component | Widget | button", function (hooks) {});componentTest("icon and text button", {- template: '{{mount-widget widget="button" args=args}}',+ template: hbs`{{mount-widget widget="button" args=args}}`,beforeEach() {this.set("args", { icon: "plus", label: "topic.create" });@@ -53,7 +54,7 @@ discourseModule("Integration | Component | Widget | button", function (hooks) {});componentTest("text only button", {- template: '{{mount-widget widget="button" args=args}}',+ template: hbs`{{mount-widget widget="button" args=args}}`,beforeEach() {this.set("args", { label: "topic.create" });@@ -72,7 +73,7 @@ discourseModule("Integration | Component | Widget | button", function (hooks) {});componentTest("translatedLabel", {- template: '{{mount-widget widget="button" args=args}}',+ template: hbs`{{mount-widget widget="button" args=args}}`,beforeEach() {this.set("args", { translatedLabel: "foo bar" });diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.jsindex 40cd6e29840..7bfb4f5e72b 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js@@ -6,6 +6,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import EmberObject from "@ember/object";+import hbs from "htmlbars-inline-precompile";import pretender from "discourse/tests/helpers/create-pretender";discourseModule(@@ -14,7 +15,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("sets notification as read on middle click", {- template: '{{mount-widget widget="default-notification-item" args=args}}',+ template: hbs`{{mount-widget widget="default-notification-item" args=args}}`,beforeEach() {this.set("args",diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.jsindex 8eb98821e80..43f4581f1f9 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js@@ -6,6 +6,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { NotificationLevels } from "discourse/lib/notification-levels";+import hbs from "htmlbars-inline-precompile";const topCategoryIds = [2, 3, 1];let mutedCategoryIds = [];@@ -18,7 +19,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("prioritize faq", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.siteSettings.faq_url = "http://example.com/faq";@@ -32,7 +33,7 @@ discourseModule(});componentTest("prioritize faq - user has read", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.siteSettings.faq_url = "http://example.com/faq";@@ -46,7 +47,7 @@ discourseModule(});componentTest("staff menu - not staff", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.currentUser.set("staff", false);@@ -58,7 +59,7 @@ discourseModule(});componentTest("staff menu - moderator", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.currentUser.set("moderator", true);@@ -72,7 +73,7 @@ discourseModule(});componentTest("staff menu - admin", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.currentUser.setProperties({ admin: true });@@ -84,7 +85,7 @@ discourseModule(});componentTest("logged in links", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,test(assert) {assert.ok(queryAll(".new-topics-link").length);@@ -93,7 +94,7 @@ discourseModule(});componentTest("general links", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,anonymous: true,test(assert) {@@ -110,7 +111,7 @@ discourseModule(let maxCategoriesToDisplay;componentTest("top categories - anonymous", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,anonymous: true,beforeEach() {@@ -131,7 +132,7 @@ discourseModule(});componentTest("top categories - allow_uncategorized_topics", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,anonymous: true,beforeEach() {@@ -154,7 +155,7 @@ discourseModule(});componentTest("top categories", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.siteSettings.header_dropdown_category_count = 8;@@ -216,7 +217,7 @@ discourseModule(});componentTest("badges link - disabled", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.siteSettings.enable_badges = false;@@ -228,7 +229,7 @@ discourseModule(});componentTest("badges link", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,test(assert) {assert.ok(queryAll(".badge-link").length);@@ -236,7 +237,7 @@ discourseModule(});componentTest("user directory link", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,test(assert) {assert.ok(queryAll(".user-directory-link").length);@@ -244,7 +245,7 @@ discourseModule(});componentTest("user directory link - disabled", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,beforeEach() {this.siteSettings.enable_user_directory = false;@@ -256,7 +257,7 @@ discourseModule(});componentTest("general links", {- template: '{{mount-widget widget="hamburger-menu"}}',+ template: hbs`{{mount-widget widget="hamburger-menu"}}`,test(assert) {assert.ok(queryAll(".about-link").length);diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/header-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/header-test.jsindex 512eeaa4223..c099e69261b 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/header-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/header-test.js@@ -7,12 +7,13 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | header", function (hooks) {setupRenderingTest(hooks);componentTest("rendering basics", {- template: '{{mount-widget widget="header"}}',+ template: hbs`{{mount-widget widget="header"}}`,test(assert) {assert.ok(queryAll("header.d-header").length);assert.ok(queryAll("#site-logo").length);@@ -20,14 +21,20 @@ discourseModule("Integration | Component | Widget | header", function (hooks) {});componentTest("sign up / login buttons", {- template:- '{{mount-widget widget="header" showCreateAccount=(action "showCreateAccount") showLogin=(action "showLogin") args=args}}',+ template: hbs`+ {{mount-widget+ widget="header"+ showCreateAccount=showCreateAccount+ showLogin=showLogin+ args=args+ }}+ `,anonymous: true,beforeEach() {this.set("args", { canSignUp: true });- this.on("showCreateAccount", () => (this.signupShown = true));- this.on("showLogin", () => (this.loginShown = true));+ this.set("showCreateAccount", () => (this.signupShown = true));+ this.set("showLogin", () => (this.loginShown = true));},async test(assert) {@@ -43,14 +50,20 @@ discourseModule("Integration | Component | Widget | header", function (hooks) {});componentTest("anon when login required", {- template:- '{{mount-widget widget="header" showCreateAccount=(action "showCreateAccount") showLogin=(action "showLogin") args=args}}',+ template: hbs`+ {{mount-widget+ widget="header"+ showCreateAccount=showCreateAccount+ showLogin=showLogin+ args=args+ }}+ `,anonymous: true,beforeEach() {this.set("args", { canSignUp: true });- this.on("showCreateAccount", () => (this.signupShown = true));- this.on("showLogin", () => (this.loginShown = true));+ this.set("showCreateAccount", () => (this.signupShown = true));+ this.set("showLogin", () => (this.loginShown = true));this.siteSettings.login_required = true;},@@ -63,13 +76,19 @@ discourseModule("Integration | Component | Widget | header", function (hooks) {});componentTest("logged in when login required", {- template:- '{{mount-widget widget="header" showCreateAccount=(action "showCreateAccount") showLogin=(action "showLogin") args=args}}',+ template: hbs`+ {{mount-widget+ widget="header"+ showCreateAccount=showCreateAccount+ showLogin=showLogin+ args=args+ }}+ `,beforeEach() {this.set("args", { canSignUp: true });- this.on("showCreateAccount", () => (this.signupShown = true));- this.on("showLogin", () => (this.loginShown = true));+ this.set("showCreateAccount", () => (this.signupShown = true));+ this.set("showLogin", () => (this.loginShown = true));this.siteSettings.login_required = true;},diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.jsindex c9d2932549d..41992f056f4 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js@@ -6,6 +6,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import Session from "discourse/models/session";+import hbs from "htmlbars-inline-precompile";const bigLogo = "/images/d-logo-sketch.png?test";const smallLogo = "/images/d-logo-sketch-small.png?test";@@ -20,7 +21,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("basics", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,skip: true,beforeEach() {this.siteSettings.site_logo_url = bigLogo;@@ -39,7 +40,7 @@ discourseModule(});componentTest("basics - minimized", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_logo_small_url = smallLogo;@@ -56,7 +57,7 @@ discourseModule(});componentTest("no logo", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = "";this.siteSettings.site_logo_small_url = "";@@ -71,7 +72,7 @@ discourseModule(});componentTest("no logo - minimized", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = "";this.siteSettings.site_logo_small_url = "";@@ -85,7 +86,7 @@ discourseModule(});componentTest("mobile logo", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_mobile_logo_url = mobileLogo;this.siteSettings.site_logo_small_url = smallLogo;@@ -99,7 +100,7 @@ discourseModule(});componentTest("mobile without logo", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.site.mobileView = true;@@ -112,7 +113,7 @@ discourseModule(});componentTest("logo with dark mode alternative", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_logo_dark_url = darkLogo;@@ -140,7 +141,7 @@ discourseModule(});componentTest("mobile logo with dark mode alternative", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_mobile_logo_url = mobileLogo;@@ -170,7 +171,7 @@ discourseModule(});componentTest("dark mode enabled but no dark logo set", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_logo_dark_url = "";@@ -191,7 +192,7 @@ discourseModule(});componentTest("dark logo set but no dark mode", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_logo_dark_url = darkLogo;@@ -208,7 +209,7 @@ discourseModule(});componentTest("dark color scheme and dark logo set", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_logo_dark_url = darkLogo;@@ -232,7 +233,7 @@ discourseModule(});componentTest("dark color scheme and dark logo not set", {- template: '{{mount-widget widget="home-logo" args=args}}',+ template: hbs`{{mount-widget widget="home-logo" args=args}}`,beforeEach() {this.siteSettings.site_logo_url = bigLogo;this.siteSettings.site_logo_dark_url = "";diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.jsindex e8287519c84..614ff999b90 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js@@ -6,6 +6,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | post-links",@@ -13,7 +14,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("duplicate links", {- template: '{{mount-widget widget="post-links" args=args}}',+ template: hbs`{{mount-widget widget="post-links" args=args}}`,beforeEach() {this.set("args", {id: 2,@@ -41,7 +42,7 @@ discourseModule(});componentTest("collapsed links", {- template: '{{mount-widget widget="post-links" args=args}}',+ template: hbs`{{mount-widget widget="post-links" args=args}}`,beforeEach() {this.set("args", {id: 1,diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.jsindex 53f10c31fe9..1e79fae7cae 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";import { withPluginApi } from "discourse/lib/plugin-api";discourseModule(@@ -13,7 +14,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("add extra button", {- template: '{{mount-widget widget="post-menu" args=args}}',+ template: hbs`{{mount-widget widget="post-menu" args=args}}`,beforeEach() {this.set("args", {});withPluginApi("0.8", (api) => {@@ -37,7 +38,7 @@ discourseModule(});componentTest("remove extra button", {- template: '{{mount-widget widget="post-menu" args=args}}',+ template: hbs`{{mount-widget widget="post-menu" args=args}}`,beforeEach() {this.set("args", {});withPluginApi("0.8", (api) => {diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.jsindex 1005000f04b..b4118cccb4e 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js@@ -7,10 +7,11 @@ import {} from "discourse/tests/helpers/qunit-helpers";import Post from "discourse/models/post";import Topic from "discourse/models/topic";+import hbs from "htmlbars-inline-precompile";function postStreamTest(name, attrs) {componentTest(name, {- template: `{{mount-widget widget="post-stream" args=(hash posts=posts)}}`,+ template: hbs`{{mount-widget widget="post-stream" args=(hash posts=posts)}}`,beforeEach() {const site = this.container.lookup("site:main");let posts = attrs.posts.call(this);diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-test.jsindex 5f749736771..708c59101dc 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js@@ -8,12 +8,13 @@ import {import EmberObject from "@ember/object";import I18n from "I18n";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | post", function (hooks) {setupRenderingTest(hooks);componentTest("basic elements", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { shareUrl: "/example", post_number: 1 });},@@ -27,7 +28,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("post - links", {- template: '{{mount-widget widget="post-contents" args=args}}',+ template: hbs`{{mount-widget widget="post-contents" args=args}}`,beforeEach() {this.set("args", {cooked:@@ -45,11 +46,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("wiki", {- template:- '{{mount-widget widget="post" args=args showHistory=(action "showHistory")}}',+ template: hbs`+ {{mount-widget widget="post" args=args showHistory=showHistory}}+ `,beforeEach() {this.set("args", { wiki: true, version: 2, canViewEditHistory: true });- this.on("showHistory", () => (this.historyShown = true));+ this.set("showHistory", () => (this.historyShown = true));},async test(assert) {await click(".post-info .wiki");@@ -61,11 +63,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("wiki without revision", {- template:- '{{mount-widget widget="post" args=args editPost=(action "editPost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args editPost=editPost}}+ `,beforeEach() {this.set("args", { wiki: true, version: 1, canViewEditHistory: true });- this.on("editPost", () => (this.editPostCalled = true));+ this.set("editPost", () => (this.editPostCalled = true));},async test(assert) {await click(".post-info .wiki");@@ -74,11 +77,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("via-email", {- template:- '{{mount-widget widget="post" args=args showRawEmail=(action "showRawEmail")}}',+ template: hbs`+ {{mount-widget widget="post" args=args showRawEmail=showRawEmail}}+ `,beforeEach() {this.set("args", { via_email: true, canViewRawEmail: true });- this.on("showRawEmail", () => (this.rawEmailShown = true));+ this.set("showRawEmail", () => (this.rawEmailShown = true));},async test(assert) {await click(".post-info.via-email");@@ -90,11 +94,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("via-email without permission", {- template:- '{{mount-widget widget="post" args=args showRawEmail=(action "showRawEmail")}}',+ template: hbs`+ {{mount-widget widget="post" args=args showRawEmail=showRawEmail}}+ `,beforeEach() {this.set("args", { via_email: true, canViewRawEmail: false });- this.on("showRawEmail", () => (this.rawEmailShown = true));+ this.set("showRawEmail", () => (this.rawEmailShown = true));},async test(assert) {await click(".post-info.via-email");@@ -106,11 +111,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("history", {- template:- '{{mount-widget widget="post" args=args showHistory=(action "showHistory")}}',+ template: hbs`+ {{mount-widget widget="post" args=args showHistory=showHistory}}+ `,beforeEach() {this.set("args", { version: 3, canViewEditHistory: true });- this.on("showHistory", () => (this.historyShown = true));+ this.set("showHistory", () => (this.historyShown = true));},async test(assert) {await click(".post-info.edits button");@@ -119,11 +125,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("history without view permission", {- template:- '{{mount-widget widget="post" args=args showHistory=(action "showHistory")}}',+ template: hbs`+ {{mount-widget widget="post" args=args showHistory=showHistory}}+ `,beforeEach() {this.set("args", { version: 3, canViewEditHistory: false });- this.on("showHistory", () => (this.historyShown = true));+ this.set("showHistory", () => (this.historyShown = true));},async test(assert) {await click(".post-info.edits");@@ -135,7 +142,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("whisper", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { isWhisper: true });},@@ -146,7 +153,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("like count button", {- template: '{{mount-widget widget="post" model=post args=args}}',+ template: hbs`{{mount-widget widget="post" model=post args=args}}`,beforeEach(store) {const topic = store.createRecord("topic", { id: 123 });const post = store.createRecord("post", {@@ -176,7 +183,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`like count with no likes`, {- template: '{{mount-widget widget="post" model=post args=args}}',+ template: hbs`{{mount-widget widget="post" model=post args=args}}`,beforeEach() {this.set("args", { likeCount: 0 });},@@ -186,7 +193,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("share button", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { shareUrl: "http://share-me.example.com" });},@@ -199,12 +206,13 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("liking", {- template:- '{{mount-widget widget="post-menu" args=args toggleLike=(action "toggleLike")}}',+ template: hbs`+ {{mount-widget widget="post-menu" args=args toggleLike=toggleLike}}+ `,beforeEach() {const args = { showLike: true, canToggleLike: true };this.set("args", args);- this.on("toggleLike", () => {+ this.set("toggleLike", () => {args.liked = !args.liked;args.likeCount = args.liked ? 1 : 0;});@@ -226,13 +234,14 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("anon liking", {- template:- '{{mount-widget widget="post-menu" args=args showLogin=(action "showLogin")}}',+ template: hbs`+ {{mount-widget widget="post-menu" args=args showLogin=showLogin}}+ `,anonymous: true,beforeEach() {const args = { showLike: true };this.set("args", args);- this.on("showLogin", () => (this.loginShown = true));+ this.set("showLogin", () => (this.loginShown = true));},async test(assert) {assert.ok(!!queryAll(".actions button.like").length);@@ -250,11 +259,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("edit button", {- template:- '{{mount-widget widget="post" args=args editPost=(action "editPost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args editPost=editPost}}+ `,beforeEach() {this.set("args", { canEdit: true });- this.on("editPost", () => (this.editPostCalled = true));+ this.set("editPost", () => (this.editPostCalled = true));},async test(assert) {await click("button.edit");@@ -263,7 +273,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`edit button - can't edit`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canEdit: false });},@@ -277,11 +287,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("recover button", {- template:- '{{mount-widget widget="post" args=args deletePost=(action "deletePost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args deletePost=deletePost}}+ `,beforeEach() {this.set("args", { canDelete: true });- this.on("deletePost", () => (this.deletePostCalled = true));+ this.set("deletePost", () => (this.deletePostCalled = true));},async test(assert) {await click("button.delete");@@ -290,11 +301,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("delete topic button", {- template:- '{{mount-widget widget="post" args=args deletePost=(action "deletePost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args deletePost=deletePost}}+ `,beforeEach() {this.set("args", { canDeleteTopic: true });- this.on("deletePost", () => (this.deletePostCalled = true));+ this.set("deletePost", () => (this.deletePostCalled = true));},async test(assert) {await click("button.delete");@@ -303,7 +315,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`delete topic button - can't delete`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canDeleteTopic: false });},@@ -319,7 +331,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {componentTest(`delete topic button - can't delete when topic author without permission`,{- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {canDeleteTopic: false,@@ -351,11 +363,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {);componentTest("recover topic button", {- template:- '{{mount-widget widget="post" args=args recoverPost=(action "recoverPost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args recoverPost=recoverPost}}+ `,beforeEach() {this.set("args", { canRecoverTopic: true });- this.on("recoverPost", () => (this.recovered = true));+ this.set("recoverPost", () => (this.recovered = true));},async test(assert) {await click("button.recover");@@ -364,7 +377,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`recover topic button - can't recover`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canRecoverTopic: false });},@@ -378,11 +391,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("delete post button", {- template:- '{{mount-widget widget="post" args=args deletePost=(action "deletePost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args deletePost=deletePost}}+ `,beforeEach() {this.set("args", { canDelete: true, canFlag: true });- this.on("deletePost", () => (this.deletePostCalled = true));+ this.set("deletePost", () => (this.deletePostCalled = true));},async test(assert) {await click(".show-more-actions");@@ -392,7 +406,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`delete post button - can't delete`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canDelete: false });},@@ -406,7 +420,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`delete post button - can't delete, can't flag`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {canDeleteTopic: false,@@ -429,11 +443,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("recover post button", {- template:- '{{mount-widget widget="post" args=args recoverPost=(action "recoverPost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args recoverPost=recoverPost}}+ `,beforeEach() {this.set("args", { canRecover: true });- this.on("recoverPost", () => (this.recovered = true));+ this.set("recoverPost", () => (this.recovered = true));},async test(assert) {await click("button.recover");@@ -442,7 +457,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`recover post button - can't recover`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canRecover: false });},@@ -456,11 +471,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`flagging`, {- template:- '{{mount-widget widget="post" args=args showFlags=(action "showFlags")}}',+ template: hbs`+ {{mount-widget widget="post" args=args showFlags=showFlags}}+ `,beforeEach() {this.set("args", { canFlag: true });- this.on("showFlags", () => (this.flagsShown = true));+ this.set("showFlags", () => (this.flagsShown = true));},async test(assert) {assert.ok(queryAll("button.create-flag").length === 1);@@ -471,7 +487,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`flagging: can't flag`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canFlag: false });},@@ -481,7 +497,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`flagging: can't flag when post is hidden`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canFlag: true, hidden: true });},@@ -491,7 +507,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`read indicator`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { read: true });},@@ -501,7 +517,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest(`unread indicator`, {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { read: false });},@@ -511,7 +527,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("reply directly above (supressed)", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {replyToUsername: "eviltrout",@@ -530,7 +546,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("reply a few posts above (supressed)", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {replyToUsername: "eviltrout",@@ -545,7 +561,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("reply directly above", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {replyToUsername: "eviltrout",@@ -566,11 +582,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("cooked content hidden", {- template:- '{{mount-widget widget="post" args=args expandHidden=(action "expandHidden")}}',+ template: hbs`+ {{mount-widget widget="post" args=args expandHidden=expandHidden}}+ `,beforeEach() {this.set("args", { cooked_hidden: true });- this.on("expandHidden", () => (this.unhidden = true));+ this.set("expandHidden", () => (this.unhidden = true));},async test(assert) {await click(".topic-body .expand-hidden");@@ -579,7 +596,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("expand first post", {- template: '{{mount-widget widget="post" model=post args=args}}',+ template: hbs`{{mount-widget widget="post" model=post args=args}}`,beforeEach(store) {this.set("args", { expandablePost: true });this.set("post", store.createRecord("post", { id: 1234 }));@@ -591,7 +608,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("can't bookmark", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canBookmark: false });},@@ -602,13 +619,14 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("bookmark", {- template:- '{{mount-widget widget="post" args=args toggleBookmark=(action "toggleBookmark")}}',+ template: hbs`+ {{mount-widget widget="post" args=args toggleBookmark=toggleBookmark}}+ `,beforeEach() {const args = { canBookmark: true };this.set("args", args);- this.on("toggleBookmark", () => (args.bookmarked = true));+ this.set("toggleBookmark", () => (args.bookmarked = true));},async test(assert) {assert.equal(queryAll(".post-menu-area .bookmark").length, 1);@@ -617,7 +635,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("can't show admin menu when you can't manage", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canManage: false });},@@ -627,7 +645,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("show admin menu", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canManage: true });},@@ -649,12 +667,13 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("toggle moderator post", {- template:- '{{mount-widget widget="post" args=args togglePostType=(action "togglePostType")}}',+ template: hbs`+ {{mount-widget widget="post" args=args togglePostType=togglePostType}}+ `,beforeEach() {this.currentUser.set("moderator", true);this.set("args", { canManage: true });- this.on("togglePostType", () => (this.toggled = true));+ this.set("togglePostType", () => (this.toggled = true));},async test(assert) {await click(".post-menu-area .show-post-admin-menu");@@ -669,12 +688,13 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {},});componentTest("toggle moderator post", {- template:- '{{mount-widget widget="post" args=args togglePostType=(action "togglePostType")}}',+ template: hbs`+ {{mount-widget widget="post" args=args togglePostType=togglePostType}}+ `,beforeEach() {this.currentUser.set("moderator", true);this.set("args", { canManage: true });- this.on("togglePostType", () => (this.toggled = true));+ this.set("togglePostType", () => (this.toggled = true));},async test(assert) {await click(".post-menu-area .show-post-admin-menu");@@ -690,11 +710,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("rebake post", {- template:- '{{mount-widget widget="post" args=args rebakePost=(action "rebakePost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args rebakePost=rebakePost}}+ `,beforeEach() {this.set("args", { canManage: true });- this.on("rebakePost", () => (this.baked = true));+ this.set("rebakePost", () => (this.baked = true));},async test(assert) {await click(".post-menu-area .show-post-admin-menu");@@ -709,11 +730,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("unhide post", {- template:- '{{mount-widget widget="post" args=args unhidePost=(action "unhidePost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args unhidePost=unhidePost}}+ `,beforeEach() {this.set("args", { canManage: true, hidden: true });- this.on("unhidePost", () => (this.unhidden = true));+ this.set("unhidePost", () => (this.unhidden = true));},async test(assert) {await click(".post-menu-area .show-post-admin-menu");@@ -728,12 +750,13 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("change owner", {- template:- '{{mount-widget widget="post" args=args changePostOwner=(action "changePostOwner")}}',+ template: hbs`+ {{mount-widget widget="post" args=args changePostOwner=changePostOwner}}+ `,beforeEach() {this.currentUser.admin = true;this.set("args", { canManage: true });- this.on("changePostOwner", () => (this.owned = true));+ this.set("changePostOwner", () => (this.owned = true));},async test(assert) {await click(".post-menu-area .show-post-admin-menu");@@ -748,11 +771,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("reply", {- template:- '{{mount-widget widget="post" args=args replyToPost=(action "replyToPost")}}',+ template: hbs`+ {{mount-widget widget="post" args=args replyToPost=replyToPost}}+ `,beforeEach() {this.set("args", { canCreatePost: true });- this.on("replyToPost", () => (this.replied = true));+ this.set("replyToPost", () => (this.replied = true));},async test(assert) {await click(".post-controls .create");@@ -761,7 +785,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("reply - without permissions", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { canCreatePost: false });},@@ -771,7 +795,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("replies - no replies", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { replyCount: 0 });},@@ -781,7 +805,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("replies - multiple replies", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.siteSettings.suppress_reply_directly_below = true;this.set("args", { replyCount: 2, replyDirectlyBelow: true });@@ -792,7 +816,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("replies - one below, suppressed", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.siteSettings.suppress_reply_directly_below = true;this.set("args", { replyCount: 1, replyDirectlyBelow: true });@@ -803,7 +827,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("replies - one below, not suppressed", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.siteSettings.suppress_reply_directly_below = false;this.set("args", { id: 6654, replyCount: 1, replyDirectlyBelow: true });@@ -819,7 +843,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("topic map not shown", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { showTopicMap: false });},@@ -829,7 +853,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("topic map - few posts", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {showTopicMap: true,@@ -854,7 +878,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("topic map - participants", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {showTopicMap: true,@@ -887,7 +911,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("topic map - links", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {showTopicMap: true,@@ -926,7 +950,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("topic map - no summary", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", { showTopicMap: true });},@@ -936,11 +960,10 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("topic map - has summary", {- template:- '{{mount-widget widget="post" args=args showSummary=(action "showSummary")}}',+ template: hbs`{{mount-widget widget="post" args=args showSummary=showSummary}}`,beforeEach() {this.set("args", { showTopicMap: true, hasTopicSummary: true });- this.on("showSummary", () => (this.summaryToggled = true));+ this.set("showSummary", () => (this.summaryToggled = true));},async test(assert) {assert.equal(queryAll(".toggle-summary").length, 1);@@ -951,7 +974,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("pm map", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {showTopicMap: true,@@ -967,7 +990,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("post notice - with username", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {const twoDaysAgo = new Date();twoDaysAgo.setDate(twoDaysAgo.getDate() - 2);@@ -996,7 +1019,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("post notice - with name", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.siteSettings.display_name_on_posts = true;this.siteSettings.prioritize_username_in_ux = false;@@ -1017,7 +1040,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {});componentTest("show group request in post", {- template: '{{mount-widget widget="post" args=args}}',+ template: hbs`{{mount-widget widget="post" args=args}}`,beforeEach() {this.set("args", {username: "foo",diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.jsindex 725ba460602..b4f685b2e64 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | poster-name",@@ -12,7 +13,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("basic rendering", {- template: '{{mount-widget widget="poster-name" args=args}}',+ template: hbs`{{mount-widget widget="poster-name" args=args}}`,beforeEach() {this.set("args", {username: "eviltrout",@@ -32,7 +33,7 @@ discourseModule(});componentTest("extra classes and glyphs", {- template: '{{mount-widget widget="poster-name" args=args}}',+ template: hbs`{{mount-widget widget="poster-name" args=args}}`,beforeEach() {this.set("args", {username: "eviltrout",@@ -55,7 +56,7 @@ discourseModule(});componentTest("disable display name on posts", {- template: '{{mount-widget widget="poster-name" args=args}}',+ template: hbs`{{mount-widget widget="poster-name" args=args}}`,beforeEach() {this.siteSettings.display_name_on_posts = false;this.set("args", { username: "eviltrout", name: "Robin Ward" });@@ -66,7 +67,7 @@ discourseModule(});componentTest("doesn't render a name if it's similar to the username", {- template: '{{mount-widget widget="poster-name" args=args}}',+ template: hbs`{{mount-widget widget="poster-name" args=args}}`,beforeEach() {this.siteSettings.prioritize_username_in_ux = true;this.siteSettings.display_name_on_posts = true;diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.jsindex 6fe42c672aa..0c3f8985565 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";const CONTENT_DIV_SELECTOR = "li > a > div";@@ -14,7 +15,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("content attribute is escaped", {- template: '{{mount-widget widget="quick-access-item" args=args}}',+ template: hbs`{{mount-widget widget="quick-access-item" args=args}}`,beforeEach() {this.set("args", { content: "<b>bold</b>" });@@ -27,7 +28,7 @@ discourseModule(});componentTest("escapedContent attribute is not escaped", {- template: '{{mount-widget widget="quick-access-item" args=args}}',+ template: hbs`{{mount-widget widget="quick-access-item" args=args}}`,beforeEach() {this.set("args", { escapedContent: ""quote"" });diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.jsindex 95316703f72..2cccac3306b 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js@@ -5,6 +5,7 @@ import {discourseModule,queryAll,} from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | small-user-list",@@ -12,7 +13,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("renders avatars and support for unknown", {- template: '{{mount-widget widget="small-user-list" args=args}}',+ template: hbs`{{mount-widget widget="small-user-list" args=args}}`,beforeEach() {this.set("args", {users: [diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/topic-admin-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/topic-admin-menu-test.jsindex 62348c4a895..b0739b2a519 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/topic-admin-menu-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/topic-admin-menu-test.js@@ -4,6 +4,7 @@ import componentTest, {import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";import Category from "discourse/models/category";import Topic from "discourse/models/topic";+import hbs from "htmlbars-inline-precompile";const createArgs = (topic) => {return {@@ -30,7 +31,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("topic-admin-menu-button is present for admin/moderators", {- template: '{{mount-widget widget="topic-admin-menu-button" args=args}}',+ template: hbs`{{mount-widget widget="topic-admin-menu-button" args=args}}`,beforeEach() {this.currentUser.setProperties({@@ -52,7 +53,7 @@ discourseModule(componentTest("topic-admin-menu-button hides for non-admin when there is no action",{- template: '{{mount-widget widget="topic-admin-menu-button" args=args}}',+ template: hbs`{{mount-widget widget="topic-admin-menu-button" args=args}}`,beforeEach() {this.currentUser.setProperties({diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/topic-participant-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/topic-participant-test.jsindex 3ca10291279..57acca0e2ca 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/topic-participant-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/topic-participant-test.js@@ -2,6 +2,7 @@ import componentTest, {setupRenderingTest,} from "discourse/tests/helpers/component-test";import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | topic-participant",@@ -9,7 +10,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("one post", {- template: '{{mount-widget widget="topic-participant" args=args}}',+ template: hbs`{{mount-widget widget="topic-participant" args=args}}`,beforeEach() {this.set("args", {@@ -30,7 +31,7 @@ discourseModule(});componentTest("many posts, a primary group with flair", {- template: '{{mount-widget widget="topic-participant" args=args}}',+ template: hbs`{{mount-widget widget="topic-participant" args=args}}`,beforeEach() {this.set("args", {diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/topic-status-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/topic-status-test.jsindex f8e8377eb0a..683a074c062 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/topic-status-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/topic-status-test.js@@ -6,6 +6,7 @@ import {queryAll,} from "discourse/tests/helpers/qunit-helpers";import TopicStatusIcons from "discourse/helpers/topic-status-icons";+import hbs from "htmlbars-inline-precompile";discourseModule("Integration | Component | Widget | topic-status",@@ -13,7 +14,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("basics", {- template: '{{mount-widget widget="topic-status" args=args}}',+ template: hbs`{{mount-widget widget="topic-status" args=args}}`,beforeEach(store) {this.set("args", {topic: store.createRecord("topic", { closed: true }),@@ -26,7 +27,7 @@ discourseModule(});componentTest("extendability", {- template: '{{mount-widget widget="topic-status" args=args}}',+ template: hbs`{{mount-widget widget="topic-status" args=args}}`,beforeEach(store) {TopicStatusIcons.addObject(["has_accepted_answer",diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.jsindex 232745f9356..6654fa504dd 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js@@ -8,6 +8,7 @@ import {import DiscourseURL from "discourse/lib/url";import I18n from "I18n";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";import sinon from "sinon";discourseModule(@@ -16,7 +17,7 @@ discourseModule(setupRenderingTest(hooks);componentTest("basics", {- template: '{{mount-widget widget="user-menu"}}',+ template: hbs`{{mount-widget widget="user-menu"}}`,test(assert) {assert.ok(queryAll(".user-menu").length);@@ -29,7 +30,7 @@ discourseModule(});componentTest("notifications", {- template: '{{mount-widget widget="user-menu"}}',+ template: hbs`{{mount-widget widget="user-menu"}}`,async test(assert) {const $links = queryAll(".quick-access-panel li a");@@ -88,10 +89,10 @@ discourseModule(});componentTest("log out", {- template: '{{mount-widget widget="user-menu" logout=(action "logout")}}',+ template: hbs`{{mount-widget widget="user-menu" logout=logout}}`,beforeEach() {- this.on("logout", () => (this.loggedOut = true));+ this.set("logout", () => (this.loggedOut = true));},async test(assert) {@@ -105,7 +106,7 @@ discourseModule(});componentTest("private messages - disabled", {- template: '{{mount-widget widget="user-menu"}}',+ template: hbs`{{mount-widget widget="user-menu"}}`,beforeEach() {this.siteSettings.enable_personal_messages = false;},@@ -116,7 +117,7 @@ discourseModule(});componentTest("private messages - enabled", {- template: '{{mount-widget widget="user-menu"}}',+ template: hbs`{{mount-widget widget="user-menu"}}`,beforeEach() {this.siteSettings.enable_personal_messages = true;},@@ -152,7 +153,7 @@ discourseModule(});componentTest("bookmarks", {- template: '{{mount-widget widget="user-menu"}}',+ template: hbs`{{mount-widget widget="user-menu"}}`,async test(assert) {await click(".user-bookmarks-link");@@ -180,15 +181,16 @@ discourseModule(});componentTest("anonymous", {- template:- '{{mount-widget widget="user-menu" toggleAnonymous=(action "toggleAnonymous")}}',+ template: hbs`+ {{mount-widget widget="user-menu" toggleAnonymous=toggleAnonymous}}+ `,beforeEach() {this.currentUser.setProperties({ is_anonymous: false, trust_level: 3 });this.siteSettings.allow_anonymous_posting = true;this.siteSettings.anonymous_posting_min_trust_level = 3;- this.on("toggleAnonymous", () => (this.anonymous = true));+ this.set("toggleAnonymous", () => (this.anonymous = true));},async test(assert) {@@ -201,7 +203,7 @@ discourseModule(});componentTest("anonymous - disabled", {- template: '{{mount-widget widget="user-menu"}}',+ template: hbs`{{mount-widget widget="user-menu"}}`,beforeEach() {this.siteSettings.allow_anonymous_posting = false;@@ -214,14 +216,15 @@ discourseModule(});componentTest("anonymous - switch back", {- template:- '{{mount-widget widget="user-menu" toggleAnonymous=(action "toggleAnonymous")}}',+ template: hbs`+ {{mount-widget widget="user-menu" toggleAnonymous=toggleAnonymous}}+ `,beforeEach() {this.currentUser.setProperties({ is_anonymous: true });this.siteSettings.allow_anonymous_posting = true;- this.on("toggleAnonymous", () => (this.anonymous = false));+ this.set("toggleAnonymous", () => (this.anonymous = false));},async test(assert) {diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.jsindex f17e92981cf..2a39472ec61 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js@@ -8,6 +8,7 @@ import {} from "discourse/tests/helpers/qunit-helpers";import I18n from "I18n";import { click } from "@ember/test-helpers";+import hbs from "htmlbars-inline-precompile";const DEFAULT_CONTENT = {content: [@@ -46,7 +47,7 @@ function body() {return queryAll("#my-dropdown .widget-dropdown-body")[0];}-const TEMPLATE = `+const TEMPLATE = hbs`{{mount-widgetwidget="widget-dropdown"args=(hash@@ -132,7 +133,7 @@ discourseModule(});componentTest("onChange action", {- template: `+ template: hbs`<div id="test"></div>{{mount-widgetwidget="widget-dropdown"@@ -140,7 +141,7 @@ discourseModule(id="my-dropdown"label=labelcontent=content- onChange=(action "onChange")+ onChange=onChange)}}`,@@ -148,9 +149,9 @@ discourseModule(beforeEach() {this.setProperties(DEFAULT_CONTENT);- this.on(+ this.set("onChange",- (item) => (this._element.querySelector("#test").innerText = item.id)+ (item) => (queryAll("#test")[0].innerText = item.id));},diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.jsindex 047eebbf322..e8b22828f92 100644--- a/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js+++ b/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js@@ -9,7 +9,8 @@ import I18n from "I18n";import { Promise } from "rsvp";import { click } from "@ember/test-helpers";import { createWidget } from "discourse/widgets/widget";-import hbs from "discourse/widgets/hbs-compiler";+import hbs from "htmlbars-inline-precompile";+import widgetHbs from "discourse/widgets/hbs-compiler";import { next } from "@ember/runloop";import { withPluginApi } from "discourse/lib/plugin-api";@@ -17,12 +18,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {setupRenderingTest(hooks);componentTest("widget attributes are passed in via args", {- template: `{{mount-widget widget="hello-test" args=args}}`,+ template: hbs`{{mount-widget widget="hello-test" args=args}}`,beforeEach() {createWidget("hello-test", {tagName: "div.test",- template: hbs`Hello {{attrs.name}}`,+ template: widgetHbs`Hello {{attrs.name}}`,});this.set("args", { name: "Robin" });@@ -34,11 +35,11 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("hbs template - no tagName", {- template: `{{mount-widget widget="hbs-test" args=args}}`,+ template: hbs`{{mount-widget widget="hbs-test" args=args}}`,beforeEach() {createWidget("hbs-test", {- template: hbs`<div class='test'>Hello {{attrs.name}}</div>`,+ template: widgetHbs`<div class='test'>Hello {{attrs.name}}</div>`,});this.set("args", { name: "Robin" });@@ -50,12 +51,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("hbs template - with tagName", {- template: `{{mount-widget widget="hbs-test" args=args}}`,+ template: hbs`{{mount-widget widget="hbs-test" args=args}}`,beforeEach() {createWidget("hbs-test", {tagName: "div.test",- template: hbs`Hello {{attrs.name}}`,+ template: widgetHbs`Hello {{attrs.name}}`,});this.set("args", { name: "Robin" });@@ -67,11 +68,11 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("hbs template - with data attributes", {- template: `{{mount-widget widget="hbs-test" args=args}}`,+ template: hbs`{{mount-widget widget="hbs-test" args=args}}`,beforeEach() {createWidget("hbs-test", {- template: hbs`<div class='mydiv' data-my-test='hello world'></div>`,+ template: widgetHbs`<div class='mydiv' data-my-test='hello world'></div>`,});},@@ -81,7 +82,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("buildClasses", {- template: `{{mount-widget widget="classname-test" args=args}}`,+ template: hbs`{{mount-widget widget="classname-test" args=args}}`,beforeEach() {createWidget("classname-test", {@@ -104,7 +105,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("buildAttributes", {- template: `{{mount-widget widget="attributes-test" args=args}}`,+ template: hbs`{{mount-widget widget="attributes-test" args=args}}`,beforeEach() {createWidget("attributes-test", {@@ -125,7 +126,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("buildId", {- template: `{{mount-widget widget="id-test" args=args}}`,+ template: hbs`{{mount-widget widget="id-test" args=args}}`,beforeEach() {createWidget("id-test", {@@ -143,13 +144,13 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("widget state", {- template: `{{mount-widget widget="state-test"}}`,+ template: hbs`{{mount-widget widget="state-test"}}`,beforeEach() {createWidget("state-test", {tagName: "button.test",buildKey: () => `button-test`,- template: hbs`{{state.clicks}} clicks`,+ template: widgetHbs`{{state.clicks}} clicks`,defaultState() {return { clicks: 0 };@@ -165,19 +166,19 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {assert.ok(queryAll("button.test").length, "it renders the button");assert.equal(queryAll("button.test").text(), "0 clicks");- await click(queryAll("button"));+ await click(queryAll("button")[0]);assert.equal(queryAll("button.test").text(), "1 clicks");},});componentTest("widget update with promise", {- template: `{{mount-widget widget="promise-test"}}`,+ template: hbs`{{mount-widget widget="promise-test"}}`,beforeEach() {createWidget("promise-test", {tagName: "button.test",buildKey: () => "promise-test",- template: hbs`+ template: widgetHbs`{{#if state.name}}{{state.name}}{{else}}@@ -199,20 +200,20 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {async test(assert) {assert.equal(queryAll("button.test").text().trim(), "No name");- await click(queryAll("button"));+ await click(queryAll("button")[0]);assert.equal(queryAll("button.test").text().trim(), "Robin");},});componentTest("widget attaching", {- template: `{{mount-widget widget="attach-test"}}`,+ template: hbs`{{mount-widget widget="attach-test"}}`,beforeEach() {createWidget("test-embedded", { tagName: "div.embedded" });createWidget("attach-test", {tagName: "div.container",- template: hbs`{{attach widget="test-embedded" attrs=attrs}}`,+ template: widgetHbs`{{attach widget="test-embedded" attrs=attrs}}`,});},@@ -223,14 +224,14 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("magic attaching by name", {- template: `{{mount-widget widget="attach-test"}}`,+ template: hbs`{{mount-widget widget="attach-test"}}`,beforeEach() {createWidget("test-embedded", { tagName: "div.embedded" });createWidget("attach-test", {tagName: "div.container",- template: hbs`{{test-embedded attrs=attrs}}`,+ template: widgetHbs`{{test-embedded attrs=attrs}}`,});},@@ -241,17 +242,17 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("custom attrs to a magic attached widget", {- template: `{{mount-widget widget="attach-test"}}`,+ template: hbs`{{mount-widget widget="attach-test"}}`,beforeEach() {createWidget("testing", {tagName: "span.value",- template: hbs`{{attrs.value}}`,+ template: widgetHbs`{{attrs.value}}`,});createWidget("attach-test", {tagName: "div.container",- template: hbs`{{testing value=(concat "hello" " " "world")}}`,+ template: widgetHbs`{{testing value=(concat "hello" " " "world")}}`,});},@@ -262,11 +263,11 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("handlebars d-icon", {- template: `{{mount-widget widget="hbs-icon-test" args=args}}`,+ template: hbs`{{mount-widget widget="hbs-icon-test" args=args}}`,beforeEach() {createWidget("hbs-icon-test", {- template: hbs`{{d-icon "arrow-down"}}`,+ template: widgetHbs`{{d-icon "arrow-down"}}`,});},@@ -278,11 +279,11 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {componentTest("handlebars i18n", {_translations: I18n.translations,- template: `{{mount-widget widget="hbs-i18n-test" args=args}}`,+ template: hbs`{{mount-widget widget="hbs-i18n-test" args=args}}`,beforeEach() {createWidget("hbs-i18n-test", {- template: hbs`+ template: widgetHbs`<span class='string'>{{i18n "hbs_test0"}}</span><span class='var'>{{i18n attrs.key}}</span><a href title={{i18n "hbs_test0"}}>test</a>@@ -312,12 +313,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("handlebars #each", {- template: `{{mount-widget widget="hbs-each-test" args=args}}`,+ template: hbs`{{mount-widget widget="hbs-each-test" args=args}}`,beforeEach() {createWidget("hbs-each-test", {tagName: "ul",- template: hbs`+ template: widgetHbs`{{#each attrs.items as |item|}}<li>{{item}}</li>{{/each}}@@ -336,12 +337,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("widget decorating", {- template: `{{mount-widget widget="decorate-test"}}`,+ template: hbs`{{mount-widget widget="decorate-test"}}`,beforeEach() {createWidget("decorate-test", {tagName: "div.decorate",- template: hbs`main content`,+ template: widgetHbs`main content`,});withPluginApi("0.1", (api) => {@@ -363,12 +364,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("widget settings", {- template: `{{mount-widget widget="settings-test"}}`,+ template: hbs`{{mount-widget widget="settings-test"}}`,beforeEach() {createWidget("settings-test", {tagName: "div.settings",- template: hbs`age is {{settings.age}}`,+ template: widgetHbs`age is {{settings.age}}`,settings: { age: 36 },});},@@ -379,12 +380,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("override settings", {- template: `{{mount-widget widget="ov-settings-test"}}`,+ template: hbs`{{mount-widget widget="ov-settings-test"}}`,beforeEach() {createWidget("ov-settings-test", {tagName: "div.settings",- template: hbs`age is {{settings.age}}`,+ template: widgetHbs`age is {{settings.age}}`,settings: { age: 36 },});@@ -399,12 +400,12 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {});componentTest("get accessor", {- template: `{{mount-widget widget="get-accessor-test"}}`,+ template: hbs`{{mount-widget widget="get-accessor-test"}}`,beforeEach() {createWidget("get-accessor-test", {tagName: "div.test",- template: hbs`Hello {{transformed.name}}`,+ template: widgetHbs`Hello {{transformed.name}}`,transform() {return {name: this.get("currentUser.username"),diff --git a/app/assets/javascripts/test-shims.js b/app/assets/javascripts/test-shims.jsindex f7beba796db..e28bb0fa1dd 100644--- a/app/assets/javascripts/test-shims.js+++ b/app/assets/javascripts/test-shims.js@@ -46,6 +46,7 @@ define("@ember/test-helpers", () => {"currentRouteName","fillIn","setResolver",+ "triggerEvent",].forEach((attr) => {helpers[attr] = function () {return window[attr](...arguments);