A platform for community discussion. Free, open, simple.
DEV: Fix various lint issues (#33811)
Jarek Radosz21e9733f27d3
diff --git a/app/assets/javascripts/discourse/tests/integration/components/filter-input-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/filter-input-test.gjsindex 5588fc6c794..40d5673861a 100644--- a/app/assets/javascripts/discourse/tests/integration/components/filter-input-test.gjs+++ b/app/assets/javascripts/discourse/tests/integration/components/filter-input-test.gjs@@ -3,7 +3,6 @@ import { fillIn, render, triggerEvent } from "@ember/test-helpers";import { module, test } from "qunit";import FilterInput from "discourse/components/filter-input";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { exists } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | filter-input", function (hooks) {setupRenderingTest(hooks);@@ -13,7 +12,7 @@ module("Integration | Component | filter-input", function (hooks) {<template><FilterInput @icons={{hash left="bell"}} /></template>);- assert.true(exists(".d-icon-bell.-left"));+ assert.dom(".d-icon-bell.-left").exists();});test("Right icon", async function (assert) {@@ -21,13 +20,13 @@ module("Integration | Component | filter-input", function (hooks) {<template><FilterInput @icons={{hash right="bell"}} /></template>);- assert.true(exists(".d-icon-bell.-right"));+ assert.dom(".d-icon-bell.-right").exists();});test("containerClass argument", async function (assert) {await render(<template><FilterInput @containerClass="foo" /></template>);- assert.true(exists(".filter-input-container.foo"));+ assert.dom(".filter-input-container.foo").exists();});test("Html attributes", async function (assert) {@@ -35,8 +34,8 @@ module("Integration | Component | filter-input", function (hooks) {<template><FilterInput data-foo="1" placeholder="bar" /></template>);- assert.true(exists('.filter-input[data-foo="1"]'));- assert.true(exists('.filter-input[placeholder="bar"]'));+ assert.dom('.filter-input[data-foo="1"]').exists();+ assert.dom('.filter-input[placeholder="bar"]').exists();});test("Filter action", async function (assert) {@@ -62,10 +61,10 @@ module("Integration | Component | filter-input", function (hooks) {);await triggerEvent(".filter-input", "focusin");- assert.true(exists(".filter-input-container.is-focused"));+ assert.dom(".filter-input-container.is-focused").exists();await triggerEvent(".filter-input", "focusout");- assert.false(exists(".filter-input-container.is-focused"));+ assert.dom(".filter-input-container.is-focused").doesNotExist();});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/post/post-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/post/post-test.gjsindex fddf4bb4e92..eae3b73e19b 100644--- a/app/assets/javascripts/discourse/tests/integration/components/post/post-test.gjs+++ b/app/assets/javascripts/discourse/tests/integration/components/post/post-test.gjs@@ -4,7 +4,7 @@ import { module, test } from "qunit";import Post from "discourse/components/post";import { withPluginApi } from "discourse/lib/plugin-api";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, queryAll } from "discourse/tests/helpers/qunit-helpers";+import { queryAll } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";import DMenus from "float-kit/components/d-menus";@@ -286,8 +286,8 @@ module("Integration | Component | Post", function (hooks) {await renderComponent(this.post);- assert.strictEqual(count(".topic-post.whisper"), 1);- assert.strictEqual(count(".post-info.whisper"), 1);+ assert.dom(".topic-post.whisper").exists({ count: 1 });+ assert.dom(".post-info.whisper").exists({ count: 1 });});test("language", async function (assert) {@@ -372,7 +372,7 @@ module("Integration | Component | Post", function (hooks) {await renderComponent(this.post, { prevPost });assert.dom("a.reply-to-tab").exists("shows the tab");- assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class");+ assert.dom(".avoid-tab").exists({ count: 1 }, "has the avoid tab class");});test("reply directly above", async function (assert) {@@ -392,10 +392,10 @@ module("Integration | Component | Post", function (hooks) {await renderComponent(this.post, { prevPost });- assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class");+ assert.dom(".avoid-tab").exists({ count: 1 }, "has the avoid tab class");await click("a.reply-to-tab");- assert.strictEqual(count("section.embedded-posts.top .cooked"), 1);- assert.strictEqual(count("section.embedded-posts .d-icon-arrow-up"), 1);+ assert.dom("section.embedded-posts.top .cooked").exists({ count: 1 });+ assert.dom("section.embedded-posts .d-icon-arrow-up").exists({ count: 1 });});test("cooked content hidden", async function (assert) {diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/block.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/block.gjsindex 95165e41eb1..c7ec6422f7a 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/block.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message/blocks/block.gjs@@ -1,7 +1,7 @@-import { default as GlimmerComponent } from "@glimmer/component";+import Component from "@glimmer/component";import Actions from "./actions";-export default class Block extends GlimmerComponent {+export default class Block extends Component {get blockForType() {switch (this.args.definition.type) {case "actions":diff --git a/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-list-setting.gjs b/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-list-setting.gjsindex b9357828593..ce79266e3df 100644--- a/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-list-setting.gjs+++ b/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-list-setting.gjs@@ -25,9 +25,8 @@ export default class HouseAdsListSetting extends HouseAdsSetting {/><div class="setting-controls">{{#if this.changed}}- {{! template-lint-disable no-action }}- <DButton class="ok" @action={{action "save"}} @icon="check" />- <DButton class="cancel" @action={{action "cancel"}} @icon="xmark" />+ <DButton class="ok" @action={{this.save}} @icon="check" />+ <DButton class="cancel" @action={{this.cancel}} @icon="xmark" />{{/if}}</div><p class="help">{{this.help}}</p>diff --git a/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-setting.gjs b/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-setting.gjsindex 8a6b509b7c5..2b523a2a439 100644--- a/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-setting.gjs+++ b/plugins/discourse-adplugin/admin/assets/javascripts/admin/components/house-ads-setting.gjs@@ -24,32 +24,37 @@ export default class HouseAdsSetting extends Component {}@action- save() {- if (!this.get("saving")) {+ async save() {+ if (this.get("saving")) {+ return;+ }++ this.setProperties({+ saving: true,+ savingStatus: i18n("saving"),+ });++ try {+ await ajax(+ `/admin/plugins/pluginad/house_settings/${this.get("name")}.json`,+ {+ type: "PUT",+ data: { value: this.get("adValue") },+ }+ );+ const adSettings = this.get("adSettings");+ adSettings.set(this.get("name"), this.get("adValue"));this.setProperties({- saving: true,- savingStatus: i18n("saving"),+ value: this.get("adValue"),+ savingStatus: i18n("saved"),+ });+ } catch (e) {+ popupAjaxError(e);+ } finally {+ this.setProperties({+ saving: false,+ savingStatus: "",});-- ajax(`/admin/plugins/pluginad/house_settings/${this.get("name")}.json`, {- type: "PUT",- data: { value: this.get("adValue") },- })- .then(() => {- const adSettings = this.get("adSettings");- adSettings.set(this.get("name"), this.get("adValue"));- this.setProperties({- value: this.get("adValue"),- savingStatus: i18n("saved"),- });- })- .catch(popupAjaxError)- .finally(() => {- this.setProperties({- saving: false,- savingStatus: "",- });- });}}@@ -63,9 +68,8 @@ export default class HouseAdsSetting extends Component {<TextField @value={{this.adValue}} @classNames="house-ads-text-input" /><div class="setting-controls">{{#if this.changed}}- {{! template-lint-disable no-action }}- <DButton class="ok" @action={{action "save"}} @icon="check" />- <DButton class="cancel" @action={{action "cancel"}} @icon="xmark" />+ <DButton class="ok" @action={{this.save}} @icon="check" />+ <DButton class="cancel" @action={{this.cancel}} @icon="xmark" />{{/if}}</div><p class="help">{{this.help}}</p>diff --git a/plugins/discourse-adplugin/spec/models/house_ad_spec.rb b/plugins/discourse-adplugin/spec/models/house_ad_spec.rbindex d2977412591..d683d4f3512 100644--- a/plugins/discourse-adplugin/spec/models/house_ad_spec.rb+++ b/plugins/discourse-adplugin/spec/models/house_ad_spec.rb@@ -118,7 +118,7 @@ describe AdPlugin::HouseAd doendit "duplicate name" do- existing = AdPlugin::HouseAd.create(valid_attrs)+ AdPlugin::HouseAd.create(valid_attrs)ad = AdPlugin::HouseAd.from_hash(valid_attrs)expect(ad.save).to eq(false)expect(ad).to_not be_valid@@ -128,7 +128,7 @@ describe AdPlugin::HouseAd doendit "duplicate name, different case" do- existing = AdPlugin::HouseAd.create(valid_attrs.merge(name: "mechanic"))+ AdPlugin::HouseAd.create(valid_attrs.merge(name: "mechanic"))ad = AdPlugin::HouseAd.create(valid_attrs.merge(name: "Mechanic"))expect(ad.save).to eq(false)expect(ad).to_not be_validdiff --git a/plugins/discourse-adplugin/test/javascripts/acceptance/house-ad-test.js b/plugins/discourse-adplugin/test/javascripts/acceptance/house-ad-test.jsindex ea5f7684639..169277cd9a8 100644--- a/plugins/discourse-adplugin/test/javascripts/acceptance/house-ad-test.js+++ b/plugins/discourse-adplugin/test/javascripts/acceptance/house-ad-test.js@@ -2,7 +2,6 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- query,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -53,7 +52,7 @@ import {},});- test("correct ads show", async (assert) => {+ test("correct ads show", async function (assert) {updateCurrentUser({staff: false,trust_level: 1,@@ -63,15 +62,15 @@ import {assert.dom(".h-above-post-stream")- .exists({ count: 1 }, "it should render ad at top of topic");+ .exists({ count: 1 }, "renders ad at top of topic");assert.dom(".h-above-suggested")- .exists({ count: 1 }, "it should render ad above suggested topics");+ .exists({ count: 1 }, "renders ad above suggested topics");assert.dom(".h-post")- .exists({ count: 3 }, "it should render 3 ads between posts");+ .exists({ count: 3 }, "renders 3 ads between posts");assert.dom("#post_6 + .ad-connector .h-post")@@ -89,15 +88,15 @@ import {assert.dom(".h-topic-list")- .exists({ count: 1 }, "it should render ad above topic list");- const originalTopAdElement = query(".h-topic-list");+ .exists({ count: 1 }, "renders ad above topic list");+ const originalTopAdElement = document.querySelector(".h-topic-list");assert.dom(".h-between-topic-list")- .exists({ count: 5 }, "it should render 5 ads between topics");+ .exists({ count: 5 }, "renders 5 ads between topics");await visit("/top");- const newTopAdElement = query(".h-topic-list");+ const newTopAdElement = document.querySelector(".h-topic-list");assert.notStrictEqual(originalTopAdElement,@@ -159,7 +158,7 @@ import {},});- test("displays ad to users when current category id is included in ad category_ids", async (assert) => {+ test("displays ad to users when current category id is included in ad category_ids", async function (assert) {updateCurrentUser({staff: false,trust_level: 1,@@ -198,7 +197,7 @@ import {},});- test("hides ad to users when current category id is not included in ad category_ids", async (assert) => {+ test("hides ad to users when current category id is not included in ad category_ids", async function (assert) {updateCurrentUser({staff: false,trust_level: 1,@@ -236,7 +235,7 @@ import {},});- test("hides ad to anon users when current category id is not included in ad category_ids", async (assert) => {+ test("hides ad to anon users when current category id is not included in ad category_ids", async function (assert) {await visit("/c/bug/1");assert.dom(".h-topic-list")@@ -269,7 +268,7 @@ import {},});- test("hides ad to anon users when current category id is not included in ad category_ids", async (assert) => {+ test("hides ad to anon users when current category id is not included in ad category_ids", async function (assert) {await visit("/c/bug/1");assert.dom(".h-topic-list")@@ -302,7 +301,7 @@ import {},});- test("shows ad to anon users when current category id is included in ad category_ids", async (assert) => {+ test("shows ad to anon users when current category id is included in ad category_ids", async function (assert) {await visit("/c/bug/1");assert.dom(".h-topic-list")@@ -338,7 +337,7 @@ import {},});- test("shows non-restricted ad to anon users", async (assert) => {+ test("shows non-restricted ad to anon users", async function (assert) {await visit("/c/bug/1");assert.dom(".h-topic-list-two")diff --git a/plugins/discourse-adplugin/test/javascripts/acceptance/mixed-ads-test.js b/plugins/discourse-adplugin/test/javascripts/acceptance/mixed-ads-test.jsindex 566325c385b..56738123bf6 100644--- a/plugins/discourse-adplugin/test/javascripts/acceptance/mixed-ads-test.js+++ b/plugins/discourse-adplugin/test/javascripts/acceptance/mixed-ads-test.js@@ -3,7 +3,6 @@ import { test } from "qunit";import { AUTO_GROUPS } from "discourse/lib/constants";import {acceptance,- count,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -44,7 +43,7 @@ acceptance("Mixed Ads", function (needs) {},});- test("correct ads show", async (assert) => {+ test("correct ads show", async function (assert) {updateCurrentUser({staff: false,trust_level: 1,@@ -53,17 +52,12 @@ acceptance("Mixed Ads", function (needs) {});await visit("/t/280"); // 20 posts- const houseAdsCount = count(".house-creative");- const dfpAdsCount = count(".google-dfp-ad");-- assert.true(houseAdsCount > 1);- assert.true(houseAdsCount < 4);- assert.true(dfpAdsCount > 1);- assert.true(dfpAdsCount < 4);+ assert.dom(".house-creative").exists({ count: 2 });+ assert.dom(".google-dfp-ad").exists({ count: 3 });await visit("/latest");assert.dom(".h-topic-list-top, .dfp-ad-topic-list-top")- .exists({ count: 1 }, "it should render ad above topic list");+ .exists({ count: 1 }, "renders ad above topic list");});});diff --git a/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.js b/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.jsindex 709b66f3093..f3d7cdaaacc 100644--- a/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.js@@ -1,5 +1,3 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { module, test } from "qunit";import {addProgressDot,@@ -128,9 +126,9 @@ module("Discourse AI | Unit | Lib | ai-streamer", function () {let done = await applyProgress(status, streamUpdater);- assert.notOk(done, "The update should not be done.");+ assert.false(done, "The update should not be done.");- assert.equal(+ assert.strictEqual(streamUpdater.raw,status.raw.substring(0, MIN_LETTERS_PER_INTERVAL),"The raw content should delta update."@@ -138,9 +136,9 @@ module("Discourse AI | Unit | Lib | ai-streamer", function () {done = await applyProgress(status, streamUpdater);- assert.notOk(done, "The update should not be done.");+ assert.false(done, "The update should not be done.");- assert.equal(+ assert.strictEqual(streamUpdater.raw,status.raw.substring(0, MIN_LETTERS_PER_INTERVAL * 2),"The raw content should delta update."@@ -150,7 +148,7 @@ module("Discourse AI | Unit | Lib | ai-streamer", function () {await applyProgress(status, streamUpdater);const innerHtml = streamUpdater.element.innerHTML;- assert.equal(+ assert.strictEqual(innerHtml,"<p>some raw content</p>","The cooked content should be updated."@@ -161,7 +159,7 @@ module("Discourse AI | Unit | Lib | ai-streamer", function () {await applyProgress(status, streamUpdater);- assert.equal(+ assert.strictEqual(streamUpdater.element.innerHTML,"<p>updated cooked</p>","The cooked content should be updated."diff --git a/plugins/discourse-ai/test/javascripts/unit/lib/utilities-test.js b/plugins/discourse-ai/test/javascripts/unit/lib/utilities-test.jsindex 15fade38940..bd11b106695 100644--- a/plugins/discourse-ai/test/javascripts/unit/lib/utilities-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/lib/utilities-test.js@@ -1,5 +1,3 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { module, test } from "qunit";import { jsonToHtml } from "discourse/plugins/discourse-ai/discourse/lib/utilities";@@ -8,28 +6,28 @@ module("Unit | Utility | json-to-html", function () {const input = null;const result = jsonToHtml(input).toString();- assert.equal(result, "null", "Null should be properly formatted");+ assert.strictEqual(result, "null", "Null should be properly formatted");});test("it properly handles boolean", function (assert) {const input = true;const result = jsonToHtml(input).toString();- assert.equal(result, "true", "Boolean should be properly formatted");+ assert.strictEqual(result, "true", "Boolean should be properly formatted");});test("it properly handles numbers", function (assert) {const input = 42.1;const result = jsonToHtml(input).toString();- assert.equal(result, "42.1", "Numbers should be properly formatted");+ assert.strictEqual(result, "42.1", "Numbers should be properly formatted");});test("it properly handles undefined", function (assert) {const input = undefined;const result = jsonToHtml(input).toString();- assert.equal(result, "", "Undefined should be properly formatted");+ assert.strictEqual(result, "", "Undefined should be properly formatted");});test("it handles nested objects correctly", function (assert) {@@ -45,7 +43,7 @@ module("Unit | Utility | json-to-html", function () {const expected ="<ul><li><strong>outer:</strong> <ul><li><ul><li><strong>inner:</strong> <ul><li><ul><li><strong>key:</strong> value</li></ul></li></ul></li></ul></li></ul></li></ul>";- assert.equal(+ assert.strictEqual(result,expected,"Nested objects should be properly formatted"@@ -62,6 +60,6 @@ module("Unit | Utility | json-to-html", function () {const expected ="<ul><li><strong>array:</strong> <ul><li><strong>0:</strong> 1</li><li><strong>1:</strong> 2</li><li><strong>2:</strong> 3</li></ul></li></ul>";- assert.equal(result, expected, "Arrays should be properly formatted");+ assert.strictEqual(result, expected, "Arrays should be properly formatted");});});diff --git a/plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.js b/plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.jsindex e15f77531b9..8b11c3c0657 100644--- a/plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.js@@ -1,5 +1,3 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { module, test } from "qunit";import AiPersona from "discourse/plugins/discourse-ai/discourse/admin/models/ai-persona";@@ -20,8 +18,8 @@ module("Discourse AI | Unit | Model | ai-persona", function () {"ToolName2","ToolName3",]);- assert.equal(aiPersonaPOJO.toolOptions["ToolName"].option1, "value1");- assert.equal(aiPersonaPOJO.toolOptions["ToolName"].option2, "value2");+ assert.strictEqual(aiPersonaPOJO.toolOptions["ToolName"].option1, "value1");+ assert.strictEqual(aiPersonaPOJO.toolOptions["ToolName"].option2, "value2");});test("fromPOJO", function (assert) {diff --git a/plugins/discourse-ai/test/javascripts/unit/routes/discourse-ai-shared-conversation-show-route-test.js b/plugins/discourse-ai/test/javascripts/unit/routes/discourse-ai-shared-conversation-show-route-test.jsindex 0ff9a46c74b..b24a380398f 100644--- a/plugins/discourse-ai/test/javascripts/unit/routes/discourse-ai-shared-conversation-show-route-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/routes/discourse-ai-shared-conversation-show-route-test.js@@ -1,5 +1,3 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { setupTest } from "ember-qunit";import { module, test } from "qunit";import sinon from "sinon";@@ -13,7 +11,7 @@ module(const transition = {intent: { url: "https://www.discourse.org" },abort() {- assert.ok(true, "transition.abort() was called");+ assert.true(true, "transition.abort() was called");},};@@ -32,12 +30,16 @@ module(});windowOpenStub.callsFake((url, target) => {- assert.equal(+ assert.strictEqual(url,"https://www.discourse.org","window.open was called with the correct URL");- assert.equal(target, "_blank", 'window.open was called with "_blank"');+ assert.strictEqual(+ target,+ "_blank",+ 'window.open was called with "_blank"'+ );});route.beforeModel(transition);@@ -50,7 +52,7 @@ module(});routeRedirectStub.callsFake((url) => {- assert.equal(+ assert.strictEqual(url,"https://www.discourse.org","redirect was called with the correct URL"diff --git a/plugins/discourse-assign/assets/javascripts/discourse/components/remind-assigns-frequency.gjs b/plugins/discourse-assign/assets/javascripts/discourse/components/remind-assigns-frequency.gjsindex 0a17c98d97e..0877e30c21e 100644--- a/plugins/discourse-assign/assets/javascripts/discourse/components/remind-assigns-frequency.gjs+++ b/plugins/discourse-assign/assets/javascripts/discourse/components/remind-assigns-frequency.gjs@@ -1,4 +1,5 @@import Component from "@ember/component";+import { fn } from "@ember/helper";import discourseComputed from "discourse/lib/decorators";import { i18n } from "discourse-i18n";import ComboBox from "select-kit/components/combo-box";@@ -40,8 +41,7 @@ export default class RemindAssignsFrequency extends Component {@valueProperty="value"@content={{this.availableFrequencies}}@value={{this.selectedFrequency}}- {{! template-lint-disable no-action }}- @onChange={{action+ @onChange={{fn(mut this.user.custom_fields.remind_assigns_frequency)}}/>diff --git a/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-notifications/remind-assigns-frequency.gjs b/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-notifications/remind-assigns-frequency.gjsindex c27e0302f8b..7dbb1c8770a 100644--- a/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-notifications/remind-assigns-frequency.gjs+++ b/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-notifications/remind-assigns-frequency.gjs@@ -1,13 +1,13 @@import Component from "@ember/component";import { classNames, tagName } from "@ember-decorators/component";-import RemindAssignsFrequency0 from "../../components/remind-assigns-frequency";+import RemindAssignsFrequency from "../../components/remind-assigns-frequency";@tagName("div")@classNames("user-preferences-notifications-outlet", "remind-assigns-frequency")-export default class RemindAssignsFrequency extends Component {+export default class RemindAssignsFrequencyConnector extends Component {static shouldRender(args, context) {return context.currentUser?.can_assign;}- <template><RemindAssignsFrequency0 @user={{this.model}} /></template>+ <template><RemindAssignsFrequency @user={{this.model}} /></template>}diff --git a/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjs b/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjsindex 8c4553abd27..cd7bf3816de 100644--- a/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjs+++ b/plugins/discourse-assign/assets/javascripts/discourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjs@@ -1,4 +1,5 @@import Component from "@glimmer/component";+import { fn } from "@ember/helper";import { service } from "@ember/service";import { i18n } from "discourse-i18n";import ComboBox from "select-kit/components/combo-box";@@ -42,8 +43,7 @@ export default class NotificationLevelWhenAssigned extends Component {@content={{this.notificationLevelsWhenAssigned}}@value={{@outletArgs.model.user_option.notification_level_when_assigned}}@valueProperty="value"- {{! template-lint-disable no-action }}- @onChange={{action+ @onChange={{fn(mut @outletArgs.model.user_option.notification_level_when_assigned)}}/>diff --git a/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.js b/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.jsindex ca046722d77..379827dc982 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.js@@ -1,10 +1,7 @@-/* eslint-disable qunit/no-loose-assertions */import { click, currentURL, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- query,- queryAll,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";@@ -174,80 +171,79 @@ acceptance("Discourse Assign | user menu", function (needs) {await click(".d-header-icons .current-user button");await click("#user-menu-button-assign-list");- const notifications = queryAll(- "#quick-access-assign-list .notification.unread"- );- assert.strictEqual(- notifications.length,- 1,- "there is one unread notification"- );- assert.true(- notifications[0].classList.contains("unread"),- "the notification is unread"- );- assert.true(- notifications[0].classList.contains("assigned"),- "the notification is of type assigned"- );+ assert+ .dom("#quick-access-assign-list .notification.unread")+ .exists({ count: 1 }, "there is one unread notification");+ assert+ .dom("#quick-access-assign-list .notification.unread")+ .hasClass("assigned", "the notification is of type assigned");- const assigns = queryAll("#quick-access-assign-list .assigned");- assert.strictEqual(assigns.length, 2, "there are 2 assigns");+ assert+ .dom("#quick-access-assign-list .assigned")+ .exists({ count: 2 }, "there are 2 assigns");- const userAssign = assigns[0];- const groupAssign = assigns[1];- assert.ok(- userAssign.querySelector(".d-icon-user-plus"),- "user assign has the right icon"- );- assert.ok(- groupAssign.querySelector(".d-icon-group-plus"),- "group assign has the right icon"- );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(1) .d-icon-user-plus")+ .exists("user assign has the right icon");+ assert+ .dom(+ "#quick-access-assign-list .assigned:nth-child(2) .d-icon-group-plus"+ )+ .exists("group assign has the right icon");- assert.true(- userAssign- .querySelector("a")- .href.endsWith("/t/test-poll-topic-please-bear-with-me/227"),- "user assign links to the assigned topic"- );- assert.true(- groupAssign- .querySelector("a")- .href.endsWith("/t/test-poll-topic-please-bear-with-me-2/228"),- "group assign links to the assigned topic"- );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(1) a")+ .hasAttribute(+ "href",+ /\/t\/test-poll-topic-please-bear-with-me\/227$/,+ "user assign links to the assigned topic"+ );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(2) a")+ .hasAttribute(+ "href",+ /\/t\/test-poll-topic-please-bear-with-me-2\/228$/,+ "group assign links to the assigned topic"+ );- assert.strictEqual(- userAssign.textContent.trim(),- "Test poll topic please bear with me",- "user assign contains the topic title"- );- assert.ok(- userAssign.querySelector(".item-description img.emoji"),- "emojis are rendered in user assign"- );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(1)")+ .hasText(+ "Test poll topic please bear with me",+ "user assign contains the topic title"+ );+ assert+ .dom(+ "#quick-access-assign-list .assigned:nth-child(1) .item-description img.emoji"+ )+ .exists("emojis are rendered in user assign");- assert.strictEqual(- groupAssign.textContent.trim().replaceAll(/\s+/g, " "),- "Team Test poll topic please bear with me 2",- "group assign contains the topic title"- );- assert.ok(- groupAssign.querySelector(".item-description img.emoji"),- "emojis are rendered in group assign"- );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(2)")+ .hasText(+ "Team Test poll topic please bear with me 2",+ "group assign contains the topic title"+ );+ assert+ .dom(+ "#quick-access-assign-list .assigned:nth-child(2) .item-description img.emoji"+ )+ .exists("emojis are rendered in group assign");- assert.strictEqual(- userAssign.querySelector("a").title,- i18n("user.assigned_to_you.topic"),- "user assign has the right title"- );- assert.strictEqual(- groupAssign.querySelector("a").title,- i18n("user.assigned_to_group.topic", { group_name: "Team" }),- "group assign has the right title"- );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(1) a")+ .hasAttribute(+ "title",+ i18n("user.assigned_to_you.topic"),+ "user assign has the right title"+ );+ assert+ .dom("#quick-access-assign-list .assigned:nth-child(2) a")+ .hasAttribute(+ "title",+ i18n("user.assigned_to_group.topic", { group_name: "Team" }),+ "group assign has the right title"+ );});test("dismiss button", async function (assert) {@@ -261,13 +257,12 @@ acceptance("Discourse Assign | user menu", function (needs) {await click(".notifications-dismiss");assert.false(markRead, "mark-read request isn't sent");- assert.strictEqual(- query(- ".dismiss-notification-confirmation .d-modal__body"- ).textContent.trim(),- i18n("notifications.dismiss_confirmation.body.assigns", { count: 173 }),- "dismiss confirmation modal is shown"- );+ assert+ .dom(".dismiss-notification-confirmation .d-modal__body")+ .hasText(+ i18n("notifications.dismiss_confirmation.body.assigns", { count: 173 }),+ "dismiss confirmation modal is shown"+ );await click(".d-modal__footer .btn-primary");assert.true(markRead, "mark-read request is sent");@@ -298,12 +293,13 @@ acceptance("Discourse Assign | user menu", function (needs) {assert.dom(".empty-state-body .d-icon-user-plus").exists("empty state body has user-plus icon");- assert.true(- query(".empty-state-body a").href.endsWith(- "/my/preferences/notifications"- ),- "empty state body has user-plus icon"- );+ assert+ .dom(".empty-state-body a")+ .hasAttribute(+ "href",+ /\/my\/preferences\/notifications$/,+ "empty state body has user-plus icon"+ );});test("renders the confirmation modal when dismiss assign notifications", async function (assert) {diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/admin-holidays-list-item.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/admin-holidays-list-item.gjsindex 407ad74fcb4..b46ad71d2ec 100644--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/admin-holidays-list-item.gjs+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/admin-holidays-list-item.gjs@@ -12,39 +12,57 @@ export default class AdminHolidaysListItem extends Component {isHolidayDisabled = false;@action- disableHoliday(holiday, region_code) {+ async disableHoliday() {if (this.loading) {return;}this.set("loading", true);- return ajax({- url: `/admin/discourse-calendar/holidays/disable`,- type: "POST",- data: { disabled_holiday: { holiday_name: holiday.name, region_code } },- })- .then(() => this.set("isHolidayDisabled", true))- .catch(popupAjaxError)- .finally(() => this.set("loading", false));+ try {+ await ajax({+ url: `/admin/discourse-calendar/holidays/disable`,+ type: "POST",+ data: {+ disabled_holiday: {+ holiday_name: this.holiday.name,+ region_code: this.region_code,+ },+ },+ });+ this.set("isHolidayDisabled", true);+ } catch (error) {+ popupAjaxError(error);+ } finally {+ this.set("loading", false);+ }}@action- enableHoliday(holiday, region_code) {+ async enableHoliday() {if (this.loading) {return;}this.set("loading", true);- return ajax({- url: `/admin/discourse-calendar/holidays/enable`,- type: "DELETE",- data: { disabled_holiday: { holiday_name: holiday.name, region_code } },- })- .then(() => this.set("isHolidayDisabled", false))- .catch(popupAjaxError)- .finally(() => this.set("loading", false));+ try {+ await ajax({+ url: `/admin/discourse-calendar/holidays/enable`,+ type: "DELETE",+ data: {+ disabled_holiday: {+ holiday_name: this.holiday.name,+ region_code: this.region_code,+ },+ },+ });+ this.set("isHolidayDisabled", false);+ } catch (error) {+ popupAjaxError(error);+ } finally {+ this.set("loading", false);+ }}<template>@@ -53,14 +71,12 @@ export default class AdminHolidaysListItem extends Component {<td>{{#if this.isHolidayDisabled}}<DButton- {{! template-lint-disable no-action }}- @action={{action "enableHoliday" this.holiday this.region_code}}+ @action={{this.enableHoliday}}@label="discourse_calendar.enable_holiday"/>{{else}}<DButton- {{! template-lint-disable no-action }}- @action={{action "disableHoliday" this.holiday this.region_code}}+ @action={{this.disableHoliday}}@label="discourse_calendar.disable_holiday"/>{{/if}}diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/bulk-invite-sample-csv-file.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/bulk-invite-sample-csv-file.gjsindex b18ddd14211..dd5dce5760e 100644--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/bulk-invite-sample-csv-file.gjs+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/bulk-invite-sample-csv-file.gjs@@ -29,8 +29,7 @@ export default class BulkInviteSampleCsvFile extends Component {<template><DButton@label="discourse_post_event.bulk_invite_modal.download_sample_csv"- {{! template-lint-disable no-action }}- @action={{action "downloadSampleCsv"}}+ @action={{this.downloadSampleCsv}}/></template>}diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.jsindex b69ffc2523a..e5303927fe9 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.js@@ -1,7 +1,6 @@-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";const eventsPretender = (server, helper) => {server.get("/discourse-post-event/events", () => {@@ -43,18 +42,16 @@ acceptance(needs.pretender(eventsPretender);- test("don't display calendars if outlet option is none", async (assert) => {+ test("don't display calendars if outlet option is none", async function (assert) {await visit("/c/bug/1");- assert.notOk(- exists("#category-events-calendar"),- "Category Events calendar div does not exist"- );+ assert+ .dom("#category-events-calendar")+ .doesNotExist("Category Events calendar div does not exist");- assert.notOk(- exists(".category-calendar"),- "Category calendar div does not exist."- );+ assert+ .dom(".category-calendar")+ .doesNotExist("Category calendar div does not exist");});});@@ -73,18 +70,16 @@ acceptance(needs.pretender(eventsPretender);- test("display the specific calendar for the discovery-list-container-top outlet", async (assert) => {+ test("display the specific calendar for the discovery-list-container-top outlet", async function (assert) {await visit("/c/bug/1");- assert.ok(- exists("#category-events-calendar"),- "Category Events calendar div exists"- );+ assert+ .dom("#category-events-calendar")+ .exists("Category Events calendar div exists");- assert.notOk(- exists(".category-calendar"),- "Category calendar div does not exist."- );+ assert+ .dom(".category-calendar")+ .doesNotExist("Category calendar div does not exist");});});@@ -103,15 +98,14 @@ acceptance(needs.pretender(eventsPretender);- test("display the specific calendar for before-topic-list-body outlet", async (assert) => {+ test("display the specific calendar for before-topic-list-body outlet", async function (assert) {await visit("/c/bug/1");- assert.notOk(- exists("#category-events-calendar"),- "Category Events calendar div does not exist"- );+ assert+ .dom("#category-events-calendar")+ .doesNotExist("Category Events calendar div does not exist");- assert.ok(exists(".category-calendar"), "Category calendar div exists.");+ assert.dom(".category-calendar").exists("Category calendar div exists");});});diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.jsindex d40d22f6998..b3a9e8772fb 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.js@@ -1,8 +1,6 @@-/* eslint-disable qunit/no-loose-assertions */-/* eslint-disable qunit/no-assert-equal */import { visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";acceptance("Discourse Calendar - Category Events Calendar", function (needs) {@@ -126,7 +124,7 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) {});});- test("event name is escaped correctly", async (assert) => {+ test("event name is escaped correctly", async function (assert) {await visit("/c/bug/1");assert@@ -137,7 +135,7 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) {);});- test("events display the color configured in the map_events_to_color site setting", async (assert) => {+ test("events display the color configured in the map_events_to_color site setting", async function (assert) {await visit("/c/bug/1");assert@@ -153,7 +151,7 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) {});});- test("shows event calendar on category page", async (assert) => {+ test("shows event calendar on category page", async function (assert) {await visit("/c/bug/1?foobar=true");assert@@ -162,13 +160,15 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) {assert.dom(".fc-view-container").exists("FullCalendar is loaded.");});- test("uses current locale to display calendar weekday names", async (assert) => {+ test("uses current locale to display calendar weekday names", async function (assert) {I18n.locale = "pt_BR";await visit("/c/bug/1");assert.deepEqual(- [...queryAll(".fc-day-header span")].map((el) => el.innerText),+ [...document.querySelectorAll(".fc-day-header span")].map(+ (el) => el.innerText+ ),["seg.", "ter.", "qua.", "qui.", "sex.", "sáb.", "dom."],"Week days are translated in the calendar header");@@ -176,21 +176,21 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) {I18n.locale = "en";});- test("event calendar shows recurrent events", async (assert) => {+ test("event calendar shows recurrent events", async function (assert) {await visit("/c/bug/1");- const [first, second] = queryAll(".fc-event .fc-title");+ const [first, second] = [...document.querySelectorAll(".fc-event")];- assert.equal(first.textContent, "Awesome Event");- assert.equal(second.textContent, "Awesome Event");+ assert.dom(".fc-title", first).hasText("Awesome Event");+ assert.dom(".fc-title", second).hasText("Awesome Event");const firstCell = first.closest("td");const secondCell = second.closest("td");- assert.notEqual(+ assert.notStrictEqual(firstCell,secondCell,- "events should be in different days"+ "events are in different days");});});diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.jsindex 5ff832f5439..582dc81a05e 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.js@@ -1,13 +1,7 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";import { test } from "qunit";import { tomorrow, twoDays } from "discourse/lib/time-utils";-import {- acceptance,- exists,- queryAll,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("Discourse Calendar - Upcoming Events Calendar", function (needs) {needs.site({@@ -15,7 +9,7 @@ acceptance("Discourse Calendar - Upcoming Events Calendar", function (needs) {{id: 1,name: "Category 1",- slug: "caetgory-1",+ slug: "category-1",color: "0f78be",},{@@ -87,47 +81,49 @@ acceptance("Discourse Calendar - Upcoming Events Calendar", function (needs) {});});- test("shows upcoming events calendar", async (assert) => {+ test("shows upcoming events calendar", async function (assert) {await visit("/upcoming-events");- assert.ok(- exists("#upcoming-events-calendar"),- "Upcoming Events calendar is shown."- );+ assert+ .dom("#upcoming-events-calendar")+ .exists("Upcoming Events calendar is shown");- assert.ok(exists(".fc-view-container"), "FullCalendar is loaded.");+ assert.dom(".fc-view-container").exists("FullCalendar is loaded");});- test("upcoming events category colors", async (assert) => {+ test("upcoming events category colors", async function (assert) {await visit("/upcoming-events");- assert.strictEqual(- queryAll(".fc-event")[0].style.backgroundColor,- "rgb(190, 10, 10)",- "Event item uses the proper color from category 1"- );+ const [first, second] = [...document.querySelectorAll(".fc-event")];+ assert+ .dom(first)+ .hasStyle(+ { backgroundColor: "rgb(190, 10, 10)" },+ "Event item uses the proper color from category 1"+ );- assert.strictEqual(- queryAll(".fc-event")[1].style.backgroundColor,- "rgb(15, 120, 190)",- "Event item uses the proper color from category 2"- );+ assert+ .dom(second)+ .hasStyle(+ { backgroundColor: "rgb(15, 120, 190)" },+ "Event item uses the proper color from category 2"+ );});- test("upcoming events calendar shows recurrent events", async (assert) => {+ test("upcoming events calendar shows recurrent events", async function (assert) {await visit("/upcoming-events");- const [, first, second] = queryAll(".fc-event .fc-title");- assert.equal(first.textContent, "Awesome Event");- assert.equal(second.textContent, "Awesome Event");+ const [, second, third] = [...document.querySelectorAll(".fc-event")];+ assert.dom(".fc-title", second).hasText("Awesome Event");+ assert.dom(".fc-title", third).hasText("Awesome Event");- const firstCell = first.closest("td");const secondCell = second.closest("td");+ const thirdCell = third.closest("td");- assert.notEqual(- firstCell,+ assert.notStrictEqual(secondCell,- "events should be in different days"+ thirdCell,+ "events are in different days");});});diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/explorer-schema.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/explorer-schema.gjsindex fcbb9260f32..70c2bf8ee52 100644--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/explorer-schema.gjs+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/explorer-schema.gjs@@ -5,6 +5,7 @@ import { action } from "@ember/object";import { isBlank, isEmpty } from "@ember/utils";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import DButton from "discourse/components/d-button";+import withEventValue from "discourse/helpers/with-event-value";import { debounce } from "discourse/lib/decorators";import OneTable from "./explorer-schema/one-table";@@ -152,8 +153,7 @@ export default class ExplorerSchema extends Component {<div class="schema-search inline-form full-width"><inputtype="text"- {{! template-lint-disable no-action }}- {{on "input" (action "filterChanged" value="target.value")}}+ {{on "input" (withEventValue this.filterChanged)}}/><DButton@action={{this.collapseSchema}}diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/json.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/json.gjsindex 5ed68dc931b..56b90921019 100644--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/json.gjs+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/result-types/json.gjs@@ -35,8 +35,7 @@ export default class Json extends Component {<div class="result-json-value">{{@ctx.value}}</div><DButtonclass="result-json-button"- {{! template-lint-disable no-action }}- @action={{action "viewJson"}}+ @action={{this.viewJson}}@icon="ellipsis"@title="explorer.view_json"/>diff --git a/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.js b/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.jsindex acb301be517..48cf2b4749d 100644--- a/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.js+++ b/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.js@@ -1,4 +1,3 @@-/* eslint-disable qunit/no-loose-assertions */import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import sinon from "sinon";@@ -303,15 +302,18 @@ acceptance("Data Explorer Plugin | Run Query", function (needs) {appendChildStub.restore();removeChildStub.restore();- assert.ok(window.open.called, "window.open was called for downloading");- assert.ok(formStub.called, "form was created for downloading");- assert.ok(formElement.submit.called, "form was submitted for downloading");+ assert.true(window.open.called, "window.open was called for downloading");+ assert.true(formStub.called, "form was created for downloading");+ assert.true(+ formElement.submit.called,+ "form was submitted for downloading"+ );- assert.ok(+ assert.true(formElement.setAttribute.calledWith("action"),"form action attribute was set");- assert.ok(+ assert.true(formElement.setAttribute.calledWith("method", "post"),"form method attribute was set to POST");diff --git a/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/recalculate-scores-form.gjs b/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/recalculate-scores-form.gjsindex 795f04ab134..39d62812c55 100644--- a/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/recalculate-scores-form.gjs+++ b/plugins/discourse-gamification/assets/javascripts/discourse/components/modal/recalculate-scores-form.gjs@@ -1,5 +1,6 @@import Component from "@glimmer/component";import { tracked } from "@glimmer/tracking";+import { fn } from "@ember/helper";import { action } from "@ember/object";import { service } from "@ember/service";import { eq } from "truth-helpers";@@ -155,8 +156,7 @@ export default class RecalculateScoresForm extends Component {@valueProperty="value"@content={{this.updateRange}}@value={{this.updateRangeValue}}- {{! template-lint-disable no-action }}- @onChange={{action (mut this.updateRangeValue)}}+ @onChange={{fn (mut this.updateRangeValue)}}/>{{#if (eq this.updateRangeValue 5)}}@@ -166,8 +166,7 @@ export default class RecalculateScoresForm extends Component {@id="custom-from-date"@placeholder="yyyy-mm-dd"@value={{this.recalculateFromDate}}- {{! template-lint-disable no-action }}- @onSelect={{action (mut this.recalculateFromDate)}}+ @onSelect={{fn (mut this.recalculateFromDate)}}class="date-input"/></div>diff --git a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjsindex 6be6782ae4c..ce83823929c 100644--- a/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs+++ b/plugins/discourse-patreon/assets/javascripts/discourse/connectors/admin-user-details/patreon.gjs@@ -21,22 +21,27 @@ export default class Patreon extends Component {}@action- checkPatreonEmail(user) {- ajax(userPath(`${user.username_lower}/patreon_email.json`), {- data: {- context: window.location.pathname,- },- }).then((result) => {- if (result) {- const email = result.email;- let url = "https://patreon.com/members";- if (email) {- url = `${url}?query=${email}`;- }- this.set("patreon_email", email);- this.set("patron_url", url);+ async checkPatreonEmail() {+ const result = await ajax(+ userPath(`${this.model.username_lower}/patreon_email.json`),+ {+ data: {+ context: window.location.pathname,+ },}- });+ );++ if (result) {+ const email = result.email;++ let url = "https://patreon.com/members";+ if (email) {+ url = `${url}?query=${email}`;+ }++ this.set("patreon_email", email);+ this.set("patron_url", url);+ }}<template>@@ -54,8 +59,7 @@ export default class Patreon extends Component {{{this.patreon_email}}{{else}}<DButton- {{! template-lint-disable no-action }}- @action={{action "checkPatreonEmail" this.model}}+ @action={{this.checkPatreonEmail}}@icon="far-envelope"@label="admin.users.check_email.text"@title="admin.users.check_email.title"diff --git a/plugins/discourse-policy/test/javascripts/acceptance/policy-test.js b/plugins/discourse-policy/test/javascripts/acceptance/policy-test.jsindex 900acce4fc6..b27045fe19c 100644--- a/plugins/discourse-policy/test/javascripts/acceptance/policy-test.js+++ b/plugins/discourse-policy/test/javascripts/acceptance/policy-test.js@@ -1,5 +1,3 @@-/* eslint-disable qunit/no-loose-assertions */-/* eslint-disable qunit/no-assert-equal */import { click, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";import { cloneJSON } from "discourse/lib/object";@@ -58,7 +56,7 @@ acceptance("Discourse Policy - post", function (needs) {let raw = document.querySelector("textarea.d-editor-input").value;- assert.equal(+ assert.strictEqual(raw.trim(),'[policy reminder="daily" version="1" groups="staff"]\nI accept this policy\n[/policy]');diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.jsindex af2aa2d7347..e1e7b6da0d6 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.js@@ -1,8 +1,7 @@-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";-import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";+import ReactionsTopics from "../fixtures/reactions-topic-fixtures";acceptance("Discourse Reactions - Deleted post", function (needs) {needs.user();@@ -19,12 +18,11 @@ acceptance("Discourse Reactions - Deleted post", function (needs) {server.get(topicPath, () => helper.response(ReactionsTopics[topicPath]));});- test("Reaction controls", async (assert) => {+ test("Reaction controls", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.notOk(- exists("#post_4 .discourse-reactions-actions"),- "reaction controls are not shown"- );+ assert+ .dom("#post_4 .discourse-reactions-actions")+ .doesNotExist("reaction controls are not shown");});});diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.jsindex c30c608e953..471b5134e73 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.js@@ -1,8 +1,7 @@-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";-import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";+import ReactionsTopics from "../fixtures/reactions-topic-fixtures";["enabled", "disabled"].forEach((postStreamMode) => {acceptance(@@ -22,13 +21,12 @@ import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures);});- test("Does not show reactions controls", async (assert) => {+ test("Does not show reactions controls", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.notOk(- exists(".discourse-reactions-actions"),- "reactions controls are not shown"- );+ assert+ .dom(".discourse-reactions-actions")+ .doesNotExist("reactions controls are not shown");});});diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.jsindex 363bdfd9468..e794dbc6b0c 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.js@@ -1,8 +1,7 @@-/* eslint-disable qunit/no-loose-assertions */import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";-import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";+import ReactionsTopics from "../fixtures/reactions-topic-fixtures";["enabled", "disabled"].forEach((postStreamMode) => {acceptance(@@ -25,13 +24,12 @@ import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures);});- test("It shows reactions controls", async (assert) => {+ test("It shows reactions controls", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.ok(- exists(".discourse-reactions-actions"),- "reaction controls are available"- );+ assert+ .dom(".discourse-reactions-actions")+ .exists("reaction controls are available");});});@@ -54,7 +52,7 @@ import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures);});- test("It shows reactions controls", async (assert) => {+ test("It shows reactions controls", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");await click(".actions button.btn-toggle-reaction-like");diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.jsindex 91d45f16996..3f6f5d3cb4d 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.js@@ -1,7 +1,6 @@-/* eslint-disable qunit/no-loose-assertions */import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";acceptance("Discourse Reactions - Notifications", function (needs) {@@ -140,106 +139,107 @@ acceptance("Discourse Reactions - Notifications", function (needs) {});});- test("reaction notifications", async (assert) => {+ test("reaction notifications", async function (assert) {await visit("/");await click(".d-header-icons .current-user button");- const notifications = queryAll(- "#quick-access-all-notifications ul li.notification.reaction a"- );+ assert+ .dom("#quick-access-all-notifications ul li.notification.reaction a")+ .exists({ count: 5 });- assert.strictEqual(notifications.length, 5);+ assert+ .dom("li.notification.reaction:nth-child(1) a")+ .hasText(+ "krus Topic with one reaction from a user",+ "notification for one like from one user has the right content"+ );+ assert+ .dom("li.notification.reaction:nth-child(1) a")+ .hasAttribute(+ "href",+ /\/t\/topic-with-one-reaction-from-a-user\/8432\/12$/,+ "notification for one like from one user links to the topic"+ );+ assert+ .dom("li.notification.reaction:nth-child(1) a .d-icon-heart")+ .exists("notification for one like from one user has heart icon");- assert.strictEqual(- notifications[0].textContent.replaceAll(/\s+/g, " ").trim(),- "krus Topic with one reaction from a user",- "notification for one like from one user has the right content"- );- assert.ok(- notifications[0].href.endsWith(- "/t/topic-with-one-reaction-from-a-user/8432/12"- ),- "notification for one like from one user links to the topic"- );- assert.ok(- notifications[0].querySelector(".d-icon-heart"),- "notification for one like from one user has heart icon"- );-- assert.strictEqual(- notifications[1].textContent.replaceAll(/\s+/g, " ").trim(),+ assert.dom("li.notification.reaction:nth-child(2) a").hasText(`${i18n("notifications.reaction_2_users", {username: "jammed-radio",username2: "broken-radio",})} Topic with 2 likes (total) from 2 users`,"notification for 2 likes from 2 users has the right content");- assert.ok(- notifications[1].href.endsWith(- "/t/topic-with-2-likes-total-from-2-users/138/3"- ),- "notification for 2 likes from 2 users links to the topic"- );- assert.ok(- notifications[1].querySelector(".d-icon-heart"),- "notification for 2 likes from 2 users has the heart icon"- );+ assert+ .dom("li.notification.reaction:nth-child(2) a")+ .hasAttribute(+ "href",+ /\/t\/topic-with-2-likes-total-from-2-users\/138\/3$/,+ "notification for 2 likes from 2 users links to the topic"+ );+ assert+ .dom("li.notification.reaction:nth-child(2) a .d-icon-heart")+ .exists("notification for 2 likes from 2 users has the heart icon");- assert.strictEqual(- notifications[2].textContent.replaceAll(/\s+/g, " ").trim(),+ assert.dom("li.notification.reaction:nth-child(3) a").hasText(`${i18n("notifications.reaction_multiple_users", {username: "jam-and-cheese",count: 2,})} Topic with likes from multiple users`,"notification for likes from 3 or more users has the right content");- assert.ok(- notifications[2].href.endsWith(- "/t/topic-with-likes-from-multiple-users/832/31"- ),- "notification for likes from 3 or more users links to the topic"- );- assert.ok(- notifications[2].querySelector(".d-icon-heart"),- "notification for 2 likes from 3 or more users has the heart icon"- );+ assert+ .dom("li.notification.reaction:nth-child(3) a")+ .hasAttribute(+ "href",+ /\/t\/topic-with-likes-from-multiple-users\/832\/31$/,+ "notification for likes from 3 or more users links to the topic"+ );+ assert+ .dom("li.notification.reaction:nth-child(3) a .d-icon-heart")+ .exists(+ "notification for 2 likes from 3 or more users has the heart icon"+ );- assert.strictEqual(- notifications[3].textContent.replaceAll(/\s+/g, " ").trim(),+ assert.dom("li.notification.reaction:nth-child(4) a").hasText(`${i18n("notifications.reaction_multiple_users", {username: "nuclear-reactor",count: 3,})} Topic with likes and reactions`,"notification for reactions from 3 or more users has the right content");- assert.ok(- notifications[3].href.endsWith(- "/t/topic-with-likes-and-reactions/913/31"- ),- "notification for reactions from 3 or more users links to the topic"- );- assert.ok(- notifications[3].querySelector(".d-icon-discourse-emojis"),- "notification for 2 reactions from 3 or more users has the emojis icon"- );+ assert+ .dom("li.notification.reaction:nth-child(4) a")+ .hasAttribute(+ "href",+ /\/t\/topic-with-likes-and-reactions\/913\/31$/,+ "notification for reactions from 3 or more users links to the topic"+ );+ assert+ .dom("li.notification.reaction:nth-child(4) a .d-icon-discourse-emojis")+ .exists(+ "notification for 2 reactions from 3 or more users has the emojis icon"+ );- assert.strictEqual(- notifications[4].textContent.replaceAll(/\s+/g, " ").trim(),+ assert.dom("li.notification.reaction:nth-child(5) a").hasText(`johnny ${i18n("notifications.reaction_1_user_multiple_posts", {count: 2,})}`,"notification for reactions from 1 users on multiple posts has the right content");- assert.ok(- notifications[4].href.endsWith(- "/u/eviltrout/notifications/reactions-received?acting_username=johnny&include_likes=true"- ),- "notification for reactions from 1 users on multiple posts links the reactions-received page of the user"- );- assert.ok(- notifications[4].querySelector(".d-icon-discourse-emojis"),- "notification for reactions from 1 users on multiple posts has the emojis icon"- );+ assert+ .dom("li.notification.reaction:nth-child(5) a")+ .hasAttribute(+ "href",+ /\/u\/eviltrout\/notifications\/reactions-received\?acting_username=johnny&include_likes=true$/,+ "notification for reactions from 1 users on multiple posts links the reactions-received page of the user"+ );+ assert+ .dom("li.notification.reaction:nth-child(5) a .d-icon-discourse-emojis")+ .exists(+ "notification for reactions from 1 users on multiple posts has the emojis icon"+ );});});diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.jsindex 45d26c4427d..4a26976988f 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.js@@ -1,13 +1,7 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";-import { skip, test } from "qunit";-import {- acceptance,- exists,- queryAll,-} from "discourse/tests/helpers/qunit-helpers";-import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";+import { test } from "qunit";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";+import ReactionsTopics from "../fixtures/reactions-topic-fixtures";["enabled", "disabled"].forEach((postStreamMode) => {acceptance(@@ -30,108 +24,78 @@ import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures);});- test("Reactions count", async (assert) => {+ test("Reactions count", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.equal(- queryAll(- "#post_1 .discourse-reactions-counter .reactions-counter"- ).text(),- 209,- "it displays the correct count"- );- });-- skip("Reactions list", async (assert) => {- const reactions = [];- const expectedSequence =- "heart|angry|laughing|open_mouth|cry|thumbsdown|nose:t2|thumbsup";-- await visit("/t/topic_with_reactions_and_likes/374");-- queryAll(- "#post_1 .discourse-reactions-counter .discourse-reactions-list .reactions .discourse-reactions-list-emoji"- ).map((index, currentValue) => {- reactions.push(currentValue.innerText);- });-- assert.equal(- reactions.join("|"),- expectedSequence,- "it displays the correct list sorted by count"- );+ assert+ .dom("#post_1 .discourse-reactions-counter .reactions-counter")+ .hasText("209", "displays the correct count");});- test("Other user post", async (assert) => {+ test("Other user post", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.ok(- exists("#post_2 .discourse-reactions-reaction-button"),- "it displays the reaction button"- );+ assert+ .dom("#post_2 .discourse-reactions-reaction-button")+ .exists("displays the reaction button");});- test("Post is yours", async (assert) => {+ test("Post is yours", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.notOk(- exists("#post_1 .discourse-reactions-reaction-button"),- "it does not display the reaction button"- );+ assert+ .dom("#post_1 .discourse-reactions-reaction-button")+ .doesNotExist("does not display the reaction button");});- test("Post has only likes (no reactions)", async (assert) => {+ test("Post has only likes (no reactions)", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.ok(- exists("#post_3 .discourse-reactions-double-button"),- "it displays the reaction count beside the reaction button"- );+ assert+ .dom("#post_3 .discourse-reactions-double-button")+ .exists("displays the reaction count beside the reaction button");});- test("Post has likes and reactions", async (assert) => {+ test("Post has likes and reactions", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.notOk(- exists("#post_1 .discourse-reactions-double-button"),- "it does not display the reaction count beside the reaction button"- );+ assert+ .dom("#post_1 .discourse-reactions-double-button")+ .doesNotExist(+ "does not display the reaction count beside the reaction button"+ );});- test("Current user has no reaction on post and can toggle", async (assert) => {+ test("Current user has no reaction on post and can toggle", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.ok(- exists("#post_2 .discourse-reactions-actions.can-toggle-reaction"),- "it allows to toggle the reaction"- );+ assert+ .dom("#post_2 .discourse-reactions-actions.can-toggle-reaction")+ .exists("allows to toggle the reaction");});- test("Current user has no reaction on post and can toggle", async (assert) => {+ test("Current user has no reaction on post and can toggle", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.ok(- exists("#post_2 .discourse-reactions-actions.can-toggle-reaction"),- "it allows to toggle the reaction"- );+ assert+ .dom("#post_2 .discourse-reactions-actions.can-toggle-reaction")+ .exists("allows to toggle the reaction");});- test("Current user can undo on post and can toggle", async (assert) => {+ test("Current user can undo on post and can toggle", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.ok(- exists("#post_3 .discourse-reactions-actions.can-toggle-reaction"),- "it allows to toggle the reaction"- );+ assert+ .dom("#post_3 .discourse-reactions-actions.can-toggle-reaction")+ .exists("allows to toggle the reaction");});- test("Current user can't toggle", async (assert) => {+ test("Current user can't toggle", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");- assert.notOk(- exists("#post_1 .discourse-reactions-actions.can-toggle-reaction"),- "it doesn’t allow to toggle the reaction"- );+ assert+ .dom("#post_1 .discourse-reactions-actions.can-toggle-reaction")+ .doesNotExist("doesn’t allow to toggle the reaction");});});diff --git a/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjs b/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjsindex 89325d3b812..5f7075a8fa2 100644--- a/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjs+++ b/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjs@@ -1,7 +1,9 @@import Component from "@ember/component";+import { fn } from "@ember/helper";import { on } from "@ember/modifier";import { action } from "@ember/object";import { classNames, tagName } from "@ember-decorators/component";+import withEventValue from "discourse/helpers/with-event-value";import { i18n } from "discourse-i18n";@tagName("")@@ -23,8 +25,10 @@ export default class SolvedSettings extends Component {<div class="enable-accepted-answer"><label class="checkbox-label"><input- {{! template-lint-disable no-action }}- {{on "change" (action "onChangeSetting" value="target.checked")}}+ {{on+ "change"+ (withEventValue this.onChangeSetting "target.checked")+ }}checked={{this.category.enable_accepted_answers}}type="checkbox"/>@@ -39,12 +43,12 @@ export default class SolvedSettings extends Component {{{i18n "solved.solved_topics_auto_close_hours"}}</label><input- {{! template-lint-disable no-action }}{{on"input"- (action- (mut this.category.custom_fields.solved_topics_auto_close_hours)- value="target.value"+ (withEventValue+ (fn+ (mut this.category.custom_fields.solved_topics_auto_close_hours)+ ))}}value={{this.category.custom_fields.solved_topics_auto_close_hours}}diff --git a/plugins/discourse-subscriptions/test/javascripts/acceptance/payments-test.js b/plugins/discourse-subscriptions/test/javascripts/acceptance/payments-test.jsindex 90611320cd4..a0a6b14175f 100644--- a/plugins/discourse-subscriptions/test/javascripts/acceptance/payments-test.js+++ b/plugins/discourse-subscriptions/test/javascripts/acceptance/payments-test.js@@ -1,7 +1,6 @@-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";acceptance("Subscriptions", function (needs) {@@ -13,7 +12,7 @@ acceptance("Subscriptions", function (needs) {test("viewing product page", async function (assert) {await visit("/s");- assert.ok(count(".product-list") > 0, "has product page");- assert.ok(count(".product:first-child a") > 0, "has a link");+ assert.dom(".product-list").exists("has product page");+ assert.dom(".product:first-child a").exists("has a link");});});diff --git a/plugins/discourse-subscriptions/test/javascripts/acceptance/subscribe-test.js b/plugins/discourse-subscriptions/test/javascripts/acceptance/subscribe-test.jsindex 25b858207c3..9bb3726d8b6 100644--- a/plugins/discourse-subscriptions/test/javascripts/acceptance/subscribe-test.js+++ b/plugins/discourse-subscriptions/test/javascripts/acceptance/subscribe-test.js@@ -1,9 +1,7 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import pretender, { response } from "discourse/tests/helpers/create-pretender";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";@@ -32,15 +30,11 @@ acceptance("Subscriptions", function (needs) {await visit("/s");await click(".product:first-child a");- assert.ok(- count(".discourse-subscriptions-section-columns") > 0,- "has the sections for billing"- );+ assert+ .dom(".discourse-subscriptions-section-columns")+ .exists("has the sections for billing");- assert.ok(- count(".subscribe-buttons button") > 0,- "has buttons for subscribe"- );+ assert.dom(".subscribe-buttons button").exists("has buttons for subscribe");});test("skips products list on sites with one product", async function (assert) {@@ -55,12 +49,12 @@ acceptance("Subscriptions", function (needs) {// In YAML `NO:` is a boolean, so we need quotes around `"NO":`.test("Norway is translated correctly", async function (assert) {- assert.equal(+ assert.strictEqual(i18n("discourse_subscriptions.subscribe.countries.NO"),"Norway");- assert.equal(+ assert.strictEqual(i18n("discourse_subscriptions.subscribe.countries.NG"),"Nigeria");diff --git a/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.js b/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.jsindex b1cff4947d3..226592fa076 100644--- a/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.js+++ b/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.js@@ -1,5 +1,3 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { setupTest } from "ember-qunit";import { module, test } from "qunit";import formatCurrency from "discourse/plugins/discourse-subscriptions/discourse/helpers/format-currency";@@ -9,11 +7,11 @@ module("Subscriptions | Unit | Helper | format-currency", function (hooks) {test("formats USD correctly", function (assert) {const result = formatCurrency("USD", 338.2);- assert.equal(result, "$338.20", "Formats USD correctly");+ assert.strictEqual(result, "$338.20", "Formats USD correctly");});test("rounds correctly", function (assert) {const result = formatCurrency("USD", 338.289);- assert.equal(result, "$338.29", "Rounds correctly");+ assert.strictEqual(result, "$338.29", "Rounds correctly");});});diff --git a/plugins/discourse-templates/test/javascripts/acceptance/templates-test.js b/plugins/discourse-templates/test/javascripts/acceptance/templates-test.jsindex 2e36e66f49a..18f47719f8d 100644--- a/plugins/discourse-templates/test/javascripts/acceptance/templates-test.js+++ b/plugins/discourse-templates/test/javascripts/acceptance/templates-test.js@@ -1,21 +1,16 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import {click,currentURL,fillIn,+ focus,triggerKeyEvent,visit,} from "@ember/test-helpers";import { test } from "qunit";import { PLATFORM_KEY_MODIFIER } from "discourse/lib/keyboard-shortcuts";import { cloneJSON } from "discourse/lib/object";-import {- acceptance,- count,- exists,- query,-} from "discourse/tests/helpers/qunit-helpers";+import topicFixtures from "discourse/tests/fixtures/topic";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import { i18n } from "discourse-i18n";import TemplatesFixtures from "../fixtures/templates-fixtures";@@ -48,7 +43,7 @@ acceptance("discourse-templates", function (needs) {needs.pretender(templatesPretender);- test("Filtering by tags", async (assert) => {+ test("Filtering by tags", async function (assert) {await visit("/");await click("#create-topic");@@ -71,26 +66,25 @@ acceptance("discourse-templates", function (needs) {id: "cupcakes",},],- "it should filter tags in the dropdown"+ "filters tags in the dropdown");await tagDropdown.selectRowByIndex(0);- assert.equal(- count(".templates-list .template-item"),- 1,- "it should filter replies by tag"- );+ assert+ .dom(".templates-list .template-item")+ .exists({ count: 1 }, "filters replies by tag");await click("#template-item-1 .templates-apply");- assert.equal(- query(".d-editor-input").value.trim(),- "Cupcake ipsum dolor sit amet cotton candy cheesecake jelly. Candy canes sugar plum soufflé sweet roll jelly-o danish jelly muffin. I love jelly-o powder topping carrot cake toffee.",- "it should insert the template in the composer"- );+ assert+ .dom(".d-editor-input")+ .includesValue(+ "Cupcake ipsum dolor sit amet cotton candy cheesecake jelly. Candy canes sugar plum soufflé sweet roll jelly-o danish jelly muffin. I love jelly-o powder topping carrot cake toffee.",+ "inserts the template in the composer"+ );});- test("Filtering by text", async (assert) => {+ test("Filtering by text", async function (assert) {await visit("/");await click("#create-topic");@@ -99,22 +93,21 @@ acceptance("discourse-templates", function (needs) {await click(`button[title="${i18n("templates.insert_template")}"]`);await fillIn(".templates-filter-bar input.templates-filter", "test");- assert.equal(- count(".templates-list .template-item"),- 2,- "it should filter by text"- );+ assert+ .dom(".templates-list .template-item")+ .exists({ count: 2 }, "filters by text");await click("#template-item-8 .templates-apply");- assert.equal(- query(".d-editor-input").value.trim(),- "Testing testin **123**",- "it should insert the template in the composer"- );+ assert+ .dom(".d-editor-input")+ .includesValue(+ "Testing testin **123**",+ "inserts the template in the composer"+ );});- test("Replacing variables", async (assert) => {+ test("Replacing variables", async function (assert) {await visit("/");await click("#create-topic");@@ -124,14 +117,12 @@ acceptance("discourse-templates", function (needs) {await click("#template-item-9 .templates-apply");- assert.equal(- query(".d-editor-input").value.trim(),- "Hi there, regards eviltrout.",- "it should replace variables"- );+ assert+ .dom(".d-editor-input")+ .includesValue("Hi there, regards eviltrout.", "replaces variables");});- test("Navigate to source", async (assert) => {+ test("Navigate to source", async function (assert) {await visit("/");await click("#create-topic");@@ -154,23 +145,21 @@ acceptance("discourse-templates", function (needs) {id: "lorem",},],- "it should filter tags in the dropdown"+ "filters tags in the dropdown");await tagDropdown.selectRowByIndex(0);- assert.equal(- count(".templates-list .template-item"),- 1,- "it should filter replies by tag"- );+ assert+ .dom(".templates-list .template-item")+ .exists({ count: 1 }, "filters replies by tag");await click("#template-item-130 .template-item-title");await click("#template-item-130 .template-item-source-link");- assert.equal(+ assert.strictEqual(currentURL(),"/t/lorem-ipsum-dolor-sit-amet/130",- "it should navigate to the source"+ "navigates to the source");});});@@ -188,7 +177,7 @@ acceptance(needs.pretender(templatesPretender);- test("Filtering by tags", async (assert) => {+ test("Filtering by tags", async function (assert) {await visit("/");await click("#create-topic");@@ -196,10 +185,9 @@ acceptance(await click(".toolbar-menu__options-trigger");await click(`button[title="${i18n("templates.insert_template")}"]`);- assert.notOk(- exists(".templates-filter-bar .tag-drop"),- "tag drop down is not displayed"- );+ assert+ .dom(".templates-filter-bar .tag-drop")+ .doesNotExist("tag drop down is not displayed");});});@@ -224,7 +212,7 @@ acceptance("discourse-templates | keyboard shortcut", function (needs) {});};- const assertTemplateWasInserted = async (assert, textarea) => {+ const assertTemplateWasInserted = async (assert, selector) => {const tagDropdown = selectKit(".templates-filter-bar .tag-drop");await tagDropdown.expand();@@ -235,46 +223,45 @@ acceptance("discourse-templates | keyboard shortcut", function (needs) {await tagDropdown.selectRowByIndex(0);await click("#template-item-1 .templates-apply");- assert.equal(- textarea.value.trim(),- "Cupcake ipsum dolor sit amet cotton candy cheesecake jelly. Candy canes sugar plum soufflé sweet roll jelly-o danish jelly muffin. I love jelly-o powder topping carrot cake toffee.",- "it should insert the template in the textarea"- );+ assert+ .dom(selector)+ .includesValue(+ "Cupcake ipsum dolor sit amet cotton candy cheesecake jelly. Candy canes sugar plum soufflé sweet roll jelly-o danish jelly muffin. I love jelly-o powder topping carrot cake toffee.",+ "inserts the template in the textarea"+ );};test("Help | Added shortcut to help modal", async function (assert) {await visit("/");await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));- assert.ok(exists(".shortcut-category-templates"));- assert.strictEqual(count(".shortcut-category-templates li"), 1);+ assert.dom(".shortcut-category-templates").exists();+ assert.dom(".shortcut-category-templates li").exists({ count: 1 });});- test("Composer | Title field focused | Template is inserted", async (assert) => {+ test("Composer | Title field focused | Template is inserted", async function (assert) {await visit("/");await click("#create-topic");await selectCategory();- const textarea = query(".d-editor-input");await triggerKeyboardShortcut();- await assertTemplateWasInserted(assert, textarea);+ await assertTemplateWasInserted(assert, ".d-editor-input");});- test("Composer | Textarea focused | Template is inserted", async (assert) => {+ test("Composer | Textarea focused | Template is inserted", async function (assert) {await visit("/");await click("#create-topic");await selectCategory();- const textarea = query(".d-editor-input");- await textarea.focus();+ await focus(".d-editor-input");await triggerKeyboardShortcut();- await assertTemplateWasInserted(assert, textarea);+ await assertTemplateWasInserted(assert, ".d-editor-input");});- test("Modal | Templates modal | Show the modal if the preview is hidden", async (assert) => {+ test("Modal | Templates modal | Show the modal if the preview is hidden", async function (assert) {await visit("/");await click("#create-topic");@@ -282,46 +269,40 @@ acceptance("discourse-templates | keyboard shortcut", function (needs) {await click(".toggle-preview");- const textarea = query(".d-editor-input");- await textarea.focus();+ await focus(".d-editor-input");await triggerKeyboardShortcut();- assert.ok(- exists(".d-modal.d-templates"),- "It displayed the standard templates modal"- );+ assert+ .dom(".d-modal.d-templates")+ .exists("displays the standard templates modal");});- test("Modal | Templates modal | Show the modal if a textarea is focused", async (assert) => {+ test("Modal | Templates modal | Show the modal if a textarea is focused", async function (assert) {// if the text area is outside a modal then simply show the insert template modal// because there is no need to hijackawait visit("/u/charlie/preferences/profile");- const textarea = query(".d-editor-input");- await textarea.focus();+ await focus(".d-editor-input");await triggerKeyboardShortcut();- assert.ok(- exists(".d-modal.d-templates"),- "It displayed the standard templates modal"- );+ assert+ .dom(".d-modal.d-templates")+ .exists("displays the standard templates modal");});- test("Modal | Templates modal | Template is inserted", async (assert) => {+ test("Modal | Templates modal | Template is inserted", async function (assert) {await visit("/u/charlie/preferences/profile");- const textarea = query(".d-editor-input");- await textarea.focus();+ await focus(".d-editor-input");await triggerKeyboardShortcut();- await assertTemplateWasInserted(assert, textarea);+ await assertTemplateWasInserted(assert, ".d-editor-input");});- test("Modal | Templates modal | Template is inserted", async (assert) => {+ test("Modal | Templates modal | Template is inserted", async function (assert) {await visit("/u/charlie/preferences/profile");- const textarea = query(".d-editor-input");- await textarea.focus();+ await focus(".d-editor-input");await triggerKeyboardShortcut();@@ -340,65 +321,58 @@ acceptance("discourse-templates | keyboard shortcut", function (needs) {id: "lorem",},],- "it should filter tags in the dropdown"+ "filters tags in the dropdown");await tagDropdown.selectRowByIndex(0);- assert.equal(- count(".templates-list .template-item"),- 1,- "it should filter replies by tag"- );+ assert+ .dom(".templates-list .template-item")+ .exists({ count: 1 }, "filters replies by tag");await click("#template-item-130 .template-item-title");await click("#template-item-130 .template-item-source-link");- assert.equal(+ assert.strictEqual(currentURL(),"/t/lorem-ipsum-dolor-sit-amet/130",- "it should navigate to the source"+ "navigates to the source");});- test("Modal | Templates Modal | Stacked Modals | Template is inserted", async (assert) => {+ test("Modal | Templates Modal | Stacked Modals | Template is inserted", async function (assert) {await visit("/t/topic-for-group-moderators/2480");await click(".show-more-actions");await click(".show-post-admin-menu");await click(".add-notice");- const textarea = query(".d-modal__body textarea");- await textarea.focus();+ await focus(".d-modal__body textarea");await triggerKeyboardShortcut();- await assertTemplateWasInserted(assert, textarea);+ await assertTemplateWasInserted(assert, ".d-modal__body textarea");});- test("Modal | Templates Modal | Stacked Modals | Closing the template modal returns the focus to the original modal textarea", async (assert) => {+ test("Modal | Templates Modal | Stacked Modals | Closing the template modal returns the focus to the original modal textarea", async function (assert) {await visit("/t/topic-for-group-moderators/2480");await click(".show-more-actions");await click(".show-post-admin-menu");await click(".add-notice");- const textarea = query(".d-modal__body textarea");- await textarea.focus();- assert.notOk(- exists(".d-templates-modal"),- "the templates modal does not exist yet"- );+ await focus(".d-modal__body textarea");+ assert+ .dom(".d-templates-modal")+ .doesNotExist("the templates modal does not exist yet");await triggerKeyboardShortcut();- assert.ok(exists(".d-templates-modal"), "it displayed the templates modal");+ assert.dom(".d-templates-modal").exists("displays the templates modal");await click(".d-templates-modal .btn.modal-close");- assert.strictEqual(- textarea,- document.activeElement,- "it focused the original textarea again after closing the templates modal"- );+ assert+ .dom(".d-modal__body textarea")+ .isFocused(+ "focuses the original textarea again after closing the templates modal"+ );});});-import topicFixtures from "discourse/tests/fixtures/topic";-acceptance("discourse-templates - buttons on topics", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-topic-voting/test/javascripts/acceptance/user-activity-votes-test.js b/plugins/discourse-topic-voting/test/javascripts/acceptance/user-activity-votes-test.jsindex a736e71acbb..cbcb033de75 100644--- a/plugins/discourse-topic-voting/test/javascripts/acceptance/user-activity-votes-test.js+++ b/plugins/discourse-topic-voting/test/javascripts/acceptance/user-activity-votes-test.js@@ -1,8 +1,6 @@-/* eslint-disable qunit/no-assert-equal */-/* eslint-disable qunit/no-loose-assertions */import { visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";acceptance(@@ -27,18 +25,18 @@ acceptance(test("When looking at the own activity page", async function (assert) {await visit(`/u/${currentUser}/activity/votes`);- assert.equal(- query(".empty-state .empty-state__title").innerText,- i18n("topic_voting.no_votes_title_self")- );+ assert+ .dom(".empty-state .empty-state__title")+ .hasText(i18n("topic_voting.no_votes_title_self"));});test("When looking at another user's activity page", async function (assert) {await visit(`/u/${anotherUser}/activity/votes`);- assert.equal(- query(".empty-state .empty-state__title").innerText,- i18n("topic_voting.no_votes_title_others", { username: anotherUser })- );+ assert+ .dom(".empty-state .empty-state__title")+ .hasText(+ i18n("topic_voting.no_votes_title_others", { username: anotherUser })+ );});});