Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove unneeded `const self = this;` from qunit tests (#35632)

David Taylor9322a46fa4f0
diff --git a/frontend/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.gjs b/frontend/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.gjs
index a536d85613e..0b5249ac05b 100644
--- a/frontend/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.gjs
+++ b/frontend/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.gjs
@@ -7,13 +7,11 @@ module("Addons | truth-helpers | Integration | includes", function (hooks) {
setupRenderingTest(hooks);
test("when using an array", async function (assert) {
- const self = this;
-
this.foo = [1];
this.bar = 1;
await render(
<template>
- {{#if (includes self.foo self.bar)}}<span class="test"></span>{{/if}}
+ {{#if (includes this.foo this.bar)}}<span class="test"></span>{{/if}}
</template>
);
@@ -22,7 +20,7 @@ module("Addons | truth-helpers | Integration | includes", function (hooks) {
this.bar = 2;
await render(
<template>
- {{#if (includes self.foo self.bar)}}<span class="test"></span>{{/if}}
+ {{#if (includes this.foo this.bar)}}<span class="test"></span>{{/if}}
</template>
);
@@ -30,13 +28,11 @@ module("Addons | truth-helpers | Integration | includes", function (hooks) {
});
test("when using a string", async function (assert) {
- const self = this;
-
this.foo = "foo";
this.bar = "f";
await render(
<template>
- {{#if (includes self.foo self.bar)}}<span class="test"></span>{{/if}}
+ {{#if (includes this.foo this.bar)}}<span class="test"></span>{{/if}}
</template>
);
@@ -45,7 +41,7 @@ module("Addons | truth-helpers | Integration | includes", function (hooks) {
this.bar = "b";
await render(
<template>
- {{#if (includes self.foo self.bar)}}<span class="test"></span>{{/if}}
+ {{#if (includes this.foo this.bar)}}<span class="test"></span>{{/if}}
</template>
);
diff --git a/frontend/discourse/tests/integration/components/admin-plugins-list-item-test.gjs b/frontend/discourse/tests/integration/components/admin-plugins-list-item-test.gjs
index d2782d7a02d..26e75419a7e 100644
--- a/frontend/discourse/tests/integration/components/admin-plugins-list-item-test.gjs
+++ b/frontend/discourse/tests/integration/components/admin-plugins-list-item-test.gjs
@@ -23,14 +23,12 @@ module("Integration | Component | admin-plugins-list-item", function (hooks) {
}
test("settings link route", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
this.plugin = store.createRecord("admin-plugin", pluginAttrs());
await render(
- <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ <template><AdminPluginsListItem @plugin={{this.plugin}} /></template>
);
assert
@@ -42,7 +40,7 @@ module("Integration | Component | admin-plugins-list-item", function (hooks) {
this.plugin.adminRoute.use_new_show_route = true;
await render(
- <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ <template><AdminPluginsListItem @plugin={{this.plugin}} /></template>
);
assert
@@ -51,41 +49,37 @@ module("Integration | Component | admin-plugins-list-item", function (hooks) {
});
test("settings link show or hide", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
this.plugin = store.createRecord("admin-plugin", pluginAttrs());
await render(
- <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ <template><AdminPluginsListItem @plugin={{this.plugin}} /></template>
);
assert.dom(".admin-plugins-list__settings a").exists();
this.plugin.hasSettings = false;
await render(
- <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ <template><AdminPluginsListItem @plugin={{this.plugin}} /></template>
);
assert.dom(".admin-plugins-list__settings a").doesNotExist();
});
test("settings link disabled if only the enabled setting exists", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
this.plugin = store.createRecord("admin-plugin", pluginAttrs());
await render(
- <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ <template><AdminPluginsListItem @plugin={{this.plugin}} /></template>
);
assert.dom(".admin-plugins-list__settings a.disabled").doesNotExist();
this.plugin.hasOnlyEnabledSetting = true;
await render(
- <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ <template><AdminPluginsListItem @plugin={{this.plugin}} /></template>
);
assert.dom(".admin-plugins-list__settings a.disabled").exists();
});
diff --git a/frontend/discourse/tests/integration/components/admin-report-test.gjs b/frontend/discourse/tests/integration/components/admin-report-test.gjs
index db689a9020d..9b44b1b7c99 100644
--- a/frontend/discourse/tests/integration/components/admin-report-test.gjs
+++ b/frontend/discourse/tests/integration/components/admin-report-test.gjs
@@ -55,8 +55,6 @@ module("Integration | Component | admin-report", function (hooks) {
});
test("options", async function (assert) {
- const self = this;
-
this.set("options", {
table: {
perPage: 4,
@@ -68,7 +66,7 @@ module("Integration | Component | admin-report", function (hooks) {
<template>
<AdminReport
@dataSourceName="signups"
- @reportOptions={{self.options}}
+ @reportOptions={{this.options}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/badge-button-test.gjs b/frontend/discourse/tests/integration/components/badge-button-test.gjs
index 7e34e51d510..b48c34d042f 100644
--- a/frontend/discourse/tests/integration/components/badge-button-test.gjs
+++ b/frontend/discourse/tests/integration/components/badge-button-test.gjs
@@ -31,11 +31,9 @@ module("Integration | Component | badge-button", function (hooks) {
});
test("title", async function (assert) {
- const self = this;
-
this.set("badge", { description: "a <a href>good</a> run" });
- await render(<template><BadgeButton @badge={{self.badge}} /></template>);
+ await render(<template><BadgeButton @badge={{this.badge}} /></template>);
assert
.dom(".user-badge")
diff --git a/frontend/discourse/tests/integration/components/bulk-select-topics-dropdown-test.gjs b/frontend/discourse/tests/integration/components/bulk-select-topics-dropdown-test.gjs
index 8804aa356cb..87ff408149c 100644
--- a/frontend/discourse/tests/integration/components/bulk-select-topics-dropdown-test.gjs
+++ b/frontend/discourse/tests/integration/components/bulk-select-topics-dropdown-test.gjs
@@ -45,14 +45,12 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
setupRenderingTest(hooks);
test("actions all topics can perform", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.bulkSelectHelper = createBulkSelectHelper(this);
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -77,8 +75,6 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow unlisting topics that are already unlisted", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.bulkSelectHelper = createBulkSelectHelper(this, {
topicIds: [UNLISTED_TOPIC_ID],
@@ -86,7 +82,7 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -97,8 +93,6 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow relisting topics that are already visible", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.bulkSelectHelper = createBulkSelectHelper(this, {
topicIds: [REGULAR_TOPIC_ID],
@@ -106,7 +100,7 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -117,15 +111,13 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("allows deferring topics if the user has the preference enabled", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.currentUser.user_option.enable_defer = true;
this.bulkSelectHelper = createBulkSelectHelper(this);
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -136,15 +128,13 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow tagging actions if tagging_enabled is false", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.siteSettings.tagging_enabled = false;
this.bulkSelectHelper = createBulkSelectHelper(this);
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -157,13 +147,11 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow tagging actions if user cannot manage topic", async function (assert) {
- const self = this;
-
this.bulkSelectHelper = createBulkSelectHelper(this);
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -176,13 +164,11 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow deleting topics if user is not staff", async function (assert) {
- const self = this;
-
this.bulkSelectHelper = createBulkSelectHelper(this);
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -193,8 +179,6 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow unlisting or relisting PM topics", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.bulkSelectHelper = createBulkSelectHelper(this, {
topicIds: [PM_TOPIC_ID],
@@ -202,7 +186,7 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -216,8 +200,6 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("does not allow updating category for PMs", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.bulkSelectHelper = createBulkSelectHelper(this, {
topicIds: [PM_TOPIC_ID],
@@ -225,7 +207,7 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
@@ -236,8 +218,6 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
});
test("allows moving to archive and moving to inbox for PMs", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.bulkSelectHelper = createBulkSelectHelper(this, {
topicIds: [PM_TOPIC_ID],
@@ -245,7 +225,7 @@ module("Integration | Component | BulkSelectTopicsDropdown", function (hooks) {
await render(
<template>
- <BulkSelectTopicsDropdown @bulkSelectHelper={{self.bulkSelectHelper}} />
+ <BulkSelectTopicsDropdown @bulkSelectHelper={{this.bulkSelectHelper}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/char-counter-test.gjs b/frontend/discourse/tests/integration/components/char-counter-test.gjs
index 717a2eadffa..9b2914eeced 100644
--- a/frontend/discourse/tests/integration/components/char-counter-test.gjs
+++ b/frontend/discourse/tests/integration/components/char-counter-test.gjs
@@ -10,14 +10,12 @@ module("Integration | Component | char-counter", function (hooks) {
setupRenderingTest(hooks);
test("shows the number of characters", async function (assert) {
- const self = this;
-
this.value = "Hello World";
this.max = 12;
await render(
<template>
- <CharCounter @value={{self.value}} @max={{self.max}} />
+ <CharCounter @value={{this.value}} @max={{this.max}} />
</template>
);
@@ -25,15 +23,13 @@ module("Integration | Component | char-counter", function (hooks) {
});
test("updating value updates counter", async function (assert) {
- const self = this;
-
this.max = 50;
await render(
<template>
- <CharCounter @value={{self.charCounterContent}} @max={{self.max}}>
+ <CharCounter @value={{this.charCounterContent}} @max={{this.max}}>
<textarea
- {{on "input" (withEventValue (fn (mut self.charCounterContent)))}}
+ {{on "input" (withEventValue (fn (mut this.charCounterContent)))}}
></textarea>
</CharCounter>
</template>
@@ -51,14 +47,12 @@ module("Integration | Component | char-counter", function (hooks) {
});
test("exceeding max length", async function (assert) {
- const self = this;
-
this.max = 10;
this.value = "Hello World";
await render(
<template>
- <CharCounter @value={{self.value}} @max={{self.max}} />
+ <CharCounter @value={{this.value}} @max={{this.max}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/compact-list-test.gjs b/frontend/discourse/tests/integration/components/compact-list-test.gjs
index f922b407b9c..2af5d69a878 100644
--- a/frontend/discourse/tests/integration/components/compact-list-test.gjs
+++ b/frontend/discourse/tests/integration/components/compact-list-test.gjs
@@ -9,8 +9,6 @@ module("Integration | Component | compact-list site-setting", function (hooks) {
setupRenderingTest(hooks);
test("mandatory values", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -28,7 +26,7 @@ module("Integration | Component | compact-list site-setting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
const subject = selectKit(".list-setting");
diff --git a/frontend/discourse/tests/integration/components/d-button-test.gjs b/frontend/discourse/tests/integration/components/d-button-test.gjs
index deb907620c4..cd29d9fbf5e 100644
--- a/frontend/discourse/tests/integration/components/d-button-test.gjs
+++ b/frontend/discourse/tests/integration/components/d-button-test.gjs
@@ -37,12 +37,10 @@ module("Integration | Component | d-button", function (hooks) {
});
test("isLoading button", async function (assert) {
- const self = this;
-
this.set("isLoading", true);
await render(
- <template><DButton @isLoading={{self.isLoading}} /></template>
+ <template><DButton @isLoading={{this.isLoading}} /></template>
);
assert
@@ -83,11 +81,9 @@ module("Integration | Component | d-button", function (hooks) {
});
test("disabled button", async function (assert) {
- const self = this;
-
this.set("disabled", true);
- await render(<template><DButton @disabled={{self.disabled}} /></template>);
+ await render(<template><DButton @disabled={{this.disabled}} /></template>);
assert.dom("button").isDisabled();
@@ -96,15 +92,13 @@ module("Integration | Component | d-button", function (hooks) {
});
test("aria-label", async function (assert) {
- const self = this;
-
I18n.translations[I18n.locale].js.test = { fooAriaLabel: "foo" };
await render(
<template>
<DButton
- @ariaLabel={{self.ariaLabel}}
- @translatedAriaLabel={{self.translatedAriaLabel}}
+ @ariaLabel={{this.ariaLabel}}
+ @translatedAriaLabel={{this.translatedAriaLabel}}
/>
</template>
);
@@ -122,15 +116,13 @@ module("Integration | Component | d-button", function (hooks) {
});
test("title", async function (assert) {
- const self = this;
-
I18n.translations[I18n.locale].js.test = { fooTitle: "foo" };
await render(
<template>
<DButton
- @title={{self.title}}
- @translatedTitle={{self.translatedTitle}}
+ @title={{this.title}}
+ @translatedTitle={{this.translatedTitle}}
/>
</template>
);
@@ -147,15 +139,13 @@ module("Integration | Component | d-button", function (hooks) {
});
test("label", async function (assert) {
- const self = this;
-
I18n.translations[I18n.locale].js.test = { fooLabel: "foo" };
await render(
<template>
<DButton
- @label={{self.label}}
- @translatedLabel={{self.translatedLabel}}
+ @label={{this.label}}
+ @translatedLabel={{this.translatedLabel}}
/>
</template>
);
@@ -173,10 +163,8 @@ module("Integration | Component | d-button", function (hooks) {
});
test("aria-expanded", async function (assert) {
- const self = this;
-
await render(
- <template><DButton @ariaExpanded={{self.ariaExpanded}} /></template>
+ <template><DButton @ariaExpanded={{this.ariaExpanded}} /></template>
);
assert.dom("button").doesNotHaveAria("expanded");
@@ -195,10 +183,8 @@ module("Integration | Component | d-button", function (hooks) {
});
test("aria-controls", async function (assert) {
- const self = this;
-
await render(
- <template><DButton @ariaControls={{self.ariaControls}} /></template>
+ <template><DButton @ariaControls={{this.ariaControls}} /></template>
);
this.set("ariaControls", "foo-bar");
@@ -206,8 +192,6 @@ module("Integration | Component | d-button", function (hooks) {
});
test("onKeyDown callback", async function (assert) {
- const self = this;
-
this.set("foo", null);
this.set("onKeyDown", () => {
this.set("foo", "bar");
@@ -218,7 +202,7 @@ module("Integration | Component | d-button", function (hooks) {
await render(
<template>
- <DButton @action={{self.action}} @onKeyDown={{self.onKeyDown}} />
+ <DButton @action={{this.action}} @onKeyDown={{this.onKeyDown}} />
</template>
);
@@ -230,14 +214,12 @@ module("Integration | Component | d-button", function (hooks) {
});
test("press Enter", async function (assert) {
- const self = this;
-
this.set("foo", null);
this.set("action", () => {
this.set("foo", "bar");
});
- await render(<template><DButton @action={{self.action}} /></template>);
+ await render(<template><DButton @action={{this.action}} /></template>);
await triggerKeyEvent(".btn", "keydown", "Space");
assert.strictEqual(this.foo, null);
@@ -247,14 +229,12 @@ module("Integration | Component | d-button", function (hooks) {
});
test("@action function is triggered on click", async function (assert) {
- const self = this;
-
this.set("foo", null);
this.set("action", () => {
this.set("foo", "bar");
});
- await render(<template><DButton @action={{self.action}} /></template>);
+ await render(<template><DButton @action={{this.action}} /></template>);
await click(".btn");
diff --git a/frontend/discourse/tests/integration/components/d-editor-test.gjs b/frontend/discourse/tests/integration/components/d-editor-test.gjs
index 4a74379fd27..0d18759c70f 100644
--- a/frontend/discourse/tests/integration/components/d-editor-test.gjs
+++ b/frontend/discourse/tests/integration/components/d-editor-test.gjs
@@ -36,9 +36,7 @@ module("Integration | Component | d-editor", function (hooks) {
});
test("preview updates with markdown", async function (assert) {
- const self = this;
-
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
assert.dom(".d-editor-button-bar").exists();
await fillIn(".d-editor-input", "hello **world**");
@@ -50,9 +48,7 @@ module("Integration | Component | d-editor", function (hooks) {
});
test("links in preview are not tabbable", async function (assert) {
- const self = this;
-
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
await fillIn(".d-editor-input", "[discourse](https://www.discourse.org)");
@@ -64,11 +60,9 @@ module("Integration | Component | d-editor", function (hooks) {
});
test("updating the value refreshes the preview", async function (assert) {
- const self = this;
-
this.set("value", "evil trout");
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
assert.dom(".d-editor-preview").hasHtml("<p>evil trout</p>");
@@ -90,8 +84,6 @@ module("Integration | Component | d-editor", function (hooks) {
function testCase(title, testFunc, userOptions = {}) {
test(title, async function (assert) {
- const self = this;
-
this.currentUser.user_option = Object.assign(
{},
this.currentUser.user_option,
@@ -99,7 +91,7 @@ module("Integration | Component | d-editor", function (hooks) {
);
this.set("value", "hello world.");
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
const textarea = jumpEnd("textarea.d-editor-input");
await testFunc.call(this, assert, textarea);
@@ -108,13 +100,11 @@ module("Integration | Component | d-editor", function (hooks) {
function composerTestCase(title, testFunc) {
test(title, async function (assert) {
- const self = this;
-
this.set("value", "hello world.");
await render(
<template>
- <DEditor @value={{self.value}} @composerEvents={{true}} />
+ <DEditor @value={{this.value}} @composerEvents={{true}} />
</template>
);
@@ -259,8 +249,6 @@ module("Integration | Component | d-editor", function (hooks) {
);
test("advanced code", async function (assert) {
- const self = this;
-
this.siteSettings.code_formatting_style = "4-spaces-indent";
this.set(
"value",
@@ -273,7 +261,7 @@ function xyz(x, y, z) {
`
);
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
const textarea = find("textarea.d-editor-input");
textarea.selectionStart = 0;
@@ -293,11 +281,9 @@ function xyz(x, y, z) {
});
test("code button", async function (assert) {
- const self = this;
-
this.siteSettings.code_formatting_style = "4-spaces-indent";
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
const textarea = jumpEnd("textarea.d-editor-input");
@@ -377,11 +363,9 @@ third line`
});
test("code button does not reset undo history", async function (assert) {
- const self = this;
-
this.set("value", "existing");
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
const textarea = find("textarea.d-editor-input");
textarea.selectionStart = 0;
textarea.selectionEnd = 8;
@@ -399,11 +383,9 @@ third line`
});
test("code fences", async function (assert) {
- const self = this;
-
this.set("value", "");
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
const textarea = jumpEnd("textarea.d-editor-input");
@@ -514,13 +496,11 @@ third line`
});
test("quote button - empty lines", async function (assert) {
- const self = this;
-
this.set("value", "one\n\ntwo\n\nthree");
await render(
<template>
- <DEditor @value={{self.value}} @composerEvents={{true}} />
+ <DEditor @value={{this.value}} @composerEvents={{true}} />
</template>
);
@@ -539,13 +519,11 @@ third line`
});
test("quote button - selecting empty lines", async function (assert) {
- const self = this;
-
this.set("value", "one\n\n\n\ntwo");
await render(
<template>
- <DEditor @value={{self.value}} @composerEvents={{true}} />
+ <DEditor @value={{this.value}} @composerEvents={{true}} />
</template>
);
@@ -788,12 +766,10 @@ third line`
);
test("clicking the toggle-direction changes dir from ltr to rtl and back", async function (assert) {
- const self = this;
-
this.siteSettings.support_mixed_text_direction = true;
this.siteSettings.default_locale = "en";
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
await click("button.toggle-direction");
assert.dom("textarea.d-editor-input").hasAttribute("dir", "rtl");
@@ -803,8 +779,6 @@ third line`
});
test("toolbar event supports replaceText", async function (assert) {
- const self = this;
-
withPluginApi((api) => {
api.onToolbarCreate((toolbar) => {
toolbar.addButton({
@@ -821,7 +795,7 @@ third line`
this.value = "hello";
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
await click("button.replace-text");
assert.strictEqual(this.value, "goodbye");
@@ -842,13 +816,11 @@ third line`
);
test("emoji", async function (assert) {
- const self = this;
-
this.set("value", "hello world.");
// we need DMenus here, as we are testing the d-editor which is not renderining
// the in-element outlet container necessary for DMenu to work
await render(
- <template><DMenus /><DEditor @value={{self.value}} /></template>
+ <template><DMenus /><DEditor @value={{this.value}} /></template>
);
const picker = emojiPicker();
jumpEnd("textarea.d-editor-input");
@@ -1048,14 +1020,12 @@ third line`
);
test("paste table", async function (assert) {
- const self = this;
-
this.set("value", "");
this.siteSettings.enable_rich_text_paste = true;
await render(
<template>
- <DEditor @value={{self.value}} @composerEvents={{true}} />
+ <DEditor @value={{this.value}} @composerEvents={{true}} />
</template>
);
@@ -1067,14 +1037,12 @@ third line`
});
test("paste a different table", async function (assert) {
- const self = this;
-
this.set("value", "");
this.siteSettings.enable_rich_text_paste = true;
await render(
<template>
- <DEditor @value={{self.value}} @composerEvents={{true}} />
+ <DEditor @value={{this.value}} @composerEvents={{true}} />
</template>
);
@@ -1429,8 +1397,6 @@ third line`
})();
test("toolbar instance replacement", async function (assert) {
- const self = this;
-
const customToolbar = new ToolbarBase({
siteSettings: this.siteSettings,
capabilities: this.capabilities,
@@ -1458,7 +1424,7 @@ third line`
this.value = "hello";
- await render(<template><DEditor @value={{self.value}} /></template>);
+ await render(<template><DEditor @value={{this.value}} /></template>);
assert.dom(".d-editor-button-bar").exists();
assert.dom(".d-editor-button-bar.--replaced-toolbar").doesNotExist();
diff --git a/frontend/discourse/tests/integration/components/d-toggle-switch-test.gjs b/frontend/discourse/tests/integration/components/d-toggle-switch-test.gjs
index 193b2cad477..3774bf2ee72 100644
--- a/frontend/discourse/tests/integration/components/d-toggle-switch-test.gjs
+++ b/frontend/discourse/tests/integration/components/d-toggle-switch-test.gjs
@@ -27,16 +27,14 @@ module("Integration | Component | d-toggle-switch", function (hooks) {
});
test("it renders a label for the button", async function (assert) {
- const self = this;
-
I18n.translations[I18n.locale].js.test = { fooLabel: "foo" };
this.set("state", true);
await render(
<template>
<DToggleSwitch
- @state={{self.state}}
- @label={{self.label}}
- @translatedLabel={{self.translatedLabel}}
+ @state={{this.state}}
+ @label={{this.label}}
+ @translatedLabel={{this.translatedLabel}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/date-input-test.gjs b/frontend/discourse/tests/integration/components/date-input-test.gjs
index 12492a98eca..be8cd3eea10 100644
--- a/frontend/discourse/tests/integration/components/date-input-test.gjs
+++ b/frontend/discourse/tests/integration/components/date-input-test.gjs
@@ -9,24 +9,20 @@ module("Integration | Component | date-input", function (hooks) {
setupRenderingTest(hooks);
test("default", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE });
- await render(<template><DateInput @date={{self.date}} /></template>);
+ await render(<template><DateInput @date={{this.date}} /></template>);
assert.dom(".date-picker").hasValue("2019-01-29");
});
test("prevents mutations", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE });
this.set("onChange", () => {});
await render(
<template>
- <DateInput @date={{self.date}} @onChange={{self.onChange}} />
+ <DateInput @date={{this.date}} @onChange={{this.onChange}} />
</template>
);
@@ -37,14 +33,12 @@ module("Integration | Component | date-input", function (hooks) {
});
test("allows mutations through actions", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE });
this.set("onChange", (date) => this.set("date", date));
await render(
<template>
- <DateInput @date={{self.date}} @onChange={{self.onChange}} />
+ <DateInput @date={{this.date}} @onChange={{this.onChange}} />
</template>
);
@@ -55,15 +49,13 @@ module("Integration | Component | date-input", function (hooks) {
});
test("always shows date in timezone of input timestamp", async function (assert) {
- const self = this;
-
this.setProperties({
date: moment.tz("2023-05-05T10:00:00", "ETC/GMT-12"),
});
await render(
<template>
- <DateInput @date={{self.date}} @onChange={{self.onChange}} />
+ <DateInput @date={{this.date}} @onChange={{this.onChange}} />
</template>
);
assert.dom(".date-picker").hasValue("2023-05-05");
diff --git a/frontend/discourse/tests/integration/components/date-time-input-range-test.gjs b/frontend/discourse/tests/integration/components/date-time-input-range-test.gjs
index 4825df30937..65c3361bd02 100644
--- a/frontend/discourse/tests/integration/components/date-time-input-range-test.gjs
+++ b/frontend/discourse/tests/integration/components/date-time-input-range-test.gjs
@@ -12,16 +12,14 @@ module("Integration | Component | date-time-input-range", function (hooks) {
setupRenderingTest(hooks);
test("default", async function (assert) {
- const self = this;
-
this.setProperties({ state: { from: DEFAULT_DATE_TIME, to: null } });
await render(
<template>
<DateTimeInputRange
- @from={{self.state.from}}
- @to={{self.state.to}}
- @onChange={{fn (mut self.state)}}
+ @from={{this.state.from}}
+ @to={{this.state.to}}
+ @onChange={{fn (mut this.state)}}
/>
</template>
);
@@ -53,17 +51,15 @@ module("Integration | Component | date-time-input-range", function (hooks) {
});
test("setting relativeDate results in correct intervals (4x 15m then 30m)", async function (assert) {
- const self = this;
-
this.setProperties({ state: { from: DEFAULT_DATE_TIME, to: null } });
await render(
<template>
<DateTimeInputRange
- @from={{self.state.from}}
- @to={{self.state.to}}
- @relativeDate={{self.state.from}}
- @onChange={{fn (mut self.state)}}
+ @from={{this.state.from}}
+ @to={{this.state.to}}
+ @relativeDate={{this.state.from}}
+ @onChange={{fn (mut this.state)}}
/>
</template>
);
@@ -78,8 +74,6 @@ module("Integration | Component | date-time-input-range", function (hooks) {
});
test("timezone support", async function (assert) {
- const self = this;
-
this.setProperties({
state: {
from: moment.tz(DEFAULT_DATE_TIME_STRING, "Europe/Paris"),
@@ -90,9 +84,9 @@ module("Integration | Component | date-time-input-range", function (hooks) {
await render(
<template>
<DateTimeInputRange
- @from={{self.state.from}}
- @to={{self.state.to}}
- @onChange={{fn (mut self.state)}}
+ @from={{this.state.from}}
+ @to={{this.state.to}}
+ @onChange={{fn (mut this.state)}}
@timezone="Europe/Paris"
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/date-time-input-test.gjs b/frontend/discourse/tests/integration/components/date-time-input-test.gjs
index 126ffc80190..c406671fa43 100644
--- a/frontend/discourse/tests/integration/components/date-time-input-test.gjs
+++ b/frontend/discourse/tests/integration/components/date-time-input-test.gjs
@@ -9,11 +9,9 @@ module("Integration | Component | date-time-input", function (hooks) {
setupRenderingTest(hooks);
test("default", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE_TIME });
- await render(<template><DateTimeInput @date={{self.date}} /></template>);
+ await render(<template><DateTimeInput @date={{this.date}} /></template>);
assert.dom(".date-picker").hasValue("2019-01-29");
assert
@@ -22,11 +20,9 @@ module("Integration | Component | date-time-input", function (hooks) {
});
test("prevents mutations", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE_TIME });
- await render(<template><DateTimeInput @date={{self.date}} /></template>);
+ await render(<template><DateTimeInput @date={{this.date}} /></template>);
await fillIn(".date-picker", "2019-01-02");
@@ -34,14 +30,12 @@ module("Integration | Component | date-time-input", function (hooks) {
});
test("allows mutations through actions", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE_TIME });
this.set("onChange", (date) => this.set("date", date));
await render(
<template>
- <DateTimeInput @date={{self.date}} @onChange={{self.onChange}} />
+ <DateTimeInput @date={{this.date}} @onChange={{this.onChange}} />
</template>
);
@@ -52,13 +46,11 @@ module("Integration | Component | date-time-input", function (hooks) {
});
test("can hide time", async function (assert) {
- const self = this;
-
this.setProperties({ date: DEFAULT_DATE_TIME });
await render(
<template>
- <DateTimeInput @date={{self.date}} @showTime={{false}} />
+ <DateTimeInput @date={{this.date}} @showTime={{false}} />
</template>
);
@@ -66,8 +58,6 @@ module("Integration | Component | date-time-input", function (hooks) {
});
test("supports swapping timezone without changing visible date/time", async function (assert) {
- const self = this;
-
this.setProperties({
date: moment.tz("2023-05-05T12:00:00", "Europe/London"),
timezone: "Europe/London",
@@ -77,9 +67,9 @@ module("Integration | Component | date-time-input", function (hooks) {
await render(
<template>
<DateTimeInput
- @date={{self.date}}
- @timezone={{self.timezone}}
- @onChange={{self.onChange}}
+ @date={{this.date}}
+ @timezone={{this.timezone}}
+ @onChange={{this.onChange}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/discovery/filter-navigation-menu-test.gjs b/frontend/discourse/tests/integration/components/discovery/filter-navigation-menu-test.gjs
index d4268dfa694..327d894fd12 100644
--- a/frontend/discourse/tests/integration/components/discovery/filter-navigation-menu-test.gjs
+++ b/frontend/discourse/tests/integration/components/discovery/filter-navigation-menu-test.gjs
@@ -53,14 +53,12 @@ module(
});
test("keyboard navigation through tips", async function (assert) {
- const self = this;
-
await render(
<template>
<FilterNavigationMenu
- @tips={{self.tips}}
- @initialFilterQueryString={{self.query}}
- @onChange={{self.update}}
+ @tips={{this.tips}}
+ @initialFilterQueryString={{this.query}}
+ @onChange={{this.update}}
/>
<DMenus />
</template>
@@ -102,14 +100,12 @@ module(
});
test("selecting a tip with Tab", async function (assert) {
- const self = this;
-
await render(
<template>
<FilterNavigationMenu
- @tips={{self.tips}}
- @initialFilterQueryString={{self.query}}
- @onChange={{self.update}}
+ @tips={{this.tips}}
+ @initialFilterQueryString={{this.query}}
+ @onChange={{this.update}}
/>
<DMenus />
@@ -135,13 +131,12 @@ module(
});
test("searching tag values", async function (assert) {
- const self = this;
await render(
<template>
<FilterNavigationMenu
- @tips={{self.tips}}
- @initialFilterQueryString={{self.query}}
- @onChange={{self.update}}
+ @tips={{this.tips}}
+ @initialFilterQueryString={{this.query}}
+ @onChange={{this.update}}
/>
<DMenus />
</template>
@@ -169,13 +164,12 @@ module(
});
test("escape hides suggestions", async function (assert) {
- const self = this;
await render(
<template>
<FilterNavigationMenu
- @tips={{self.tips}}
- @initialFilterQueryString={{self.query}}
- @onChange={{self.update}}
+ @tips={{this.tips}}
+ @initialFilterQueryString={{this.query}}
+ @onChange={{this.update}}
/>
<DMenus />
</template>
@@ -194,7 +188,6 @@ module(
});
test("prefix support for categories", async function (assert) {
- const self = this;
this.tips = [
{
name: "category:",
@@ -211,9 +204,9 @@ module(
await render(
<template>
<FilterNavigationMenu
- @tips={{self.tips}}
- @initialFilterQueryString={{self.query}}
- @onChange={{self.update}}
+ @tips={{this.tips}}
+ @initialFilterQueryString={{this.query}}
+ @onChange={{this.update}}
/>
<DMenus />
</template>
diff --git a/frontend/discourse/tests/integration/components/dismiss-new-test.gjs b/frontend/discourse/tests/integration/components/dismiss-new-test.gjs
index e39592de8d2..7644978a5f5 100644
--- a/frontend/discourse/tests/integration/components/dismiss-new-test.gjs
+++ b/frontend/discourse/tests/integration/components/dismiss-new-test.gjs
@@ -12,10 +12,8 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("modal title", async function (assert) {
- const self = this;
-
await render(
- <template><DismissNew @inline={{true}} @model={{self.model}} /></template>
+ <template><DismissNew @inline={{true}} @model={{this.model}} /></template>
);
assert
@@ -24,10 +22,8 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("default state", async function (assert) {
- const self = this;
-
await render(
- <template><DismissNew @inline={{true}} @model={{self.model}} /></template>
+ <template><DismissNew @inline={{true}} @model={{this.model}} /></template>
);
assert.dom(".dismiss-topics input").isChecked();
@@ -36,8 +32,6 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("one new selected topic", async function (assert) {
- const self = this;
-
this.model.selectedTopics.push({
id: 1,
title: "Topic 1",
@@ -45,7 +39,7 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
await render(
- <template><DismissNew @inline={{true}} @model={{self.model}} /></template>
+ <template><DismissNew @inline={{true}} @model={{this.model}} /></template>
);
assert.dom(".dismiss-posts").doesNotExist();
@@ -57,8 +51,6 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("one new unread in selected topic", async function (assert) {
- const self = this;
-
this.model.selectedTopics.push({
id: 1,
title: "Topic 1",
@@ -66,7 +58,7 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
await render(
- <template><DismissNew @inline={{true}} @model={{self.model}} /></template>
+ <template><DismissNew @inline={{true}} @model={{this.model}} /></template>
);
assert.dom(".dismiss-topics").doesNotExist();
@@ -78,12 +70,10 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("selected replies unchecked with topics subset", async function (assert) {
- const self = this;
-
this.model.subset = "topics";
await render(
- <template><DismissNew @inline={{true}} @model={{self.model}} /></template>
+ <template><DismissNew @inline={{true}} @model={{this.model}} /></template>
);
assert.dom(".dismiss-posts").isNotChecked();
@@ -93,12 +83,10 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("selected topics unchecked with replies subset", async function (assert) {
- const self = this;
-
this.model.subset = "replies";
await render(
- <template><DismissNew @inline={{true}} @model={{self.model}} /></template>
+ <template><DismissNew @inline={{true}} @model={{this.model}} /></template>
);
assert.dom(".dismiss-topics").isNotChecked();
@@ -108,8 +96,6 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
});
test("dismissed", async function (assert) {
- const self = this;
-
let state;
this.model.dismissCallback = (newState) => {
@@ -121,9 +107,9 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
await render(
<template>
<DismissNew
- @closeModal={{self.noop}}
+ @closeModal={{this.noop}}
@inline={{true}}
- @model={{self.model}}
+ @model={{this.model}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/emoji-picker-test.gjs b/frontend/discourse/tests/integration/components/emoji-picker-test.gjs
index 15cf2ddd4ca..c88804d44ef 100644
--- a/frontend/discourse/tests/integration/components/emoji-picker-test.gjs
+++ b/frontend/discourse/tests/integration/components/emoji-picker-test.gjs
@@ -108,12 +108,10 @@ module("Integration | Component | emoji-picker-content", function (hooks) {
});
test("When selecting an emoji", async function (assert) {
- const self = this;
-
this.didSelectEmoji = (emoji) => assert.step(emoji);
await render(
- <template><Content @didSelectEmoji={{self.didSelectEmoji}} /></template>
+ <template><Content @didSelectEmoji={{this.didSelectEmoji}} /></template>
);
await click('img.emoji[data-emoji="grinning"]');
@@ -195,12 +193,10 @@ module("Integration | Component | emoji-picker-content", function (hooks) {
});
test("When selecting a toned an emoji", async function (assert) {
- const self = this;
-
this.didSelectEmoji = (emoji) => assert.step(emoji);
await render(
- <template><Content @didSelectEmoji={{self.didSelectEmoji}} /></template>
+ <template><Content @didSelectEmoji={{this.didSelectEmoji}} /></template>
);
const picker = emojiPicker(".emoji-picker");
await picker.select("raised_hands");
diff --git a/frontend/discourse/tests/integration/components/emoji-uploader-test.gjs b/frontend/discourse/tests/integration/components/emoji-uploader-test.gjs
index f8516d2b498..01cba660ec8 100644
--- a/frontend/discourse/tests/integration/components/emoji-uploader-test.gjs
+++ b/frontend/discourse/tests/integration/components/emoji-uploader-test.gjs
@@ -38,14 +38,12 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("uses the selected group for the upload", async function (assert) {
- const self = this;
-
await render(
<template>
<EmojiUploader
@id="emoji-uploader"
- @emojiGroups={{self.emojiGroups}}
- @done={{self.doneUpload}}
+ @emojiGroups={{this.emojiGroups}}
+ @done={{this.doneUpload}}
/>
</template>
);
@@ -66,14 +64,12 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("does not clear the selected group between multiple uploads", async function (assert) {
- const self = this;
-
await render(
<template>
<EmojiUploader
@id="emoji-uploader"
- @emojiGroups={{self.emojiGroups}}
- @done={{self.doneUpload}}
+ @emojiGroups={{this.emojiGroups}}
+ @done={{this.doneUpload}}
/>
</template>
);
@@ -101,14 +97,12 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("clears the name after the first upload to avoid duplicate names", async function (assert) {
- const self = this;
-
await render(
<template>
<EmojiUploader
@id="emoji-uploader"
- @emojiGroups={{self.emojiGroups}}
- @done={{self.doneUpload}}
+ @emojiGroups={{this.emojiGroups}}
+ @done={{this.doneUpload}}
/>
</template>
);
@@ -140,15 +134,13 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("sets the created_by field with username", async function (assert) {
- const self = this;
-
await render(
<template>
<EmojiUploader
@id="emoji-uploader"
- @emojiGroups={{self.emojiGroups}}
- @createdBy={{self.createdBy}}
- @done={{self.doneUpload}}
+ @emojiGroups={{this.emojiGroups}}
+ @createdBy={{this.createdBy}}
+ @done={{this.doneUpload}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/file-size-input-test.gjs b/frontend/discourse/tests/integration/components/file-size-input-test.gjs
index 909c1cf4b7f..aad18ceaa14 100644
--- a/frontend/discourse/tests/integration/components/file-size-input-test.gjs
+++ b/frontend/discourse/tests/integration/components/file-size-input-test.gjs
@@ -8,8 +8,6 @@ module("Integration | Component | file-size-input", function (hooks) {
setupRenderingTest(hooks);
test("file size unit selector kb", async function (assert) {
- const self = this;
-
this.set("value", 1023);
this.set("max", 4096);
this.set("onChangeSize", () => {});
@@ -18,10 +16,10 @@ module("Integration | Component | file-size-input", function (hooks) {
await render(
<template>
<FileSizeInput
- @sizeValueKB={{readonly self.value}}
+ @sizeValueKB={{readonly this.value}}
class="file-size-input-test"
- @onChangeSize={{self.onChangeSize}}
- @setValidationMessage={{self.setValidationMessage}}
+ @onChangeSize={{this.onChangeSize}}
+ @setValidationMessage={{this.setValidationMessage}}
@max="4096"
/>
</template>
@@ -36,8 +34,6 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size unit is mb when the starting value is 1mb or more", async function (assert) {
- const self = this;
-
this.set("value", 1024);
this.set("onChangeSize", () => {});
this.set("setValidationMessage", () => {});
@@ -45,10 +41,10 @@ module("Integration | Component | file-size-input", function (hooks) {
await render(
<template>
<FileSizeInput
- @sizeValueKB={{readonly self.value}}
+ @sizeValueKB={{readonly this.value}}
class="file-size-input-test"
- @onChangeSize={{self.onChangeSize}}
- @setValidationMessage={{self.setValidationMessage}}
+ @onChangeSize={{this.onChangeSize}}
+ @setValidationMessage={{this.setValidationMessage}}
@max="4096"
/>
</template>
@@ -63,8 +59,6 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size unit is gb when the starting value is 1gb or more", async function (assert) {
- const self = this;
-
this.set("value", 1024 * 1024);
this.set("onChangeSize", () => {});
this.set("setValidationMessage", () => {});
@@ -72,10 +66,10 @@ module("Integration | Component | file-size-input", function (hooks) {
await render(
<template>
<FileSizeInput
- @sizeValueKB={{readonly self.value}}
+ @sizeValueKB={{readonly this.value}}
class="file-size-input-test"
- @onChangeSize={{self.onChangeSize}}
- @setValidationMessage={{self.setValidationMessage}}
+ @onChangeSize={{this.onChangeSize}}
+ @setValidationMessage={{this.setValidationMessage}}
@max="4096"
/>
</template>
@@ -90,8 +84,6 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size unit selector", async function (assert) {
- const self = this;
-
this.set("value", 4096);
this.set("max", 8192);
this.set("onChangeSize", () => {});
@@ -100,10 +92,10 @@ module("Integration | Component | file-size-input", function (hooks) {
await render(
<template>
<FileSizeInput
- @sizeValueKB={{readonly self.value}}
+ @sizeValueKB={{readonly this.value}}
class="file-size-input-test"
- @onChangeSize={{self.onChangeSize}}
- @setValidationMessage={{self.setValidationMessage}}
+ @onChangeSize={{this.onChangeSize}}
+ @setValidationMessage={{this.setValidationMessage}}
@max="4096"
/>
</template>
@@ -154,8 +146,6 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size input error message", async function (assert) {
- const self = this;
-
this.set("value", 4096);
this.set("max", 8192);
this.set("min", 2048);
@@ -169,12 +159,12 @@ module("Integration | Component | file-size-input", function (hooks) {
await render(
<template>
<FileSizeInput
- @sizeValueKB={{readonly self.value}}
+ @sizeValueKB={{readonly this.value}}
class="file-size-input-test"
- @onChangeSize={{self.onChangeSize}}
- @setValidationMessage={{self.setValidationMessage}}
- @max={{self.max}}
- @min={{self.min}}
+ @onChangeSize={{this.onChangeSize}}
+ @setValidationMessage={{this.setValidationMessage}}
+ @max={{this.max}}
+ @min={{this.min}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/filter-input-test.gjs b/frontend/discourse/tests/integration/components/filter-input-test.gjs
index d0b306c1140..5beb6d0af99 100644
--- a/frontend/discourse/tests/integration/components/filter-input-test.gjs
+++ b/frontend/discourse/tests/integration/components/filter-input-test.gjs
@@ -39,14 +39,12 @@ module("Integration | Component | FilterInput", function (hooks) {
});
test("Filter action", async function (assert) {
- const self = this;
-
this.set("value", null);
this.set("action", (event) => {
this.set("value", event.target.value);
});
await render(
- <template><FilterInput @filterAction={{self.action}} /></template>
+ <template><FilterInput @filterAction={{this.action}} /></template>
);
await fillIn(".filter-input", "foo");
@@ -54,10 +52,8 @@ module("Integration | Component | FilterInput", function (hooks) {
});
test("Focused state", async function (assert) {
- const self = this;
-
await render(
- <template><FilterInput @filterAction={{self.action}} /></template>
+ <template><FilterInput @filterAction={{this.action}} /></template>
);
await triggerEvent(".filter-input", "focusin");
@@ -69,13 +65,11 @@ module("Integration | Component | FilterInput", function (hooks) {
});
test("Clear button visibility", async function (assert) {
- const self = this;
-
this.set("clearAction", () => {});
this.set("value", "test");
await render(
<template>
- <FilterInput @onClearInput={{self.clearAction}} @value={{self.value}} />
+ <FilterInput @onClearInput={{this.clearAction}} @value={{this.value}} />
</template>
);
@@ -87,15 +81,13 @@ module("Integration | Component | FilterInput", function (hooks) {
});
test("onClearInput callback", async function (assert) {
- const self = this;
-
this.set("called", false);
this.set("clearAction", () => {
this.set("called", true);
});
await render(
<template>
- <FilterInput @onClearInput={{self.clearAction}} @value="test" />
+ <FilterInput @onClearInput={{this.clearAction}} @value="test" />
</template>
);
await click(".filter-input-clear-btn");
@@ -104,12 +96,10 @@ module("Integration | Component | FilterInput", function (hooks) {
});
test("Input focus after clear", async function (assert) {
- const self = this;
-
this.set("clearAction", () => {});
await render(
<template>
- <FilterInput @onClearInput={{self.clearAction}} @value="test" />
+ <FilterInput @onClearInput={{this.clearAction}} @value="test" />
</template>
);
await click(".filter-input-clear-btn");
diff --git a/frontend/discourse/tests/integration/components/float-kit/d-default-toast-test.gjs b/frontend/discourse/tests/integration/components/float-kit/d-default-toast-test.gjs
index 45e70eed4aa..4500c582df8 100644
--- a/frontend/discourse/tests/integration/components/float-kit/d-default-toast-test.gjs
+++ b/frontend/discourse/tests/integration/components/float-kit/d-default-toast-test.gjs
@@ -11,38 +11,32 @@ module(
setupRenderingTest(hooks);
test("icon", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, { data: { icon: "check" } });
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert.dom(".fk-d-default-toast__icon-container .d-icon-check").exists();
});
test("no icon", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, {});
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert.dom(".fk-d-default-toast__icon-container").doesNotExist();
});
test("progress bar", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, {});
await render(
<template>
<DDefaultToast
- @data={{self.toast.options.data}}
+ @data={{this.toast.options.data}}
@showProgressBar={{true}}
@onRegisterProgressBar={{(noop)}}
/>
@@ -53,14 +47,12 @@ module(
});
test("no progress bar", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, {});
await render(
<template>
<DDefaultToast
- @data={{self.toast.options.data}}
+ @data={{this.toast.options.data}}
@showProgressBar={{false}}
/>
</template>
@@ -70,12 +62,10 @@ module(
});
test("title", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, { data: { title: "Title" } });
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert
@@ -84,24 +74,20 @@ module(
});
test("no title", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, {});
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert.dom(".fk-d-default-toast__title").doesNotExist();
});
test("message", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, { data: { message: "Message" } });
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert
@@ -110,20 +96,16 @@ module(
});
test("no message", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, {});
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert.dom(".fk-d-default-toast__message").doesNotExist();
});
test("actions", async function (assert) {
- const self = this;
-
this.toast = new DToastInstance(this, {
data: {
actions: [
@@ -138,7 +120,7 @@ module(
});
await render(
- <template><DDefaultToast @data={{self.toast.options.data}} /></template>
+ <template><DDefaultToast @data={{this.toast.options.data}} /></template>
);
assert
diff --git a/frontend/discourse/tests/integration/components/float-kit/d-menu-test.gjs b/frontend/discourse/tests/integration/components/float-kit/d-menu-test.gjs
index 963e358fe51..1dc1e968d30 100644
--- a/frontend/discourse/tests/integration/components/float-kit/d-menu-test.gjs
+++ b/frontend/discourse/tests/integration/components/float-kit/d-menu-test.gjs
@@ -72,14 +72,12 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@onRegisterApi", async function (assert) {
- const self = this;
-
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
await render(
<template>
- <DMenu @inline={{true}} @onRegisterApi={{self.onRegisterApi}} />
+ <DMenu @inline={{true}} @onRegisterApi={{this.onRegisterApi}} />
</template>
);
@@ -87,13 +85,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@onShow", async function (assert) {
- const self = this;
-
this.test = false;
this.onShow = () => (this.test = true);
await render(
- <template><DMenu @inline={{true}} @onShow={{self.onShow}} /></template>
+ <template><DMenu @inline={{true}} @onShow={{this.onShow}} /></template>
);
await open();
@@ -101,13 +97,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@onClose", async function (assert) {
- const self = this;
-
this.test = false;
this.onClose = () => (this.test = true);
await render(
- <template><DMenu @inline={{true}} @onClose={{self.onClose}} /></template>
+ <template><DMenu @inline={{true}} @onClose={{this.onClose}} /></template>
);
await open();
await close();
@@ -194,8 +188,6 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@component", async function (assert) {
- const self = this;
-
this.component = DDefaultToast;
await render(
@@ -203,7 +195,7 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
<DMenu
@inline={{true}}
@label="test"
- @component={{self.component}}
+ @component={{this.component}}
@data={{hash message="content"}}
/>
</template>
@@ -473,8 +465,6 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("focusTrigger on close", async function (assert) {
- const self = this;
-
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
this.close = async () => await this.api.close();
@@ -482,11 +472,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
await render(
<template>
<DMenu
- @onRegisterApi={{self.onRegisterApi}}
+ @onRegisterApi={{this.onRegisterApi}}
@inline={{true}}
@icon="xmark"
>
- <DButton @icon="xmark" class="close" @action={{self.close}} />
+ <DButton @icon="xmark" class="close" @action={{this.close}} />
</DMenu>
</template>
);
@@ -499,8 +489,6 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("focusTrigger=false on close", async function (assert) {
- const self = this;
-
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
this.close = async () => await this.api.close({ focusTrigger: false });
@@ -508,11 +496,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
await render(
<template>
<DMenu
- @onRegisterApi={{self.onRegisterApi}}
+ @onRegisterApi={{this.onRegisterApi}}
@inline={{true}}
@icon="xmark"
>
- <DButton @icon="xmark" class="close" @action={{self.close}} />
+ <DButton @icon="xmark" class="close" @action={{this.close}} />
</DMenu>
</template>
);
@@ -525,8 +513,6 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("traps pointerdown events only when expanded ", async function (assert) {
- const self = this;
-
let propagated = false;
const listener = () => {
@@ -542,7 +528,7 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
await render(
<template>
- <div {{didInsert self.didInsert}} {{willDestroy self.willDestroy}}>
+ <div {{didInsert this.didInsert}} {{willDestroy this.willDestroy}}>
<DMenu
@inline={{true}}
@label="label"
diff --git a/frontend/discourse/tests/integration/components/float-kit/d-tooltip-test.gjs b/frontend/discourse/tests/integration/components/float-kit/d-tooltip-test.gjs
index 4c524949cb5..64c4e4ad3c4 100644
--- a/frontend/discourse/tests/integration/components/float-kit/d-tooltip-test.gjs
+++ b/frontend/discourse/tests/integration/components/float-kit/d-tooltip-test.gjs
@@ -56,14 +56,12 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
});
test("@onRegisterApi", async function (assert) {
- const self = this;
-
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
await render(
<template>
- <DTooltip @inline={{true}} @onRegisterApi={{self.onRegisterApi}} />
+ <DTooltip @inline={{true}} @onRegisterApi={{this.onRegisterApi}} />
</template>
);
@@ -71,13 +69,11 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
});
test("@onShow", async function (assert) {
- const self = this;
-
this.test = false;
this.onShow = () => (this.test = true);
await render(
- <template><DTooltip @inline={{true}} @onShow={{self.onShow}} /></template>
+ <template><DTooltip @inline={{true}} @onShow={{this.onShow}} /></template>
);
await hover();
@@ -86,14 +82,12 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
});
test("@onClose", async function (assert) {
- const self = this;
-
this.test = false;
this.onClose = () => (this.test = true);
await render(
<template>
- <DTooltip @inline={{true}} @onClose={{self.onClose}} />
+ <DTooltip @inline={{true}} @onClose={{this.onClose}} />
</template>
);
await hover();
@@ -189,8 +183,6 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
});
test("@component", async function (assert) {
- const self = this;
-
this.component = DDefaultToast;
await render(
@@ -198,7 +190,7 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
<DTooltip
@inline={{true}}
@label="test"
- @component={{self.component}}
+ @component={{this.component}}
@data={{hash message="content"}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/form-template-field/dropdown-test.gjs b/frontend/discourse/tests/integration/components/form-template-field/dropdown-test.gjs
index 8d6ffe309ed..4c525914eb8 100644
--- a/frontend/discourse/tests/integration/components/form-template-field/dropdown-test.gjs
+++ b/frontend/discourse/tests/integration/components/form-template-field/dropdown-test.gjs
@@ -16,14 +16,12 @@ module(
});
test("renders a dropdown with choices", async function (assert) {
- const self = this;
-
const choices = ["Choice 1", "Choice 2", "Choice 3"];
this.set("choices", choices);
await render(
<template>
- <Dropdown @choices={{self.choices}} @onChange={{noop}} />
+ <Dropdown @choices={{this.choices}} @onChange={{noop}} />
</template>
);
assert
@@ -46,8 +44,6 @@ module(
});
test("renders a dropdown with choices and attributes", async function (assert) {
- const self = this;
-
const choices = ["Choice 1", "Choice 2", "Choice 3"];
const attributes = {
none_label: "Select a choice",
@@ -60,8 +56,8 @@ module(
await render(
<template>
<Dropdown
- @choices={{self.choices}}
- @attributes={{self.attributes}}
+ @choices={{this.choices}}
+ @attributes={{this.attributes}}
@onChange={{noop}}
/>
</template>
@@ -76,14 +72,12 @@ module(
});
test("doesn't render a label when attribute is missing", async function (assert) {
- const self = this;
-
const choices = ["Choice 1", "Choice 2", "Choice 3"];
this.set("choices", choices);
await render(
<template>
- <Dropdown @choices={{self.choices}} @onChange={{noop}} />
+ <Dropdown @choices={{this.choices}} @onChange={{noop}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/form-template-field/multi-select-test.gjs b/frontend/discourse/tests/integration/components/form-template-field/multi-select-test.gjs
index b3203f4c31b..f280aaa4c4c 100644
--- a/frontend/discourse/tests/integration/components/form-template-field/multi-select-test.gjs
+++ b/frontend/discourse/tests/integration/components/form-template-field/multi-select-test.gjs
@@ -16,15 +16,13 @@ module(
});
test("renders a multi-select dropdown with choices", async function (assert) {
- const self = this;
-
const choices = ["Choice 1", "Choice 2", "Choice 3"];
this.set("choices", choices);
await render(
<template>
- <MultiSelect @choices={{self.choices}} @onChange={{noop}} />
+ <MultiSelect @choices={{this.choices}} @onChange={{noop}} />
</template>
);
assert
@@ -47,8 +45,6 @@ module(
});
test("renders a multi-select with choices and attributes", async function (assert) {
- const self = this;
-
const choices = ["Choice 1", "Choice 2", "Choice 3"];
const attributes = {
none_label: "Select a choice",
@@ -61,8 +57,8 @@ module(
await render(
<template>
<MultiSelect
- @choices={{self.choices}}
- @attributes={{self.attributes}}
+ @choices={{this.choices}}
+ @attributes={{this.attributes}}
@onChange={{noop}}
/>
</template>
@@ -77,14 +73,12 @@ module(
});
test("doesn't render a label when attribute is missing", async function (assert) {
- const self = this;
-
const choices = ["Choice 1", "Choice 2", "Choice 3"];
this.set("choices", choices);
await render(
<template>
- <MultiSelect @choices={{self.choices}} @onChange={{noop}} />
+ <MultiSelect @choices={{this.choices}} @onChange={{noop}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/form-template-field/textarea-test.gjs b/frontend/discourse/tests/integration/components/form-template-field/textarea-test.gjs
index 2a7f6ee2722..8ec53b6951a 100644
--- a/frontend/discourse/tests/integration/components/form-template-field/textarea-test.gjs
+++ b/frontend/discourse/tests/integration/components/form-template-field/textarea-test.gjs
@@ -18,8 +18,6 @@ module(
});
test("renders a text input with attributes", async function (assert) {
- const self = this;
-
const attributes = {
label: "My text label",
placeholder: "Enter text here",
@@ -28,7 +26,7 @@ module(
await render(
<template>
- <FormTextarea @attributes={{self.attributes}} @onChange={{noop}} />
+ <FormTextarea @attributes={{this.attributes}} @onChange={{noop}} />
</template>
);
@@ -43,8 +41,6 @@ module(
});
test("doesn't render a label when attribute is missing", async function (assert) {
- const self = this;
-
const attributes = {
placeholder: "Enter text here",
};
@@ -52,7 +48,7 @@ module(
await render(
<template>
- <FormTextarea @attributes={{self.attributes}} @onChange={{noop}} />
+ <FormTextarea @attributes={{this.attributes}} @onChange={{noop}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/form-template-field/wrapper-test.gjs b/frontend/discourse/tests/integration/components/form-template-field/wrapper-test.gjs
index 88b60062589..9a05d8054ce 100644
--- a/frontend/discourse/tests/integration/components/form-template-field/wrapper-test.gjs
+++ b/frontend/discourse/tests/integration/components/form-template-field/wrapper-test.gjs
@@ -11,12 +11,10 @@ module(
setupRenderingTest(hooks);
test("does not render a component when template content has invalid YAML", async function (assert) {
- const self = this;
-
this.set("content", `- type: checkbox\n attributes;invalid`);
await render(
<template>
- <Wrapper @content={{self.content}} @onChange={{noop}} />
+ <Wrapper @content={{this.content}} @onChange={{noop}} />
</template>
);
@@ -27,8 +25,6 @@ module(
});
test("renders a component based on the component type found in the content YAML", async function (assert) {
- const self = this;
-
const content = `- type: checkbox\n id: checkbox\n
- type: input\n id: name
- type: textarea\n id: notes
@@ -47,7 +43,7 @@ module(
await render(
<template>
- <Wrapper @content={{self.content}} @onChange={{noop}} />
+ <Wrapper @content={{this.content}} @onChange={{noop}} />
</template>
);
@@ -59,8 +55,6 @@ module(
});
test("renders a component based on the component type found in the content YAML, with initial values", async function (assert) {
- const self = this;
-
const content = `- type: checkbox\n id: checkbox\n
- type: input\n id: name
- type: textarea\n id: notes
@@ -79,8 +73,8 @@ module(
await render(
<template>
<Wrapper
- @content={{self.content}}
- @initialValues={{self.initialValues}}
+ @content={{this.content}}
+ @initialValues={{this.initialValues}}
@onChange={{noop}}
/>
</template>
@@ -94,8 +88,6 @@ module(
});
test("renders a component based on the component type found in the content YAML when passed ids", async function (assert) {
- const self = this;
-
pretender.get("/form-templates/1.json", () => {
return response({
form_template: {
@@ -110,7 +102,7 @@ module(
this.set("formTemplateId", [1]);
await render(
<template>
- <Wrapper @id={{self.formTemplateId}} @onChange={{noop}} />
+ <Wrapper @id={{this.formTemplateId}} @onChange={{noop}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/group-list-setting-test.gjs b/frontend/discourse/tests/integration/components/group-list-setting-test.gjs
index e9f2458576e..762b3e9eab5 100644
--- a/frontend/discourse/tests/integration/components/group-list-setting-test.gjs
+++ b/frontend/discourse/tests/integration/components/group-list-setting-test.gjs
@@ -9,8 +9,6 @@ module("Integration | Component | group-list site-setting", function (hooks) {
setupRenderingTest(hooks);
test("default", async function (assert) {
- const self = this;
-
this.site.groups = [
{
id: 1,
@@ -38,7 +36,7 @@ module("Integration | Component | group-list site-setting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
const subject = selectKit(".list-setting");
@@ -60,8 +58,6 @@ module("Integration | Component | group-list site-setting", function (hooks) {
});
test("mandatory values", async function (assert) {
- const self = this;
-
this.site.groups = [
{
id: 1,
@@ -90,7 +86,7 @@ module("Integration | Component | group-list site-setting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
const subject = selectKit(".list-setting");
diff --git a/frontend/discourse/tests/integration/components/group-membership-button-test.gjs b/frontend/discourse/tests/integration/components/group-membership-button-test.gjs
index 37682573f78..b2797cef040 100644
--- a/frontend/discourse/tests/integration/components/group-membership-button-test.gjs
+++ b/frontend/discourse/tests/integration/components/group-membership-button-test.gjs
@@ -7,12 +7,10 @@ module("Integration | Component | group-membership-button", function (hooks) {
setupRenderingTest(hooks);
test("canJoinGroup", async function (assert) {
- const self = this;
-
this.set("model", { public_admission: false, is_group_user: true });
await render(
- <template><GroupMembershipButton @model={{self.model}} /></template>
+ <template><GroupMembershipButton @model={{this.model}} /></template>
);
assert
@@ -29,12 +27,10 @@ module("Integration | Component | group-membership-button", function (hooks) {
});
test("canLeaveGroup", async function (assert) {
- const self = this;
-
this.set("model", { public_exit: false, is_group_user: false });
await render(
- <template><GroupMembershipButton @model={{self.model}} /></template>
+ <template><GroupMembershipButton @model={{this.model}} /></template>
);
assert
@@ -51,15 +47,13 @@ module("Integration | Component | group-membership-button", function (hooks) {
});
test("canRequestMembership", async function (assert) {
- const self = this;
-
this.set("model", {
allow_membership_requests: true,
is_group_user: true,
});
await render(
- <template><GroupMembershipButton @model={{self.model}} /></template>
+ <template><GroupMembershipButton @model={{this.model}} /></template>
);
assert
diff --git a/frontend/discourse/tests/integration/components/invite-panel-test.gjs b/frontend/discourse/tests/integration/components/invite-panel-test.gjs
index 886cca419fa..34571ddbb55 100644
--- a/frontend/discourse/tests/integration/components/invite-panel-test.gjs
+++ b/frontend/discourse/tests/integration/components/invite-panel-test.gjs
@@ -10,8 +10,6 @@ module("Integration | Component | invite-panel", function (hooks) {
setupRenderingTest(hooks);
test("shows the invite link after it is generated", async function (assert) {
- const self = this;
-
pretender.get("/u/search/users", () => response({ users: [] }));
pretender.post("/invites", () =>
@@ -27,7 +25,7 @@ module("Integration | Component | invite-panel", function (hooks) {
this.set("inviteModel", user);
await render(
- <template><InvitePanel @inviteModel={{self.inviteModel}} /></template>
+ <template><InvitePanel @inviteModel={{this.inviteModel}} /></template>
);
const input = selectKit(".invite-user-input");
diff --git a/frontend/discourse/tests/integration/components/number-field-test.gjs b/frontend/discourse/tests/integration/components/number-field-test.gjs
index 10450d2b451..822c02feeb1 100644
--- a/frontend/discourse/tests/integration/components/number-field-test.gjs
+++ b/frontend/discourse/tests/integration/components/number-field-test.gjs
@@ -11,11 +11,9 @@ module("Integration | Component | number-field", function (hooks) {
this.set("value", 123);
await withSilencedDeprecationsAsync("discourse.number-field", async () => {
- const self = this;
-
await render(
<template>
- <NumberField @value={{self.value}} @classNames="number-field-test" />
+ <NumberField @value={{this.value}} @classNames="number-field-test" />
</template>
);
});
@@ -42,12 +40,10 @@ module("Integration | Component | number-field", function (hooks) {
this.set("value", "");
await withSilencedDeprecationsAsync("discourse.number-field", async () => {
- const self = this;
-
await render(
<template>
<NumberField
- @value={{self.value}}
+ @value={{this.value}}
@classNames="number-field-test"
@min="1"
/>
@@ -65,12 +61,10 @@ module("Integration | Component | number-field", function (hooks) {
);
await withSilencedDeprecationsAsync("discourse.number-field", async () => {
- const self = this;
-
await render(
<template>
<NumberField
- @value={{self.value}}
+ @value={{this.value}}
@classNames="number-field-test"
@min="-10"
/>
diff --git a/frontend/discourse/tests/integration/components/pinned-options-test.gjs b/frontend/discourse/tests/integration/components/pinned-options-test.gjs
index 46295a8e6d6..70ed0e7e1b9 100644
--- a/frontend/discourse/tests/integration/components/pinned-options-test.gjs
+++ b/frontend/discourse/tests/integration/components/pinned-options-test.gjs
@@ -8,8 +8,6 @@ module("Integration | Component | pinned-options", function (hooks) {
setupRenderingTest(hooks);
test("unpinning", async function (assert) {
- const self = this;
-
this.siteSettings.automatically_unpin_topics = false;
const store = getOwner(this).lookup("service:store");
@@ -25,7 +23,7 @@ module("Integration | Component | pinned-options", function (hooks) {
await render(
<template>
- <PinnedOptions @value={{self.topic.pinned}} @topic={{self.topic}} />
+ <PinnedOptions @value={{this.topic.pinned}} @topic={{this.topic}} />
</template>
);
@@ -40,8 +38,6 @@ module("Integration | Component | pinned-options", function (hooks) {
});
test("pinning", async function (assert) {
- const self = this;
-
this.siteSettings.automatically_unpin_topics = false;
const store = getOwner(this).lookup("service:store");
@@ -58,7 +54,7 @@ module("Integration | Component | pinned-options", function (hooks) {
await render(
<template>
- <PinnedOptions @value={{self.topic.pinned}} @topic={{self.topic}} />
+ <PinnedOptions @value={{this.topic.pinned}} @topic={{this.topic}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/secret-value-list-test.gjs b/frontend/discourse/tests/integration/components/secret-value-list-test.gjs
index 85a94d9a868..e7c23d75c2b 100644
--- a/frontend/discourse/tests/integration/components/secret-value-list-test.gjs
+++ b/frontend/discourse/tests/integration/components/secret-value-list-test.gjs
@@ -8,15 +8,13 @@ module("Integration | Component | secret-value-list", function (hooks) {
setupRenderingTest(hooks);
test("adding a value", async function (assert) {
- const self = this;
-
this.set("setValidationMessage", () => {});
await render(
<template>
<SecretValueList
- @values={{self.values}}
- @setValidationMessage={{self.setValidationMessage}}
+ @values={{this.values}}
+ @setValidationMessage={{this.setValidationMessage}}
/>
</template>
);
@@ -60,8 +58,6 @@ module("Integration | Component | secret-value-list", function (hooks) {
});
test("adding an invalid value", async function (assert) {
- const self = this;
-
let setValidationMessage = (message) => {
this.set("message", message);
};
@@ -70,8 +66,8 @@ module("Integration | Component | secret-value-list", function (hooks) {
await render(
<template>
<SecretValueList
- @values={{self.values}}
- @setValidationMessage={{self.setValidationMessage}}
+ @values={{this.values}}
+ @setValidationMessage={{this.setValidationMessage}}
/>
</template>
);
@@ -98,15 +94,13 @@ module("Integration | Component | secret-value-list", function (hooks) {
});
test("changing a value", async function (assert) {
- const self = this;
-
this.set("setValidationMessage", () => {});
await render(
<template>
<SecretValueList
- @values={{self.values}}
- @setValidationMessage={{self.setValidationMessage}}
+ @values={{this.values}}
+ @setValidationMessage={{this.setValidationMessage}}
/>
</template>
);
@@ -140,15 +134,13 @@ module("Integration | Component | secret-value-list", function (hooks) {
});
test("removing a value", async function (assert) {
- const self = this;
-
this.set("setValidationMessage", () => {});
await render(
<template>
<SecretValueList
- @values={{self.values}}
- @setValidationMessage={{self.setValidationMessage}}
+ @values={{this.values}}
+ @setValidationMessage={{this.setValidationMessage}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/api-test.gjs b/frontend/discourse/tests/integration/components/select-kit/api-test.gjs
index a42ec3096ae..7522d94e7b5 100644
--- a/frontend/discourse/tests/integration/components/select-kit/api-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/api-test.gjs
@@ -25,8 +25,6 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).appendContent", async function (assert) {
- const self = this;
-
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi((api) => {
@@ -42,14 +40,14 @@ module("Integration | Component | select-kit/api", function (hooks) {
await render(
<template>
<ComboBox
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
</template>
);
@@ -67,8 +65,6 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).prependContent", async function (assert) {
- const self = this;
-
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi((api) => {
@@ -84,14 +80,14 @@ module("Integration | Component | select-kit/api", function (hooks) {
await render(
<template>
<ComboBox
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
</template>
);
@@ -109,8 +105,6 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).onChange", async function (assert) {
- const self = this;
-
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi((api) => {
@@ -123,9 +117,9 @@ module("Integration | Component | select-kit/api", function (hooks) {
<template>
<div id="test"></div>
<ComboBox
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
</template>
);
@@ -136,8 +130,6 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).replaceContent", async function (assert) {
- const self = this;
-
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi((api) => {
@@ -153,14 +145,14 @@ module("Integration | Component | select-kit/api", function (hooks) {
await render(
<template>
<ComboBox
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/category-chooser-test.gjs b/frontend/discourse/tests/integration/components/select-kit/category-chooser-test.gjs
index da9bede8a8f..3db9d0377cb 100644
--- a/frontend/discourse/tests/integration/components/select-kit/category-chooser-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/category-chooser-test.gjs
@@ -17,11 +17,10 @@ module(
});
test("with value", async function (assert) {
- const self = this;
this.set("value", 2);
await render(
- <template><CategoryChooser @value={{self.value}} /></template>
+ <template><CategoryChooser @value={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().value(), "2");
@@ -29,11 +28,10 @@ module(
});
test("with excludeCategoryId", async function (assert) {
- const self = this;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash excludeCategoryId=2}}
/>
</template>
@@ -45,11 +43,10 @@ module(
});
test("with scopedCategoryId", async function (assert) {
- const self = this;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash scopedCategoryId=2}}
/>
</template>
@@ -77,11 +74,10 @@ module(
});
test("with prioritizedCategoryId", async function (assert) {
- const self = this;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash prioritizedCategoryId=5}}
/>
</template>
@@ -114,13 +110,12 @@ module(
});
test("with allowUncategorized=null", async function (assert) {
- const self = this;
this.siteSettings.allow_uncategorized_topics = false;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=null}}
/>
</template>
@@ -131,14 +126,13 @@ module(
});
test("with allowUncategorized=null and defaultComposerCategory present", async function (assert) {
- const self = this;
this.siteSettings.allow_uncategorized_topics = false;
this.siteSettings.default_composer_category = 4;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=null}}
/>
</template>
@@ -149,14 +143,13 @@ module(
});
test("with allowUncategorized=null and defaultComposerCategory present, but not set", async function (assert) {
- const self = this;
this.siteSettings.allow_uncategorized_topics = false;
this.siteSettings.default_composer_category = -1;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=null}}
/>
</template>
@@ -167,13 +160,12 @@ module(
});
test("with allowUncategorized=null none=true", async function (assert) {
- const self = this;
this.siteSettings.allow_uncategorized_topics = false;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=null none=true}}
/>
</template>
@@ -184,14 +176,13 @@ module(
});
test("with disallowed uncategorized, none", async function (assert) {
- const self = this;
I18n.translations[I18n.locale].js.test = { root: "root none label" };
this.siteSettings.allow_uncategorized_topics = false;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=null none="test.root"}}
/>
</template>
@@ -202,13 +193,12 @@ module(
});
test("with allowed uncategorized", async function (assert) {
- const self = this;
this.siteSettings.allow_uncategorized_topics = true;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=true}}
/>
</template>
@@ -219,13 +209,12 @@ module(
});
test("with allowed uncategorized and none=true", async function (assert) {
- const self = this;
this.siteSettings.allow_uncategorized_topics = true;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=true none=true}}
/>
</template>
@@ -236,14 +225,13 @@ module(
});
test("with allowed uncategorized and none", async function (assert) {
- const self = this;
I18n.translations[I18n.locale].js.test = { root: "root none label" };
this.siteSettings.allow_uncategorized_topics = true;
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash allowUncategorized=true none="test.root"}}
/>
</template>
@@ -254,9 +242,8 @@ module(
});
test("filter is case insensitive", async function (assert) {
- const self = this;
await render(
- <template><CategoryChooser @value={{self.value}} /></template>
+ <template><CategoryChooser @value={{this.value}} /></template>
);
await this.subject.expand();
@@ -273,7 +260,6 @@ module(
});
test("filter works with non english characters", async function (assert) {
- const self = this;
const store = getOwner(this).lookup("service:store");
store.createRecord("category", {
id: 1,
@@ -281,7 +267,7 @@ module(
});
await render(
- <template><CategoryChooser @value={{self.value}} /></template>
+ <template><CategoryChooser @value={{this.value}} /></template>
);
await this.subject.expand();
@@ -292,7 +278,6 @@ module(
});
test("decodes entities in row title", async function (assert) {
- const self = this;
const store = getOwner(this).lookup("service:store");
store.createRecord("category", {
id: 1,
@@ -303,7 +288,7 @@ module(
await render(
<template>
<CategoryChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash scopedCategoryId=1}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/select-kit/category-drop-test.gjs b/frontend/discourse/tests/integration/components/select-kit/category-drop-test.gjs
index 7dd5b2d86e9..3987f217ccd 100644
--- a/frontend/discourse/tests/integration/components/select-kit/category-drop-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/category-drop-test.gjs
@@ -42,11 +42,9 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("caretUpIcon", async function (assert) {
- const self = this;
-
await render(
<template>
- <CategoryDrop @category={{self.value}} @categories={{self.content}} />
+ <CategoryDrop @category={{this.value}} @categories={{this.content}} />
</template>
);
@@ -56,11 +54,9 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("none", async function (assert) {
- const self = this;
-
await render(
<template>
- <CategoryDrop @category={{self.value}} @categories={{self.content}} />
+ <CategoryDrop @category={{this.value}} @categories={{this.content}} />
</template>
);
@@ -73,8 +69,6 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("[not staff - TL0] displayCategoryDescription", async function (assert) {
- const self = this;
-
set(this.currentUser, "staff", false);
set(this.currentUser, "trust_level", 0);
@@ -83,9 +77,9 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -99,8 +93,6 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("[not staff - TL1] displayCategoryDescription", async function (assert) {
- const self = this;
-
set(this.currentUser, "moderator", false);
set(this.currentUser, "admin", false);
set(this.currentUser, "trust_level", 1);
@@ -109,9 +101,9 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -125,8 +117,6 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("[staff - TL0] displayCategoryDescription", async function (assert) {
- const self = this;
-
set(this.currentUser, "moderator", true);
set(this.currentUser, "trust_level", 0);
@@ -135,9 +125,9 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -151,16 +141,14 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("hideParentCategory (default: false)", async function (assert) {
- const self = this;
-
initCategories(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -173,16 +161,14 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("hideParentCategory (true)", async function (assert) {
- const self = this;
-
initCategoriesWithParentCategory(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
@options={{hash hideParentCategory=true}}
/>
</template>
@@ -202,17 +188,15 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("allow_uncategorized_topics (true)", async function (assert) {
- const self = this;
-
this.siteSettings.allow_uncategorized_topics = true;
initCategories(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -225,17 +209,15 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("allow_uncategorized_topics (false)", async function (assert) {
- const self = this;
-
this.siteSettings.allow_uncategorized_topics = false;
initCategories(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -248,16 +230,14 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("countSubcategories (default: false)", async function (assert) {
- const self = this;
-
initCategories(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -273,16 +253,14 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("countSubcategories (true)", async function (assert) {
- const self = this;
-
initCategories(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
@options={{hash countSubcategories=true}}
/>
</template>
@@ -299,17 +277,15 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts:default", async function (assert) {
- const self = this;
-
initCategories(this);
this.set("category", null);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -324,16 +300,14 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts:category is set", async function (assert) {
- const self = this;
-
initCategories(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
@@ -344,16 +318,14 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts with parentCategory/subCategory=true:default", async function (assert) {
- const self = this;
-
initCategoriesWithParentCategory(this);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
@options={{hash subCategory=true}}
/>
</template>
@@ -365,17 +337,15 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts with parentCategory/subCategory=true:category is selected", async function (assert) {
- const self = this;
-
initCategoriesWithParentCategory(this);
this.set("category", this.categories.firstObject);
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
@options={{hash subCategory=true}}
/>
</template>
@@ -388,17 +358,15 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("category url", async function (assert) {
- const self = this;
-
initCategoriesWithParentCategory(this);
sinon.stub(DiscourseURL, "routeTo");
await render(
<template>
<CategoryDrop
- @category={{self.category}}
- @categories={{self.categories}}
- @parentCategory={{self.parentCategory}}
+ @category={{this.category}}
+ @categories={{this.categories}}
+ @parentCategory={{this.parentCategory}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/category-selector-test.gjs b/frontend/discourse/tests/integration/components/select-kit/category-selector-test.gjs
index 5fd9196ebed..a0b3b7dbb06 100644
--- a/frontend/discourse/tests/integration/components/select-kit/category-selector-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/category-selector-test.gjs
@@ -15,14 +15,12 @@ module(
});
test("with value", async function (assert) {
- const self = this;
-
const category = Category.findById(1001);
const subcategory = Category.findById(1002);
this.set("value", [category, subcategory]);
await render(
- <template><CategorySelector @categories={{self.value}} /></template>
+ <template><CategorySelector @categories={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().value(), "1001,1002");
@@ -33,12 +31,10 @@ module(
});
test("has +subcategories row", async function (assert) {
- const self = this;
-
this.set("value", []);
await render(
- <template><CategorySelector @categories={{self.value}} /></template>
+ <template><CategorySelector @categories={{this.value}} /></template>
);
await this.subject.expand();
await this.subject.fillInFilter("Parent Category");
diff --git a/frontend/discourse/tests/integration/components/select-kit/color-palette-picker-test.gjs b/frontend/discourse/tests/integration/components/select-kit/color-palette-picker-test.gjs
index 084b2a0a94f..d6f3f72ee3c 100644
--- a/frontend/discourse/tests/integration/components/select-kit/color-palette-picker-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/color-palette-picker-test.gjs
@@ -87,14 +87,12 @@ module(
test("with value", async function (assert) {
setDefaultState(this);
- const self = this;
-
await render(
<template>
<ColorPalettePicker
- @content={{self.content}}
- @value={{self.value}}
- @onChange={{self.onChange}}
+ @content={{this.content}}
+ @value={{this.value}}
+ @onChange={{this.onChange}}
/>
</template>
);
@@ -128,14 +126,12 @@ module(
test("with theme default", async function (assert) {
setDefaultState(this, { value: null });
- const self = this;
-
await render(
<template>
<ColorPalettePicker
- @content={{self.content}}
- @value={{self.value}}
- @onChange={{self.onChange}}
+ @content={{this.content}}
+ @value={{this.value}}
+ @onChange={{this.onChange}}
@options={{hash
translatedNone=(i18n "admin.customize.theme.default_light_scheme")
}}
diff --git a/frontend/discourse/tests/integration/components/select-kit/combo-box-test.gjs b/frontend/discourse/tests/integration/components/select-kit/combo-box-test.gjs
index bc300899566..3a23b9cc40f 100644
--- a/frontend/discourse/tests/integration/components/select-kit/combo-box-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/combo-box-test.gjs
@@ -32,8 +32,6 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
});
test("options.clearable", async function (assert) {
- const self = this;
-
setDefaultState(this, {
clearable: true,
onChange: (value) => {
@@ -44,10 +42,10 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
await render(
<template>
<ComboBox
- @value={{self.value}}
- @content={{self.content}}
- @onChange={{self.onChange}}
- @options={{hash clearable=self.clearable}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @onChange={{this.onChange}}
+ @options={{hash clearable=this.clearable}}
/>
</template>
);
@@ -66,8 +64,6 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
});
test("options.{caretUpIcon,caretDownIcon}", async function (assert) {
- const self = this;
-
setDefaultState(this, {
caretUpIcon: "pencil",
caretDownIcon: "trash-can",
@@ -76,11 +72,11 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
await render(
<template>
<ComboBox
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash
- caretUpIcon=self.caretUpIcon
- caretDownIcon=self.caretDownIcon
+ caretUpIcon=this.caretUpIcon
+ caretDownIcon=this.caretDownIcon
}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs b/frontend/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs
index 2fd0da50a6c..54e0549fa65 100644
--- a/frontend/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs
@@ -37,13 +37,11 @@ module(
});
test("selection behavior", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
- <DropdownSelectBox @value={{self.value}} @content={{self.content}} />
+ <DropdownSelectBox @value={{this.value}} @content={{this.content}} />
</template>
);
@@ -58,8 +56,6 @@ module(
});
test("options.showFullTitle=false", async function (assert) {
- const self = this;
-
setDefaultState(this, {
value: null,
showFullTitle: false,
@@ -69,12 +65,12 @@ module(
await render(
<template>
<DropdownSelectBox
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash
icon="xmark"
- showFullTitle=self.showFullTitle
- none=self.none
+ showFullTitle=this.showFullTitle
+ none=this.none
}}
/>
</template>
@@ -94,16 +90,14 @@ module(
});
test("options.showFullTitle=true", async function (assert) {
- const self = this;
-
setDefaultState(this, { showFullTitle: true });
await render(
<template>
<DropdownSelectBox
- @value={{self.value}}
- @content={{self.content}}
- @options={{hash showFullTitle=self.showFullTitle}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @options={{hash showFullTitle=this.showFullTitle}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs b/frontend/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs
index c009fc7253e..70e4c6dabb1 100644
--- a/frontend/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs
@@ -47,8 +47,6 @@ module(
});
test("excluding usernames", async function (assert) {
- const self = this;
-
pretender.get("/u/search/users", () => {
const users = [
{
@@ -74,7 +72,7 @@ module(
await render(
<template>
<EmailGroupUserChooser
- @options={{hash excludedUsernames=self.excludedUsernames}}
+ @options={{hash excludedUsernames=this.excludedUsernames}}
/>
</template>
);
@@ -89,7 +87,7 @@ module(
await render(
<template>
<EmailGroupUserChooser
- @options={{hash excludedUsernames=self.excludedUsernames}}
+ @options={{hash excludedUsernames=this.excludedUsernames}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs b/frontend/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs
index f5e83348871..25010bf7f87 100644
--- a/frontend/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs
@@ -32,12 +32,10 @@ module(
});
test("displays selected value", async function (assert) {
- const self = this;
-
this.set("value", [1]);
await render(
- <template><FormTemplateChooser @value={{self.value}} /></template>
+ <template><FormTemplateChooser @value={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().name(), "template 1");
diff --git a/frontend/discourse/tests/integration/components/select-kit/future-date-input-test.gjs b/frontend/discourse/tests/integration/components/select-kit/future-date-input-test.gjs
index 86de3ce9e8b..e9e3e1217a1 100644
--- a/frontend/discourse/tests/integration/components/select-kit/future-date-input-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/future-date-input-test.gjs
@@ -118,15 +118,13 @@ module(
});
test("changing date/time updates the input correctly", async function (assert) {
- const self = this;
-
this.set("input", moment("2032-01-01 11:10"));
await render(
<template>
<FutureDateInput
- @input={{self.input}}
- @onChangeInput={{fn (mut self.input)}}
+ @input={{this.input}}
+ @onChangeInput={{fn (mut this.input)}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/list-setting-test.gjs b/frontend/discourse/tests/integration/components/select-kit/list-setting-test.gjs
index 83f03244cdb..687bd0e6d00 100644
--- a/frontend/discourse/tests/integration/components/select-kit/list-setting-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/list-setting-test.gjs
@@ -12,14 +12,12 @@ module("Integration | Component | select-kit/list-setting", function (hooks) {
});
test("default", async function (assert) {
- const self = this;
-
this.set("value", ["bold", "italic"]);
this.set("choices", ["bold", "italic", "underline"]);
await render(
<template>
- <ListSetting @value={{self.value}} @choices={{self.choices}} />
+ <ListSetting @value={{this.value}} @choices={{this.choices}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs b/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
index c8b528d46c6..44aff274dbb 100644
--- a/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
@@ -17,24 +17,20 @@ module(
});
test("displays tags", async function (assert) {
- const self = this;
-
this.set("value", ["foo", "bar"]);
await render(
- <template><MiniTagChooser @value={{self.value}} /></template>
+ <template><MiniTagChooser @value={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().value(), "foo,bar");
});
test("create a tag", async function (assert) {
- const self = this;
-
this.set("value", ["foo", "bar"]);
await render(
- <template><MiniTagChooser @value={{self.value}} /></template>
+ <template><MiniTagChooser @value={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().value(), "foo,bar");
@@ -56,13 +52,11 @@ module(
});
test("max_tags_per_topic", async function (assert) {
- const self = this;
-
this.set("value", ["foo", "bar"]);
this.siteSettings.max_tags_per_topic = 2;
await render(
- <template><MiniTagChooser @value={{self.value}} /></template>
+ <template><MiniTagChooser @value={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().value(), "foo,bar");
@@ -79,13 +73,11 @@ module(
});
test("disables search and shows limit when max_tags_per_topic is zero", async function (assert) {
- const self = this;
-
this.set("value", ["cat", "kit"]);
this.siteSettings.max_tags_per_topic = 0;
await render(
- <template><MiniTagChooser @value={{self.value}} /></template>
+ <template><MiniTagChooser @value={{this.value}} /></template>
);
assert.strictEqual(this.subject.header().value(), "cat,kit");
@@ -103,14 +95,12 @@ module(
});
test("required_tag_group", async function (assert) {
- const self = this;
-
this.set("value", ["foo", "bar"]);
await render(
<template>
<MiniTagChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash categoryId=1}}
/>
</template>
@@ -169,16 +159,14 @@ module(
});
test("values in hiddenFromPreview will not display in preview", async function (assert) {
- const self = this;
-
this.set("value", ["foo", "bar"]);
this.set("hiddenValues", ["foo"]);
await render(
<template>
<MiniTagChooser
- @options={{hash allowAny=true hiddenValues=self.hiddenValues}}
- @value={{self.value}}
+ @options={{hash allowAny=true hiddenValues=this.hiddenValues}}
+ @value={{this.value}}
/>
</template>
);
@@ -205,14 +193,12 @@ module(
});
test("displays tags and filter in header", async function (assert) {
- const self = this;
-
this.set("value", ["apple", "orange", "potato"]);
await render(
<template>
<MiniTagChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash filterable=true useHeaderFilter=true}}
/>
</template>
@@ -246,14 +232,12 @@ module(
});
test("removing a tag does not display the dropdown", async function (assert) {
- const self = this;
-
this.set("value", ["apple", "orange", "potato"]);
await render(
<template>
<MiniTagChooser
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash filterable=true useHeaderFilter=true}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/select-kit/multi-select-test.gjs b/frontend/discourse/tests/integration/components/select-kit/multi-select-test.gjs
index 12ebc2b3201..adff30b147d 100644
--- a/frontend/discourse/tests/integration/components/select-kit/multi-select-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/multi-select-test.gjs
@@ -31,13 +31,11 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
});
test("content", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
- <MultiSelect @value={{self.value}} @content={{self.content}} />
+ <MultiSelect @value={{this.value}} @content={{this.content}} />
</template>
);
@@ -63,15 +61,13 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
});
test("maximum=1", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
<MultiSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash maximum=1}}
/>
</template>
@@ -92,15 +88,13 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
});
test("maximum=2", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
<MultiSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash maximum=2}}
/>
</template>
@@ -113,15 +107,13 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
});
test("pasting", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
<MultiSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash maximum=2}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/select-kit/notifications-button-test.gjs b/frontend/discourse/tests/integration/components/select-kit/notifications-button-test.gjs
index ee2d35be78b..f9ae2c5eaf6 100644
--- a/frontend/discourse/tests/integration/components/select-kit/notifications-button-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/notifications-button-test.gjs
@@ -17,18 +17,16 @@ module(
});
test("default", async function (assert) {
- const self = this;
-
this.set("value", 1);
setDefaultState(this, 1, { i18nPrefix: "pre", i18nPostfix: "post" });
await render(
<template>
<NotificationsButton
- @value={{self.value}}
+ @value={{this.value}}
@options={{hash
- i18nPrefix=self.i18nPrefix
- i18nPostfix=self.i18nPostfix
+ i18nPrefix=this.i18nPrefix
+ i18nPostfix=this.i18nPostfix
}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs b/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs
index c06dfe94264..4877bf22307 100644
--- a/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs
@@ -39,12 +39,10 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("content", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
- <template><SingleSelect @content={{self.content}} /></template>
+ <template><SingleSelect @content={{this.content}} /></template>
);
await this.subject.expand();
@@ -69,12 +67,10 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("accessibility", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
- <template><SingleSelect @content={{self.content}} /></template>
+ <template><SingleSelect @content={{this.content}} /></template>
);
await this.subject.expand();
@@ -119,18 +115,16 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("value", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
/>
</template>
);
@@ -143,19 +137,17 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.filterable", async function (assert) {
- const self = this;
-
setDefaultState(this, { filterable: true });
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
- @options={{hash filterable=self.filterable}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
+ @options={{hash filterable=this.filterable}}
/>
</template>
);
@@ -173,21 +165,19 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.limitMatches", async function (assert) {
- const self = this;
-
setDefaultState(this, { limitMatches: 1, filterable: true });
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
@options={{hash
- limitMatches=self.limitMatches
- filterable=self.filterable
+ limitMatches=this.limitMatches
+ filterable=this.filterable
}}
/>
</template>
@@ -204,8 +194,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("valueAttribute (deprecated)", async function (assert) {
- const self = this;
-
this.set("value", "normal");
const content = [
@@ -220,8 +208,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@valueAttribute="value"
/>
</template>
@@ -233,19 +221,17 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("none:string", async function (assert) {
- const self = this;
-
I18n.translations[I18n.locale].js.test = { none: "(default)" };
setDefaultState(this, { value: 1 });
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
@options={{hash none="test.none"}}
/>
</template>
@@ -259,19 +245,17 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("none:object", async function (assert) {
- const self = this;
-
setDefaultState(this, { none: { value: null, name: "(default)" } });
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
- @options={{hash none=self.none}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
+ @options={{hash none=this.none}}
/>
</template>
);
@@ -284,8 +268,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("content is a basic array", async function (assert) {
- const self = this;
-
I18n.translations[I18n.locale].js.test = { none: "(default)" };
setDefaultState(this, {
nameProperty: null,
@@ -297,11 +279,11 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
@options={{hash none="test.none"}}
/>
</template>
@@ -320,8 +302,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("selected value can be 0", async function (assert) {
- const self = this;
-
setDefaultState(this, {
value: 1,
content: [
@@ -333,11 +313,11 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
/>
</template>
);
@@ -351,8 +331,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("prevents propagating click event on header", async function (assert) {
- const self = this;
-
this.setProperties({
onClick: () => this.set("value", "foo"),
content: DEFAULT_CONTENT,
@@ -361,10 +339,10 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
- <DButton @icon="xmark" @action={{self.onClick}}>
+ <DButton @icon="xmark" @action={{this.onClick}}>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash preventsClickPropagation=true}}
/>
</DButton>
@@ -377,8 +355,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("labelProperty", async function (assert) {
- const self = this;
-
this.setProperties({
content: [{ id: 1, name: "john", foo: "JACKSON" }],
value: 1,
@@ -388,8 +364,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
<template>
<SingleSelect
@labelProperty="foo"
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
/>
</template>
);
@@ -404,8 +380,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("titleProperty", async function (assert) {
- const self = this;
-
this.setProperties({
content: [{ id: 1, name: "john", foo: "JACKSON" }],
value: 1,
@@ -415,8 +389,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
<template>
<SingleSelect
@titleProperty="foo"
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
/>
</template>
);
@@ -431,8 +405,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("langProperty", async function (assert) {
- const self = this;
-
this.setProperties({
content: [{ id: 1, name: "john", foo: "be" }],
value: null,
@@ -442,8 +414,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
<template>
<SingleSelect
@langProperty="foo"
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
/>
</template>
);
@@ -467,8 +439,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("name", async function (assert) {
- const self = this;
-
this.setProperties({
content: [{ id: 1, name: "john" }],
value: null,
@@ -476,7 +446,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
- <SingleSelect @value={{self.value}} @content={{self.content}} />
+ <SingleSelect @value={{this.value}} @content={{this.content}} />
</template>
);
@@ -496,8 +466,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("row index", async function (assert) {
- const self = this;
-
this.setProperties({
content: [
{ id: 1, name: "john" },
@@ -508,7 +476,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
- <SingleSelect @value={{self.value}} @content={{self.content}} />
+ <SingleSelect @value={{this.value}} @content={{this.content}} />
</template>
);
await this.subject.expand();
@@ -518,18 +486,16 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.verticalOffset", async function (assert) {
- const self = this;
-
setDefaultState(this, { verticalOffset: -50 });
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
- @nameProperty={{self.nameProperty}}
- @valueProperty={{self.valueProperty}}
- @onChange={{self.onChange}}
- @options={{hash verticalOffset=self.verticalOffset}}
+ @value={{this.value}}
+ @content={{this.content}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChange}}
+ @options={{hash verticalOffset=this.verticalOffset}}
/>
</template>
);
@@ -541,14 +507,12 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.expandedOnInsert", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash expandedOnInsert=true}}
/>
</template>
@@ -558,14 +522,12 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.formName", async function (assert) {
- const self = this;
-
setDefaultState(this);
await render(
<template>
<SingleSelect
- @value={{self.value}}
- @content={{self.content}}
+ @value={{this.value}}
+ @content={{this.content}}
@options={{hash formName="foo"}}
/>
</template>
@@ -578,8 +540,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("disabled", async function (assert) {
- const self = this;
-
this.setProperties({
content: [{ id: 1, name: "john", disabled: true }],
value: null,
@@ -587,7 +547,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await render(
<template>
- <SingleSelect @value={{self.value}} @content={{self.content}} />
+ <SingleSelect @value={{this.value}} @content={{this.content}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/select-kit/user-chooser-test.gjs b/frontend/discourse/tests/integration/components/select-kit/user-chooser-test.gjs
index 40fc115d828..374182b99f0 100644
--- a/frontend/discourse/tests/integration/components/select-kit/user-chooser-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/user-chooser-test.gjs
@@ -12,21 +12,17 @@ module("Integration | Component | select-kit/user-chooser", function (hooks) {
});
test("displays usernames", async function (assert) {
- const self = this;
-
this.set("value", ["bob", "martin"]);
- await render(<template><UserChooser @value={{self.value}} /></template>);
+ await render(<template><UserChooser @value={{this.value}} /></template>);
assert.strictEqual(this.subject.header().name(), "bob,martin");
});
test("can remove a username", async function (assert) {
- const self = this;
-
this.set("value", ["bob", "martin"]);
- await render(<template><UserChooser @value={{self.value}} /></template>);
+ await render(<template><UserChooser @value={{this.value}} /></template>);
await this.subject.expand();
await this.subject.deselectItemByValue("bob");
@@ -34,8 +30,6 @@ module("Integration | Component | select-kit/user-chooser", function (hooks) {
});
test("can display default search results", async function (assert) {
- const self = this;
-
this.set("options", {
customSearchOptions: {
defaultSearchResults: [{ username: "foo" }, { username: "bar" }],
@@ -43,7 +37,7 @@ module("Integration | Component | select-kit/user-chooser", function (hooks) {
});
await render(
- <template><UserChooser @options={{self.options}} /></template>
+ <template><UserChooser @options={{this.options}} /></template>
);
await this.subject.expand();
diff --git a/frontend/discourse/tests/integration/components/sidebar/section-test.gjs b/frontend/discourse/tests/integration/components/sidebar/section-test.gjs
index 799fec2d7b9..bb3e4c12097 100644
--- a/frontend/discourse/tests/integration/components/sidebar/section-test.gjs
+++ b/frontend/discourse/tests/integration/components/sidebar/section-test.gjs
@@ -7,15 +7,13 @@ module("Integration | Component | sidebar | section", function (hooks) {
setupRenderingTest(hooks);
test("default displaySection value for section", async function (assert) {
- const self = this;
-
const template = <template>
<Section
@sectionName="test"
@headerLinkText="test header"
@headerLinkTitle="some title"
@headerActionsIcon="plus"
- @headerActions={{self.headerActions}}
+ @headerActions={{this.headerActions}}
/>
</template>;
@@ -28,16 +26,14 @@ module("Integration | Component | sidebar | section", function (hooks) {
});
test("displaySection is dynamic based on argument", async function (assert) {
- const self = this;
-
const template = <template>
<Section
@sectionName="test"
@headerLinkText="test header"
@headerLinkTitle="some title"
@headerActionsIcon="plus"
- @headerActions={{self.headerActions}}
- @displaySection={{self.displaySection}}
+ @headerActions={{this.headerActions}}
+ @displaySection={{this.displaySection}}
/>
</template>;
@@ -54,15 +50,13 @@ module("Integration | Component | sidebar | section", function (hooks) {
});
test("can expand and collapse content when section is collapsible", async function (assert) {
- const self = this;
-
const template = <template>
<Section
@sectionName="test"
@headerLinkText="test header"
@headerLinkTitle="some title"
@headerActionsIcon="plus"
- @headerActions={{self.headerActions}}
+ @headerActions={{this.headerActions}}
@collapsable={{true}}
/>
</template>;
diff --git a/frontend/discourse/tests/integration/components/site-setting-test.gjs b/frontend/discourse/tests/integration/components/site-setting-test.gjs
index e0f2af6ce46..b963f85b89b 100644
--- a/frontend/discourse/tests/integration/components/site-setting-test.gjs
+++ b/frontend/discourse/tests/integration/components/site-setting-test.gjs
@@ -18,8 +18,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
setupRenderingTest(hooks);
test("displays host-list setting value", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -30,15 +28,13 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert.dom(".formatted-selection").hasText("a.com, b.com");
});
test("error response with html_message is rendered as HTML", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -55,7 +51,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".setting input", "value");
await click(".setting .d-icon-check");
@@ -64,8 +60,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("error response without html_message is not rendered as HTML", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -82,7 +76,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".setting input", "value");
await click(".setting .d-icon-check");
@@ -91,8 +85,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("displays file types list setting", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -103,7 +95,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert.dom(".formatted-selection").hasText("jpg, jpeg, png");
@@ -123,8 +115,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
// Skipping for now because ember-test-helpers doesn't check for defaultPrevented when firing that event chain
skip("prevents decimal in integer setting input", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -135,15 +125,13 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await typeIn(".input-setting-integer", "90,5", { delay: 1000 });
assert.dom(".input-setting-integer").hasValue("905");
});
test("does not consider an integer setting overridden if the value is the same as the default", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -154,7 +142,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
})
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".input-setting-integer", "90");
assert.dom(".input-setting-integer").hasValue("90");
@@ -165,8 +153,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("Input for secret site setting is hidden by default", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -176,7 +162,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
})
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert.dom(".input-setting-string").hasAttribute("type", "password");
assert.dom(".setting-toggle-secret svg").hasClass("d-icon-far-eye");
@@ -189,8 +175,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("shows link to the staff action logs for the setting on hover", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -202,7 +186,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await triggerEvent("[data-setting='enable_badges']", "mouseenter");
@@ -217,8 +201,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("Shows update status for default_categories_ sitesettings", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -229,7 +211,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await publishToMessageBus("/site_setting/default_categories_test/process", {
@@ -253,8 +235,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("Shows update status for default_tags_ sitesettings", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -265,7 +245,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await publishToMessageBus("/site_setting/default_tags_test/process", {
@@ -288,8 +268,6 @@ module("Integration | Component | SiteSetting", function (hooks) {
});
test("Doesn't shows update status for other site settings besides default_tags_test or default_categories_test", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -300,7 +278,7 @@ module("Integration | Component | SiteSetting", function (hooks) {
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await publishToMessageBus("/site_setting/default_tags_test/process", {
@@ -364,8 +342,6 @@ module(
setupRenderingTest(hooks);
test("disables input for themeable site settings", async function (assert) {
- const self = this;
-
this.site = this.container.lookup("service:site");
this.site.set("user_themes", [
{ theme_id: 5, default: true, name: "Default Theme" },
@@ -382,7 +358,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert.dom(".input-setting-string").hasAttribute("disabled", "");
@@ -392,8 +368,6 @@ module(
});
test("shows warning text for themeable site settings", async function (assert) {
- const self = this;
-
this.site = this.container.lookup("service:site");
this.site.set("user_themes", [
{ theme_id: 5, default: true, name: "Default Theme" },
@@ -410,7 +384,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert
@@ -441,8 +415,6 @@ module(
setupRenderingTest(hooks);
test("shows the reset button when the value has been changed from the default", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -456,14 +428,12 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert.dom(".setting-controls__undo").exists("reset button is shown");
});
test("doesn't show the reset button when the value is the same as the default", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -477,7 +447,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert
.dom(".setting-controls__undo")
@@ -485,8 +455,6 @@ module(
});
test("shows validation error when the value exceeds the max limit", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -500,7 +468,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".file-size-input", "5000");
@@ -515,8 +483,6 @@ module(
});
test("shows validation error when the value is below the min limit", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -530,7 +496,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".file-size-input", "100");
@@ -545,8 +511,6 @@ module(
});
test("cancelling pending changes resets the value and removes validation error", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -560,7 +524,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".file-size-input", "100");
@@ -574,8 +538,6 @@ module(
});
test("resetting to the default value changes the content of input field", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -589,7 +551,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert
.dom(".file-size-input")
@@ -610,8 +572,6 @@ module(
});
test("resetting to the default value changes the content of checkbox field", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -623,7 +583,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
assert
.dom("input[type=checkbox]")
@@ -644,8 +604,6 @@ module(
});
test("clearing the input field keeps the cancel button and the validation error shown", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -659,7 +617,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
await fillIn(".file-size-input", "100");
@@ -697,8 +655,6 @@ module(
];
test("base_font sets body-font-X classNames on each field choice", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -716,7 +672,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
const fontSelector = selectKit(".font-selector");
await fontSelector.expand();
@@ -731,8 +687,6 @@ module(
});
test("heading_font sets heading-font-X classNames on each field choice", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -750,7 +704,7 @@ module(
);
await render(
- <template><SiteSettingComponent @setting={{self.setting}} /></template>
+ <template><SiteSettingComponent @setting={{this.setting}} /></template>
);
const fontSelector = selectKit(".font-selector");
await fontSelector.expand();
diff --git a/frontend/discourse/tests/integration/components/slow-mode-info-test.gjs b/frontend/discourse/tests/integration/components/slow-mode-info-test.gjs
index 42784e78cf8..c645ec125bb 100644
--- a/frontend/discourse/tests/integration/components/slow-mode-info-test.gjs
+++ b/frontend/discourse/tests/integration/components/slow-mode-info-test.gjs
@@ -7,38 +7,30 @@ module("Integration | Component | slow-mode-info", function (hooks) {
setupRenderingTest(hooks);
test("doesn't render if the topic is closed", async function (assert) {
- const self = this;
-
this.set("topic", { slow_mode_seconds: 3600, closed: true });
- await render(<template><SlowModeInfo @topic={{self.topic}} /></template>);
+ await render(<template><SlowModeInfo @topic={{this.topic}} /></template>);
assert.dom(".slow-mode-heading").doesNotExist("doesn't render the notice");
});
test("doesn't render if the slow mode is disabled", async function (assert) {
- const self = this;
-
this.set("topic", { slow_mode_seconds: 0, closed: false });
- await render(<template><SlowModeInfo @topic={{self.topic}} /></template>);
+ await render(<template><SlowModeInfo @topic={{this.topic}} /></template>);
assert.dom(".slow-mode-heading").doesNotExist("doesn't render the notice");
});
test("renders if slow mode is enabled", async function (assert) {
- const self = this;
-
this.set("topic", { slow_mode_seconds: 3600, closed: false });
- await render(<template><SlowModeInfo @topic={{self.topic}} /></template>);
+ await render(<template><SlowModeInfo @topic={{this.topic}} /></template>);
assert.dom(".slow-mode-heading").exists();
});
test("staff and TL4 users can disable slow mode", async function (assert) {
- const self = this;
-
this.setProperties({
topic: { slow_mode_seconds: 3600, closed: false },
user: { canManageTopic: true },
@@ -46,7 +38,7 @@ module("Integration | Component | slow-mode-info", function (hooks) {
await render(
<template>
- <SlowModeInfo @topic={{self.topic}} @user={{self.user}} />
+ <SlowModeInfo @topic={{this.topic}} @user={{this.user}} />
</template>
);
@@ -54,8 +46,6 @@ module("Integration | Component | slow-mode-info", function (hooks) {
});
test("regular users can't disable slow mode", async function (assert) {
- const self = this;
-
this.setProperties({
topic: { slow_mode_seconds: 3600, closed: false },
user: { canManageTopic: false },
@@ -63,7 +53,7 @@ module("Integration | Component | slow-mode-info", function (hooks) {
await render(
<template>
- <SlowModeInfo @topic={{self.topic}} @user={{self.user}} />
+ <SlowModeInfo @topic={{this.topic}} @user={{this.user}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/text-field-test.gjs b/frontend/discourse/tests/integration/components/text-field-test.gjs
index dad2aaeda71..e194bad0ab5 100644
--- a/frontend/discourse/tests/integration/components/text-field-test.gjs
+++ b/frontend/discourse/tests/integration/components/text-field-test.gjs
@@ -34,8 +34,6 @@ module("Integration | Component | text-field", function (hooks) {
});
test("supports onChange", async function (assert) {
- const self = this;
-
this.called = false;
this.newValue = null;
this.set("value", "hello");
@@ -48,8 +46,8 @@ module("Integration | Component | text-field", function (hooks) {
<template>
<TextField
class="tf-test"
- @value={{self.value}}
- @onChange={{self.changed}}
+ @value={{this.value}}
+ @onChange={{this.changed}}
/>
</template>
);
@@ -63,8 +61,6 @@ module("Integration | Component | text-field", function (hooks) {
});
test("supports onChangeImmediate", async function (assert) {
- const self = this;
-
this.called = false;
this.newValue = null;
this.set("value", "old");
@@ -77,8 +73,8 @@ module("Integration | Component | text-field", function (hooks) {
<template>
<TextField
class="tf-test"
- @value={{self.value}}
- @onChangeImmediate={{self.changed}}
+ @value={{this.value}}
+ @onChangeImmediate={{this.changed}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/theme-site-setting-editor-test.gjs b/frontend/discourse/tests/integration/components/theme-site-setting-editor-test.gjs
index 109e4ceaab4..d0db3ed2b0e 100644
--- a/frontend/discourse/tests/integration/components/theme-site-setting-editor-test.gjs
+++ b/frontend/discourse/tests/integration/components/theme-site-setting-editor-test.gjs
@@ -9,8 +9,6 @@ module("Integration | Component | ThemeSiteSettingEditor", function (hooks) {
setupRenderingTest(hooks);
test("shows link to the staff action logs for the setting on hover", async function (assert) {
- const self = this;
-
this.set(
"setting",
SiteSetting.create({
@@ -26,8 +24,8 @@ module("Integration | Component | ThemeSiteSettingEditor", function (hooks) {
await render(
<template>
<ThemeSiteSettingEditor
- @setting={{self.setting}}
- @model={{self.model}}
+ @setting={{this.setting}}
+ @model={{this.model}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/themes-list-item-test.gjs b/frontend/discourse/tests/integration/components/themes-list-item-test.gjs
index 8a0bf925514..4d403650e5e 100644
--- a/frontend/discourse/tests/integration/components/themes-list-item-test.gjs
+++ b/frontend/discourse/tests/integration/components/themes-list-item-test.gjs
@@ -9,31 +9,25 @@ module("Integration | Component | themes-list-item", function (hooks) {
setupRenderingTest(hooks);
test("default theme", async function (assert) {
- const self = this;
-
this.set("theme", Theme.create({ name: "Test", default: true }));
- await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
+ await render(<template><ThemesListItem @theme={{this.theme}} /></template>);
assert.dom(".d-icon-check").exists("shows default theme icon");
});
test("pending updates", async function (assert) {
- const self = this;
-
this.set(
"theme",
Theme.create({ name: "Test", remote_theme: { commits_behind: 6 } })
);
- await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
+ await render(<template><ThemesListItem @theme={{this.theme}} /></template>);
assert.dom(".d-icon-arrows-rotate").exists("shows pending update icon");
});
test("broken theme", async function (assert) {
- const self = this;
-
this.set(
"theme",
Theme.create({
@@ -42,14 +36,12 @@ module("Integration | Component | themes-list-item", function (hooks) {
})
);
- await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
+ await render(<template><ThemesListItem @theme={{this.theme}} /></template>);
assert.dom(".d-icon-circle-exclamation").exists("shows broken theme icon");
});
test("with children", async function (assert) {
- const self = this;
-
this.childrenList = [1, 2, 3, 4, 5].map((num) =>
Theme.create({ name: `Child ${num}`, component: true })
);
@@ -63,7 +55,7 @@ module("Integration | Component | themes-list-item", function (hooks) {
})
);
- await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
+ await render(<template><ThemesListItem @theme={{this.theme}} /></template>);
assert.deepEqual(
document
diff --git a/frontend/discourse/tests/integration/components/time-input-test.gjs b/frontend/discourse/tests/integration/components/time-input-test.gjs
index 89b16de5fde..11a0caec6fc 100644
--- a/frontend/discourse/tests/integration/components/time-input-test.gjs
+++ b/frontend/discourse/tests/integration/components/time-input-test.gjs
@@ -16,13 +16,11 @@ module("Integration | Component | time-input", function (hooks) {
});
test("default", async function (assert) {
- const self = this;
-
this.setProperties({ hours: "14", minutes: "58" });
await render(
<template>
- <TimeInput @hours={{self.hours}} @minutes={{self.minutes}} />
+ <TimeInput @hours={{this.hours}} @minutes={{this.minutes}} />
</template>
);
@@ -30,13 +28,11 @@ module("Integration | Component | time-input", function (hooks) {
});
test("prevents mutations", async function (assert) {
- const self = this;
-
this.setProperties({ hours: "14", minutes: "58" });
await render(
<template>
- <TimeInput @hours={{self.hours}} @minutes={{self.minutes}} />
+ <TimeInput @hours={{this.hours}} @minutes={{this.minutes}} />
</template>
);
@@ -46,17 +42,15 @@ module("Integration | Component | time-input", function (hooks) {
});
test("allows mutations through actions", async function (assert) {
- const self = this;
-
this.setProperties({ hours: "14", minutes: "58" });
this.set("onChange", setTime);
await render(
<template>
<TimeInput
- @hours={{self.hours}}
- @minutes={{self.minutes}}
- @onChange={{self.onChange}}
+ @hours={{this.hours}}
+ @minutes={{this.minutes}}
+ @onChange={{this.onChange}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/time-shortcut-picker-test.gjs b/frontend/discourse/tests/integration/components/time-shortcut-picker-test.gjs
index 6f0b8ff8f39..eb523ac0d3b 100644
--- a/frontend/discourse/tests/integration/components/time-shortcut-picker-test.gjs
+++ b/frontend/discourse/tests/integration/components/time-shortcut-picker-test.gjs
@@ -22,14 +22,12 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("shows default options", async function (assert) {
- const self = this;
-
this.siteSettings.suggest_weekends_in_date_pickers = true;
const tuesday = "2100-06-08T08:00:00";
this.clock = fakeTime(tuesday, this.currentUser.user_option.timezone, true);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
const expected = [
@@ -53,21 +51,17 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("show 'Later This Week' if today is < Thursday", async function (assert) {
- const self = this;
-
const monday = "2100-06-07T08:00:00";
this.clock = fakeTime(monday, this.currentUser.user_option.timezone, true);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert.dom("#tap_tile_later_this_week").exists("has later this week");
});
test("does not show 'Later This Week' if today is >= Thursday", async function (assert) {
- const self = this;
-
const thursday = "2100-06-10T08:00:00";
this.clock = fakeTime(
thursday,
@@ -76,7 +70,7 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert
@@ -85,8 +79,6 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("does not show 'Later Today' if 'Later Today' is tomorrow", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-12-11T22:00:00", // + 3 hours is tomorrow
this.currentUser.user_option.timezone,
@@ -94,7 +86,7 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert
@@ -103,8 +95,6 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("shows 'Later Today' if it is before 5pm", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-12-11T16:50:00",
this.currentUser.user_option.timezone,
@@ -112,15 +102,13 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert.dom("#tap_tile_later_today").exists("has later today");
});
test("does not show 'Later Today' if it is after 5pm", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-12-11T17:00:00",
this.currentUser.user_option.timezone,
@@ -128,7 +116,7 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert
@@ -137,8 +125,6 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("default custom date time is in one hour from now", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-12-11T17:00:00",
this.currentUser.user_option.timezone,
@@ -146,7 +132,7 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
await click("#tap_tile_custom");
@@ -155,13 +141,11 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("shows 'Next Monday' instead of 'Monday' on Sundays", async function (assert) {
- const self = this;
-
const sunday = "2100-01-24T08:00:00";
this.clock = fakeTime(sunday, this.currentUser.user_option.timezone, true);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert
@@ -174,13 +158,11 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("shows 'Next Monday' instead of 'Monday' on Mondays", async function (assert) {
- const self = this;
-
const monday = "2100-01-25T08:00:00";
this.clock = fakeTime(monday, this.currentUser.user_option.timezone, true);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert
@@ -193,8 +175,6 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
});
test("the 'Next Month' option points to the first day of the next month", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-01-01T08:00:00",
this.currentUser.user_option.timezone,
@@ -202,7 +182,7 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
);
await render(
- <template><TimeShortcutPicker @_itsatrap={{self.itsatrap}} /></template>
+ <template><TimeShortcutPicker @_itsatrap={{this.itsatrap}} /></template>
);
assert
diff --git a/frontend/discourse/tests/integration/components/user-avatar-flair-test.gjs b/frontend/discourse/tests/integration/components/user-avatar-flair-test.gjs
index 850b86c155e..8e9b092e2a7 100644
--- a/frontend/discourse/tests/integration/components/user-avatar-flair-test.gjs
+++ b/frontend/discourse/tests/integration/components/user-avatar-flair-test.gjs
@@ -49,8 +49,6 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
test("avatar flair for admin user", async function (assert) {
- const self = this;
-
this.set("args", {
admin: true,
moderator: false,
@@ -59,7 +57,7 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
setupSiteGroups(this);
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").exists("has the tag");
assert.dom("svg.d-icon-bars").exists("has the svg icon");
@@ -70,8 +68,6 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
test("avatar flair for moderator user with fallback to staff", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: true,
@@ -80,7 +76,7 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
setupSiteGroups(this);
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").exists("has the tag");
assert.dom("svg.d-icon-bars").exists("has the svg icon");
@@ -91,8 +87,6 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
test("avatar flair for trust level", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: false,
@@ -101,7 +95,7 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
setupSiteGroups(this);
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").exists("has the tag");
assert.dom("svg.d-icon-dice-two").exists("has the svg icon");
@@ -112,8 +106,6 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
test("avatar flair for trust level when set to none", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: false,
@@ -122,14 +114,12 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
setupSiteGroups(this);
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").doesNotExist("does not render a flair");
});
test("avatar flair for trust level with fallback", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: false,
@@ -138,7 +128,7 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
setupSiteGroups(this);
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").exists("has the tag");
assert.dom("svg.d-icon-dice-two").exists("has the svg icon");
@@ -149,8 +139,6 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
test("avatar flair for login-required site, before login", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: false,
@@ -160,14 +148,12 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
// Groups not serialized for anon on login_required
this.site.groups = undefined;
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").doesNotExist("does not render a flair");
});
test("avatar flair for primary group flair", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: false,
@@ -181,7 +167,7 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
setupSiteGroups(this);
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").exists("has the tag");
assert.dom("svg.d-icon-xmark").exists("has the svg icon");
@@ -192,8 +178,6 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
});
test("user-avatar-flair for user with no flairs", async function (assert) {
- const self = this;
-
this.set("args", {
admin: false,
moderator: false,
@@ -201,7 +185,7 @@ module("Integration | Component | user-avatar-flair", function (hooks) {
flair_group_id: 11,
});
- await render(<template><UserAvatarFlair @user={{self.args}} /></template>);
+ await render(<template><UserAvatarFlair @user={{this.args}} /></template>);
assert.dom(".avatar-flair").doesNotExist("does not render a flair");
});
diff --git a/frontend/discourse/tests/integration/components/user-info-test.gjs b/frontend/discourse/tests/integration/components/user-info-test.gjs
index c46928b5260..b6b12d30954 100644
--- a/frontend/discourse/tests/integration/components/user-info-test.gjs
+++ b/frontend/discourse/tests/integration/components/user-info-test.gjs
@@ -8,37 +8,31 @@ module("Integration | Component | user-info", function (hooks) {
setupRenderingTest(hooks);
test("prioritized name", async function (assert) {
- const self = this;
-
this.siteSettings.prioritize_username_in_ux = false;
this.currentUser.name = "Evil Trout";
- await render(<template><UserInfo @user={{self.currentUser}} /></template>);
+ await render(<template><UserInfo @user={{this.currentUser}} /></template>);
assert.dom(".name").hasText("Evil Trout");
assert.dom(".username").hasText("eviltrout");
});
test("prioritized username", async function (assert) {
- const self = this;
-
this.siteSettings.prioritize_username_in_ux = true;
this.currentUser.name = "Evil Trout";
- await render(<template><UserInfo @user={{self.currentUser}} /></template>);
+ await render(<template><UserInfo @user={{this.currentUser}} /></template>);
assert.dom(".username").hasText("eviltrout");
assert.dom(".name").hasText("Evil Trout");
});
test("includeLink", async function (assert) {
- const self = this;
-
await render(
<template>
<UserInfo
- @user={{self.currentUser}}
- @includeLink={{self.includeLink}}
+ @user={{this.currentUser}}
+ @includeLink={{this.includeLink}}
/>
</template>
);
@@ -53,13 +47,11 @@ module("Integration | Component | user-info", function (hooks) {
});
test("includeAvatar", async function (assert) {
- const self = this;
-
await render(
<template>
<UserInfo
- @user={{self.currentUser}}
- @includeAvatar={{self.includeAvatar}}
+ @user={{this.currentUser}}
+ @includeAvatar={{this.includeAvatar}}
/>
</template>
);
@@ -72,14 +64,12 @@ module("Integration | Component | user-info", function (hooks) {
});
test("shows status if enabled and user has status", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
this.currentUser.status = { emoji: "tooth", description: "off to dentist" };
await render(
<template>
- <UserInfo @user={{self.currentUser}} @showStatus={{true}} />
+ <UserInfo @user={{this.currentUser}} @showStatus={{true}} />
</template>
);
@@ -87,13 +77,11 @@ module("Integration | Component | user-info", function (hooks) {
});
test("doesn't show status if enabled but user doesn't have status", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
await render(
<template>
- <UserInfo @user={{self.currentUser}} @showStatus={{true}} />
+ <UserInfo @user={{this.currentUser}} @showStatus={{true}} />
</template>
);
@@ -101,14 +89,12 @@ module("Integration | Component | user-info", function (hooks) {
});
test("doesn't show status if disabled", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
this.currentUser.status = { emoji: "tooth", description: "off to dentist" };
await render(
<template>
- <UserInfo @user={{self.currentUser}} @showStatus={{false}} />
+ <UserInfo @user={{this.currentUser}} @showStatus={{false}} />
</template>
);
@@ -116,25 +102,21 @@ module("Integration | Component | user-info", function (hooks) {
});
test("doesn't show status by default", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
this.currentUser.status = { emoji: "tooth", description: "off to dentist" };
- await render(<template><UserInfo @user={{self.currentUser}} /></template>);
+ await render(<template><UserInfo @user={{this.currentUser}} /></template>);
assert.dom(".user-status-message").doesNotExist();
});
test("doesn't show status description by default", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
this.currentUser.status = { emoji: "tooth", description: "off to dentist" };
await render(
<template>
- <UserInfo @user={{self.currentUser}} @showStatus={{true}} />
+ <UserInfo @user={{this.currentUser}} @showStatus={{true}} />
</template>
);
@@ -144,15 +126,13 @@ module("Integration | Component | user-info", function (hooks) {
});
test("shows status description if enabled", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
this.currentUser.status = { emoji: "tooth", description: "off to dentist" };
await render(
<template>
<UserInfo
- @user={{self.currentUser}}
+ @user={{this.currentUser}}
@showStatus={{true}}
@showStatusDescription={{true}}
/>
@@ -165,14 +145,12 @@ module("Integration | Component | user-info", function (hooks) {
});
test("shows status tooltip if enabled", async function (assert) {
- const self = this;
-
this.currentUser.name = "Evil Trout";
this.currentUser.status = { emoji: "tooth", description: "off to dentist" };
await render(
<template>
- <UserInfo @user={{self.currentUser}} @showStatus={{true}} /><DTooltips
+ <UserInfo @user={{this.currentUser}} @showStatus={{true}} /><DTooltips
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/user-menu/menu-item-test.gjs b/frontend/discourse/tests/integration/components/user-menu/menu-item-test.gjs
index 7f04161b9b7..4ebd6644c38 100644
--- a/frontend/discourse/tests/integration/components/user-menu/menu-item-test.gjs
+++ b/frontend/discourse/tests/integration/components/user-menu/menu-item-test.gjs
@@ -53,14 +53,12 @@ module(
setupRenderingTest(hooks);
test("pushes `read` to the classList if the notification is read and `unread` if it isn't", async function (assert) {
- const self = this;
-
this.set(
"item",
getNotification(this.currentUser, this.siteSettings, this.site)
);
this.item.notification.read = false;
- await render(<template><MenuItem @item={{self.item}} /></template>);
+ await render(<template><MenuItem @item={{this.item}} /></template>);
assert.dom("li.read").doesNotExist();
assert.dom("li.unread").exists();
@@ -76,13 +74,11 @@ module(
});
test("pushes the notification type name to the classList", async function (assert) {
- const self = this;
-
this.set(
"item",
getNotification(this.currentUser, this.siteSettings, this.site)
);
- await render(<template><MenuItem @item={{self.item}} /></template>);
+ await render(<template><MenuItem @item={{this.item}} /></template>);
assert.dom("li").hasClass("mentioned");
this.set(
diff --git a/frontend/discourse/tests/integration/components/user-status-message-test.gjs b/frontend/discourse/tests/integration/components/user-status-message-test.gjs
index 402b76ea42c..292cfc75a7a 100644
--- a/frontend/discourse/tests/integration/components/user-status-message-test.gjs
+++ b/frontend/discourse/tests/integration/components/user-status-message-test.gjs
@@ -20,20 +20,16 @@ module("Integration | Component | user-status-message", function (hooks) {
});
test("it renders user status emoji", async function (assert) {
- const self = this;
-
await render(
- <template><UserStatusMessage @status={{self.status}} /></template>
+ <template><UserStatusMessage @status={{this.status}} /></template>
);
assert.dom("img.emoji[alt='tooth']").exists("the status emoji is shown");
});
test("it renders status description if enabled", async function (assert) {
- const self = this;
-
await render(
<template>
- <UserStatusMessage @status={{self.status}} @showDescription={{true}} />
+ <UserStatusMessage @status={{this.status}} @showDescription={{true}} />
</template>
);
@@ -43,8 +39,6 @@ module("Integration | Component | user-status-message", function (hooks) {
});
test("it shows the until TIME on the tooltip if status will expire today", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-02-01T08:00:00.000Z",
this.currentUser.user_option.timezone,
@@ -54,7 +48,7 @@ module("Integration | Component | user-status-message", function (hooks) {
await render(
<template>
- <UserStatusMessage @status={{self.status}} /><DTooltips />
+ <UserStatusMessage @status={{this.status}} /><DTooltips />
</template>
);
await triggerEvent(".user-status-message", "pointermove");
@@ -65,8 +59,6 @@ module("Integration | Component | user-status-message", function (hooks) {
});
test("it shows the until DATE on the tooltip if status will expire tomorrow", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-02-01T08:00:00.000Z",
this.currentUser.user_option.timezone,
@@ -76,7 +68,7 @@ module("Integration | Component | user-status-message", function (hooks) {
await render(
<template>
- <UserStatusMessage @status={{self.status}} /><DTooltips />
+ <UserStatusMessage @status={{this.status}} /><DTooltips />
</template>
);
await triggerEvent(".user-status-message", "pointermove");
@@ -87,8 +79,6 @@ module("Integration | Component | user-status-message", function (hooks) {
});
test("it doesn't show until datetime on the tooltip if status doesn't have expiration date", async function (assert) {
- const self = this;
-
this.clock = fakeTime(
"2100-02-01T08:00:00.000Z",
this.currentUser.user_option.timezone,
@@ -98,7 +88,7 @@ module("Integration | Component | user-status-message", function (hooks) {
await render(
<template>
- <UserStatusMessage @status={{self.status}} /><DTooltips />
+ <UserStatusMessage @status={{this.status}} /><DTooltips />
</template>
);
await triggerEvent(".user-status-message", "pointermove");
@@ -111,11 +101,9 @@ module("Integration | Component | user-status-message", function (hooks) {
});
test("it shows tooltip by default", async function (assert) {
- const self = this;
-
await render(
<template>
- <UserStatusMessage @status={{self.status}} /><DTooltips />
+ <UserStatusMessage @status={{this.status}} /><DTooltips />
</template>
);
await triggerEvent(".user-status-message", "pointermove");
@@ -126,13 +114,11 @@ module("Integration | Component | user-status-message", function (hooks) {
});
test("doesn't blow up with an anonymous user", async function (assert) {
- const self = this;
-
this.owner.unregister("service:current-user");
this.status.ends_at = "2100-02-02T12:30:00.000Z";
await render(
- <template><UserStatusMessage @status={{self.status}} /></template>
+ <template><UserStatusMessage @status={{this.status}} /></template>
);
assert
diff --git a/frontend/discourse/tests/integration/components/value-list-test.gjs b/frontend/discourse/tests/integration/components/value-list-test.gjs
index b2901b56535..8dba642cd03 100644
--- a/frontend/discourse/tests/integration/components/value-list-test.gjs
+++ b/frontend/discourse/tests/integration/components/value-list-test.gjs
@@ -8,11 +8,9 @@ module("Integration | Component | value-list", function (hooks) {
setupRenderingTest(hooks);
test("adding a value", async function (assert) {
- const self = this;
-
this.set("values", "vinkas\nosama");
- await render(<template><ValueList @values={{self.values}} /></template>);
+ await render(<template><ValueList @values={{this.values}} /></template>);
await selectKit().expand();
await selectKit().fillInFilter("eviltrout");
@@ -30,11 +28,9 @@ module("Integration | Component | value-list", function (hooks) {
});
test("changing a value", async function (assert) {
- const self = this;
-
this.set("values", "vinkas\nosama");
- await render(<template><ValueList @values={{self.values}} /></template>);
+ await render(<template><ValueList @values={{this.values}} /></template>);
await fillIn(".values .value[data-index='1'] .value-input", "jarek");
await blur(".values .value[data-index='1'] .value-input");
@@ -44,11 +40,9 @@ module("Integration | Component | value-list", function (hooks) {
});
test("removing a value", async function (assert) {
- const self = this;
-
this.set("values", "vinkas\nosama");
- await render(<template><ValueList @values={{self.values}} /></template>);
+ await render(<template><ValueList @values={{this.values}} /></template>);
await click(".values .value[data-index='0'] .remove-value-btn");
@@ -66,8 +60,6 @@ module("Integration | Component | value-list", function (hooks) {
});
test("selecting a value", async function (assert) {
- const self = this;
-
this.setProperties({
values: "vinkas\nosama",
choices: ["maja", "michael"],
@@ -75,7 +67,7 @@ module("Integration | Component | value-list", function (hooks) {
await render(
<template>
- <ValueList @values={{self.values}} @choices={{self.choices}} />
+ <ValueList @values={{this.values}} @choices={{this.choices}} />
</template>
);
@@ -94,13 +86,11 @@ module("Integration | Component | value-list", function (hooks) {
});
test("array support", async function (assert) {
- const self = this;
-
this.set("values", ["vinkas", "osama"]);
await render(
<template>
- <ValueList @values={{self.values}} @inputType="array" />
+ <ValueList @values={{this.values}} @inputType="array" />
</template>
);
@@ -122,13 +112,11 @@ module("Integration | Component | value-list", function (hooks) {
});
test("delimiter support", async function (assert) {
- const self = this;
-
this.set("values", "vinkas|osama");
await render(
<template>
- <ValueList @values={{self.values}} @inputDelimiter="|" />
+ <ValueList @values={{this.values}} @inputDelimiter="|" />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/watched-word-uploader-test.gjs b/frontend/discourse/tests/integration/components/watched-word-uploader-test.gjs
index 6df413342a5..7cf949bff13 100644
--- a/frontend/discourse/tests/integration/components/watched-word-uploader-test.gjs
+++ b/frontend/discourse/tests/integration/components/watched-word-uploader-test.gjs
@@ -18,8 +18,6 @@ module("Integration | Component | watched-word-uploader", function (hooks) {
});
test("sets the proper action key on uploads", async function (assert) {
- const self = this;
-
const dialog = getOwner(this).lookup("service:dialog");
sinon.stub(dialog, "alert");
@@ -44,8 +42,8 @@ module("Integration | Component | watched-word-uploader", function (hooks) {
await render(
<template>
<WatchedWordUploader
- @actionKey={{self.actionNameKey}}
- @done={{self.doneUpload}}
+ @actionKey={{this.actionNameKey}}
+ @done={{this.doneUpload}}
/>
</template>
);
diff --git a/frontend/discourse/tests/integration/components/widgets/button-test.gjs b/frontend/discourse/tests/integration/components/widgets/button-test.gjs
index 3ab59c28d7c..97e7a5a96f7 100644
--- a/frontend/discourse/tests/integration/components/widgets/button-test.gjs
+++ b/frontend/discourse/tests/integration/components/widgets/button-test.gjs
@@ -11,12 +11,10 @@ module("Integration | Component | Widget | button", function (hooks) {
});
test("icon only button", async function (assert) {
- const self = this;
-
this.set("args", { icon: "far-face-smile" });
await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
+ <template><MountWidget @widget="button" @args={{this.args}} /></template>
);
assert.dom("button.btn.btn-icon.no-text").exists("has all the classes");
@@ -24,12 +22,10 @@ module("Integration | Component | Widget | button", function (hooks) {
});
test("icon and text button", async function (assert) {
- const self = this;
-
this.set("args", { icon: "plus", label: "topic.create" });
await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
+ <template><MountWidget @widget="button" @args={{this.args}} /></template>
);
assert.dom("button.btn.btn-icon-text").exists("has all the classes");
@@ -38,12 +34,10 @@ module("Integration | Component | Widget | button", function (hooks) {
});
test("emoji and text button", async function (assert) {
- const self = this;
-
this.set("args", { emoji: "mega", label: "topic.create" });
await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
+ <template><MountWidget @widget="button" @args={{this.args}} /></template>
);
assert.dom("button.widget-button").exists("renders the widget");
@@ -52,36 +46,30 @@ module("Integration | Component | Widget | button", function (hooks) {
});
test("translatedLabel", async function (assert) {
- const self = this;
-
this.set("args", { translatedLabel: "foo bar" });
await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
+ <template><MountWidget @widget="button" @args={{this.args}} /></template>
);
assert.dom("button span.d-button-label").hasText("foo bar");
});
test("translatedTitle", async function (assert) {
- const self = this;
-
this.set("args", { label: "topic.create", translatedTitle: "foo bar" });
await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
+ <template><MountWidget @widget="button" @args={{this.args}} /></template>
);
assert.dom("button").hasAttribute("title", "foo bar");
});
test("translatedLabel skips no-text class in icon", async function (assert) {
- const self = this;
-
this.set("args", { icon: "plus", translatedLabel: "foo bar" });
await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
+ <template><MountWidget @widget="button" @args={{this.args}} /></template>
);
assert
diff --git a/frontend/discourse/tests/integration/components/widgets/post-small-action-test.gjs b/frontend/discourse/tests/integration/components/widgets/post-small-action-test.gjs
index 01e0ece4abf..99b4fb1e480 100644
--- a/frontend/discourse/tests/integration/components/widgets/post-small-action-test.gjs
+++ b/frontend/discourse/tests/integration/components/widgets/post-small-action-test.gjs
@@ -19,13 +19,11 @@ module(
});
test("does not have delete/edit/recover buttons by default", async function (assert) {
- const self = this;
-
this.set("args", { id: 123 });
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -35,13 +33,11 @@ module(
});
test("shows edit button if canEdit", async function (assert) {
- const self = this;
-
this.set("args", { id: 123, canEdit: true });
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -51,13 +47,11 @@ module(
});
test("uses custom widget if actionDescriptionWidget", async function (assert) {
- const self = this;
-
this.set("args", { id: 123, actionDescriptionWidget: "button" });
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -67,13 +61,11 @@ module(
});
test("does not show edit button if canRecover even if canEdit", async function (assert) {
- const self = this;
-
this.set("args", { id: 123, canEdit: true, canRecover: true });
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -86,13 +78,11 @@ module(
});
test("shows delete button if canDelete", async function (assert) {
- const self = this;
-
this.set("args", { id: 123, canDelete: true });
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -102,13 +92,11 @@ module(
});
test("shows undo button if canRecover", async function (assert) {
- const self = this;
-
this.set("args", { id: 123, canRecover: true });
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -118,8 +106,6 @@ module(
});
test("`addGroupPostSmallActionCode` plugin api", async function (assert) {
- const self = this;
-
withPluginApi((api) => {
api.addGroupPostSmallActionCode("some_code");
});
@@ -135,7 +121,7 @@ module(
};
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
assert
@@ -154,8 +140,6 @@ module(
});
test("`addPostSmallActionClassesCallback` plugin api", async function (assert) {
- const self = this;
-
withSilencedDeprecations(POST_STREAM_DEPRECATION_OPTIONS.id, () => {
withPluginApi((api) => {
api.addPostSmallActionClassesCallback((postAttrs) => {
@@ -170,7 +154,7 @@ module(
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
@@ -184,7 +168,7 @@ module(
await render(
<template>
- <MountWidget @widget="post-small-action" @args={{self.args}} />
+ <MountWidget @widget="post-small-action" @args={{this.args}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/components/widgets/post-test.gjs b/frontend/discourse/tests/integration/components/widgets/post-test.gjs
index e9154027042..8139f0993de 100644
--- a/frontend/discourse/tests/integration/components/widgets/post-test.gjs
+++ b/frontend/discourse/tests/integration/components/widgets/post-test.gjs
@@ -30,8 +30,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("basic elements", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -42,7 +40,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -51,8 +49,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("post - links", async function (assert) {
- const self = this;
-
this.set("args", {
cooked:
"<a href='http://link1.example.com/'>first link</a> and <a href='http://link2.example.com/?some=query'>second link</a>",
@@ -66,8 +62,8 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post-contents"
- @model={{self.post}}
- @args={{self.args}}
+ @model={{this.post}}
+ @args={{this.args}}
/>
</template>
);
@@ -77,8 +73,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("post - onebox links", async function (assert) {
- const self = this;
-
this.set("args", {
cooked: `
<p><a href="https://example.com">Other URL</a></p>
@@ -102,8 +96,8 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post-contents"
- @model={{self.post}}
- @args={{self.args}}
+ @model={{this.post}}
+ @args={{this.args}}
/>
</template>
);
@@ -125,8 +119,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("wiki", async function (assert) {
- const self = this;
-
this.set("args", { wiki: true, version: 2, canViewEditHistory: true });
this.set("showHistory", () => (this.historyShown = true));
@@ -134,9 +126,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @showHistory={{self.showHistory}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @showHistory={{this.showHistory}}
/>
</template>
);
@@ -149,8 +141,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("wiki without revision", async function (assert) {
- const self = this;
-
this.set("args", { wiki: true, version: 1, canViewEditHistory: true });
this.set("editPost", () => (this.editPostCalled = true));
@@ -158,9 +148,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @editPost={{self.editPost}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @editPost={{this.editPost}}
/>
</template>
);
@@ -170,8 +160,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("via-email", async function (assert) {
- const self = this;
-
this.set("args", { via_email: true, canViewRawEmail: true });
this.set("showRawEmail", () => (this.rawEmailShown = true));
@@ -179,9 +167,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @showRawEmail={{self.showRawEmail}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @showRawEmail={{this.showRawEmail}}
/>
</template>
);
@@ -194,8 +182,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("via-email without permission", async function (assert) {
- const self = this;
-
this.rawEmailShown = false;
this.set("args", { via_email: true, canViewRawEmail: false });
this.set("showRawEmail", () => (this.rawEmailShown = true));
@@ -204,9 +190,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @showRawEmail={{self.showRawEmail}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @showRawEmail={{this.showRawEmail}}
/>
</template>
);
@@ -219,8 +205,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("history", async function (assert) {
- const self = this;
-
this.set("args", { version: 3, canViewEditHistory: true });
this.set("showHistory", () => (this.historyShown = true));
@@ -228,9 +212,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @showHistory={{self.showHistory}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @showHistory={{this.showHistory}}
/>
</template>
);
@@ -240,8 +224,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("history without view permission", async function (assert) {
- const self = this;
-
this.historyShown = false;
this.set("args", { version: 3, canViewEditHistory: false });
this.set("showHistory", () => (this.historyShown = true));
@@ -250,9 +232,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @showHistory={{self.showHistory}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @showHistory={{this.showHistory}}
/>
</template>
);
@@ -265,13 +247,11 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("whisper", async function (assert) {
- const self = this;
-
this.set("args", { isWhisper: true });
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -280,13 +260,11 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test(`read indicator`, async function (assert) {
- const self = this;
-
this.set("args", { read: true });
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -294,13 +272,11 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test(`unread indicator`, async function (assert) {
- const self = this;
-
this.set("args", { read: false });
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -308,8 +284,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("reply directly above (suppressed)", async function (assert) {
- const self = this;
-
this.set("args", {
replyToUsername: "eviltrout",
replyToAvatarTemplate: "/images/avatar.png",
@@ -318,7 +292,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -327,8 +301,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("reply a few posts above (suppressed)", async function (assert) {
- const self = this;
-
this.set("args", {
replyToUsername: "eviltrout",
replyToAvatarTemplate: "/images/avatar.png",
@@ -337,7 +309,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -346,8 +318,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("reply directly above", async function (assert) {
- const self = this;
-
this.set("args", {
replyToUsername: "eviltrout",
replyToAvatarTemplate: "/images/avatar.png",
@@ -357,7 +327,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -368,8 +338,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("cooked content hidden", async function (assert) {
- const self = this;
-
this.set("args", { cooked_hidden: true, canSeeHiddenPost: true });
this.set("expandHidden", () => (this.unhidden = true));
@@ -377,9 +345,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @expandHidden={{self.expandHidden}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @expandHidden={{this.expandHidden}}
/>
</template>
);
@@ -389,8 +357,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test(`cooked content hidden - can't view hidden post`, async function (assert) {
- const self = this;
-
this.set("args", { cooked_hidden: true, canSeeHiddenPost: false });
this.set("expandHidden", () => (this.unhidden = true));
@@ -398,9 +364,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @expandHidden={{self.expandHidden}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @expandHidden={{this.expandHidden}}
/>
</template>
);
@@ -411,13 +377,11 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("expand first post", async function (assert) {
- const self = this;
-
this.set("args", { expandablePost: true });
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -426,13 +390,11 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("can't show admin menu when you can't manage", async function (assert) {
- const self = this;
-
this.set("args", { canManage: false });
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -440,13 +402,11 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("show admin menu", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
<DMenus />
</template>
);
@@ -465,8 +425,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("permanently delete topic", async function (assert) {
- const self = this;
-
this.currentUser.set("admin", true);
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
@@ -488,9 +446,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @permanentlyDeletePost={{self.permanentlyDeletePost}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @permanentlyDeletePost={{this.permanentlyDeletePost}}
/>
<DMenus />
</template>
@@ -507,8 +465,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("permanently delete post", async function (assert) {
- const self = this;
-
this.currentUser.set("admin", true);
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
@@ -530,9 +486,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @permanentlyDeletePost={{self.permanentlyDeletePost}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @permanentlyDeletePost={{this.permanentlyDeletePost}}
/>
<DMenus />
</template>
@@ -550,8 +506,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("toggle moderator post", async function (assert) {
- const self = this;
-
this.currentUser.set("moderator", true);
const store = getOwner(this).lookup("service:store");
@@ -574,9 +528,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @togglePostType={{self.togglePostType}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @togglePostType={{this.togglePostType}}
/>
<DMenus />
</template>
@@ -594,8 +548,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("rebake post", async function (assert) {
- const self = this;
-
this.currentUser.moderator = true;
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", { id: 123 });
@@ -613,9 +565,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @rebakePost={{self.rebakePost}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @rebakePost={{this.rebakePost}}
/>
<DMenus />
</template>
@@ -632,8 +584,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("unhide post", async function (assert) {
- const self = this;
-
let unhidden;
this.currentUser.admin = true;
@@ -645,9 +595,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @unhidePost={{self.unhidePost}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @unhidePost={{this.unhidePost}}
/>
<DMenus />
</template>
@@ -667,8 +617,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("change owner", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", { id: 123 });
@@ -687,9 +635,9 @@ module("Integration | Component | Widget | post", function (hooks) {
<template>
<MountWidget
@widget="post"
- @model={{self.post}}
- @args={{self.args}}
- @changePostOwner={{self.changePostOwner}}
+ @model={{this.post}}
+ @args={{this.args}}
+ @changePostOwner={{this.changePostOwner}}
/>
<DMenus />
</template>
@@ -706,15 +654,13 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("shows the topic map when setting the 'topicMap' attribute", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", { id: 123 });
this.set("args", { topic, post_number: 1, topicMap: true });
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -722,8 +668,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("shows the topic map when no replies", async function (assert) {
- const self = this;
-
this.siteSettings.show_topic_map_in_topics_without_replies = true;
const store = getOwner(this).lookup("service:store");
@@ -735,7 +679,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -743,8 +687,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("topic map - few participants", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -763,7 +705,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
assert.dom(".topic-map__users-trigger").doesNotExist();
@@ -771,8 +713,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("topic map - participants", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -797,7 +737,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
assert.dom(".topic-map__users-list a.poster").exists({ count: 5 });
@@ -809,8 +749,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("topic map - links", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -829,7 +767,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -843,8 +781,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("topic map - has top replies summary", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -856,7 +792,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -864,8 +800,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("topic map - no top reply summary", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -876,7 +810,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -885,8 +819,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("pm map", async function (assert) {
- const self = this;
-
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", {
id: 123,
@@ -902,7 +834,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -911,8 +843,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("post notice - with username", async function (assert) {
- const self = this;
-
const twoDaysAgo = new Date();
twoDaysAgo.setDate(twoDaysAgo.getDate() - 2);
this.siteSettings.display_name_on_posts = false;
@@ -930,7 +860,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -943,8 +873,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("post notice - custom official notice with created by username", async function (assert) {
- const self = this;
-
this.siteSettings.display_name_on_posts = false;
this.siteSettings.prioritize_username_in_ux = true;
this.set("args", {
@@ -961,7 +889,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -980,8 +908,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("post notice - with name", async function (assert) {
- const self = this;
-
this.siteSettings.display_name_on_posts = true;
this.siteSettings.prioritize_username_in_ux = false;
this.siteSettings.old_post_notice_days = 14;
@@ -994,7 +920,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -1004,8 +930,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("show group request in post", async function (assert) {
- const self = this;
-
this.set("args", {
username: "foo",
requestedGroupName: "testGroup",
@@ -1013,7 +937,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -1024,8 +948,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("shows user status if enabled in site settings", async function (assert) {
- const self = this;
-
this.siteSettings.enable_user_status = true;
const status = {
emoji: "tooth",
@@ -1037,7 +959,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -1045,8 +967,6 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("doesn't show user status if disabled in site settings", async function (assert) {
- const self = this;
-
this.siteSettings.enable_user_status = false;
const status = {
emoji: "tooth",
@@ -1058,7 +978,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
@@ -1066,26 +986,22 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("more actions button is displayed when multiple hidden items are configured", async function (assert) {
- const self = this;
-
this.siteSettings.post_menu_hidden_items = "bookmark|edit|copyLink";
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
assert.dom(".show-more-actions").exists();
});
test("hidden menu expands automatically when only one hidden item is configured", async function (assert) {
- const self = this;
-
this.siteSettings.post_menu_hidden_items = "bookmark|edit";
await render(
<template>
- <MountWidget @widget="post" @model={{self.post}} @args={{self.args}} />
+ <MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />
</template>
);
assert.dom(".show-more-actions").doesNotExist();
diff --git a/frontend/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs b/frontend/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs
index eea9656bb20..f666d68945b 100644
--- a/frontend/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs
+++ b/frontend/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs
@@ -31,8 +31,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("dropdown id", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -41,12 +39,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -56,8 +54,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("label", async function (assert) {
- const self = this;
-
I18n.translations = { en: { js: { foo: "FooBaz" } } };
this.setProperties(DEFAULT_CONTENT);
@@ -67,12 +63,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -82,8 +78,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("translatedLabel", async function (assert) {
- const self = this;
-
I18n.translations = { en: { js: { foo: "FooBaz" } } };
this.setProperties(DEFAULT_CONTENT);
this.set("translatedLabel", "BazFoo");
@@ -94,12 +88,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -109,8 +103,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("content", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -119,12 +111,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -143,8 +135,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("onChange action", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("onChange", (item) => assert.step(`${item.id}`));
@@ -154,9 +144,9 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- label=self.label
- content=self.content
- onChange=self.onChange
+ label=this.label
+ content=this.content
+ onChange=this.onChange
}}
/>
</template>
@@ -168,8 +158,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("can be opened and closed", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -178,12 +166,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -201,8 +189,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("icon", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("icon", "xmark");
@@ -212,12 +198,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -227,8 +213,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("class", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("class", "activated");
@@ -238,12 +222,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -253,8 +237,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("content with translatedLabel", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -263,12 +245,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -279,8 +261,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("content with label", async function (assert) {
- const self = this;
-
I18n.translations = { en: { js: { foo: "FooBaz" } } };
this.setProperties(DEFAULT_CONTENT);
@@ -290,12 +270,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -306,8 +286,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("content with icon", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -316,12 +294,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -334,8 +312,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("content with html", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -344,12 +320,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -362,8 +338,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("separator", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -372,12 +346,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -390,8 +364,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("hides widget if no content", async function (assert) {
- const self = this;
-
this.setProperties({ content: null, label: "foo" });
await render(
@@ -400,12 +372,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -416,8 +388,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("headerClass option", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("options", { headerClass: "btn-small and-text" });
@@ -427,12 +397,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -443,8 +413,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("bodyClass option", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("options", { bodyClass: "gigantic and-yet-small" });
@@ -454,12 +422,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -471,8 +439,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("caret option", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("options", { caret: true });
@@ -482,12 +448,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -499,8 +465,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("disabled widget", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
this.set("options", { disabled: true });
@@ -510,12 +474,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
@@ -530,8 +494,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
});
test("disabled item", async function (assert) {
- const self = this;
-
this.setProperties(DEFAULT_CONTENT);
await render(
@@ -540,12 +502,12 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
@widget="widget-dropdown"
@args={{hash
id="my-dropdown"
- icon=self.icon
- label=self.label
- class=self.class
- translatedLabel=self.translatedLabel
- content=self.content
- options=self.options
+ icon=this.icon
+ label=this.label
+ class=this.class
+ translatedLabel=this.translatedLabel
+ content=this.content
+ options=this.options
}}
/>
</template>
diff --git a/frontend/discourse/tests/integration/components/widgets/widget-test.gjs b/frontend/discourse/tests/integration/components/widgets/widget-test.gjs
index 54b336d819c..e54790194d7 100644
--- a/frontend/discourse/tests/integration/components/widgets/widget-test.gjs
+++ b/frontend/discourse/tests/integration/components/widgets/widget-test.gjs
@@ -24,8 +24,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("widget attributes are passed in via args", async function (assert) {
- const self = this;
-
createWidget("hello-test", {
tagName: "div.test",
template: widgetHbs`Hello {{attrs.name}}`,
@@ -35,7 +33,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="hello-test" @args={{self.args}} />
+ <MountWidget @widget="hello-test" @args={{this.args}} />
</template>
);
@@ -43,8 +41,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("widget rerenders when args change", async function (assert) {
- const self = this;
-
createWidget("hello-test", {
tagName: "div.test",
template: widgetHbs`Hello {{attrs.name}}`,
@@ -54,7 +50,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="hello-test" @args={{self.args}} />
+ <MountWidget @widget="hello-test" @args={{this.args}} />
</template>
);
@@ -81,8 +77,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("hbs template - no tagName", async function (assert) {
- const self = this;
-
createWidget("hbs-test", {
template: widgetHbs`<div class='test'>Hello {{attrs.name}}</div>`,
});
@@ -91,7 +85,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="hbs-test" @args={{self.args}} />
+ <MountWidget @widget="hbs-test" @args={{this.args}} />
</template>
);
@@ -99,8 +93,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("hbs template - with tagName", async function (assert) {
- const self = this;
-
createWidget("hbs-test", {
tagName: "div.test",
template: widgetHbs`Hello {{attrs.name}}`,
@@ -110,7 +102,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="hbs-test" @args={{self.args}} />
+ <MountWidget @widget="hbs-test" @args={{this.args}} />
</template>
);
@@ -118,15 +110,13 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("hbs template - with data attributes", async function (assert) {
- const self = this;
-
createWidget("hbs-test", {
template: widgetHbs`<div class='my-div' data-my-test='hello world'></div>`,
});
await render(
<template>
- <MountWidget @widget="hbs-test" @args={{self.args}} />
+ <MountWidget @widget="hbs-test" @args={{this.args}} />
</template>
);
@@ -134,8 +124,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("buildClasses", async function (assert) {
- const self = this;
-
createWidget("classname-test", {
tagName: "div.test",
@@ -148,7 +136,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="classname-test" @args={{self.args}} />
+ <MountWidget @widget="classname-test" @args={{this.args}} />
</template>
);
@@ -156,8 +144,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("buildAttributes", async function (assert) {
- const self = this;
-
createWidget("attributes-test", {
tagName: "div.test",
@@ -170,7 +156,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="attributes-test" @args={{self.args}} />
+ <MountWidget @widget="attributes-test" @args={{this.args}} />
</template>
);
@@ -179,8 +165,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("buildId", async function (assert) {
- const self = this;
-
createWidget("id-test", {
buildId(attrs) {
return `test-${attrs.id}`;
@@ -190,7 +174,7 @@ module("Integration | Component | Widget | base", function (hooks) {
this.set("args", { id: 1234 });
await render(
- <template><MountWidget @widget="id-test" @args={{self.args}} /></template>
+ <template><MountWidget @widget="id-test" @args={{this.args}} /></template>
);
assert.dom("#test-1234").exists();
@@ -316,15 +300,13 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("handlebars d-icon", async function (assert) {
- const self = this;
-
createWidget("hbs-icon-test", {
template: widgetHbs`{{d-icon "arrow-down"}}`,
});
await render(
<template>
- <MountWidget @widget="hbs-icon-test" @args={{self.args}} />
+ <MountWidget @widget="hbs-icon-test" @args={{this.args}} />
</template>
);
@@ -332,8 +314,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("handlebars i18n", async function (assert) {
- const self = this;
-
createWidget("hbs-i18n-test", {
template: widgetHbs`
<span class='string'>{{i18n "hbs_test0"}}</span>
@@ -353,7 +333,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="hbs-i18n-test" @args={{self.args}} />
+ <MountWidget @widget="hbs-i18n-test" @args={{this.args}} />
</template>
);
@@ -364,8 +344,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("handlebars #each", async function (assert) {
- const self = this;
-
createWidget("hbs-each-test", {
tagName: "ul",
template: widgetHbs`
@@ -381,7 +359,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="hbs-each-test" @args={{self.args}} />
+ <MountWidget @widget="hbs-each-test" @args={{this.args}} />
</template>
);
@@ -477,8 +455,6 @@ module("Integration | Component | Widget | base", function (hooks) {
});
test("avoids rerendering on prepend", async function (assert) {
- const self = this;
-
createWidget("prepend-test", {
tagName: "div.test",
html(attrs) {
@@ -506,7 +482,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(
<template>
- <MountWidget @widget="prepend-test" @args={{self.args}} />
+ <MountWidget @widget="prepend-test" @args={{this.args}} />
</template>
);
diff --git a/frontend/discourse/tests/integration/helpers/element-class-test.gjs b/frontend/discourse/tests/integration/helpers/element-class-test.gjs
index 7dbb86a1c77..4a5887d6fec 100644
--- a/frontend/discourse/tests/integration/helpers/element-class-test.gjs
+++ b/frontend/discourse/tests/integration/helpers/element-class-test.gjs
@@ -29,10 +29,8 @@ module("Integration | Helper | body-class and html-class", function (hooks) {
});
test("Dynamic classes", async function (assert) {
- const self = this;
-
this.set("dynamic", "bar");
- await render(<template>{{bodyClass self.dynamic}}</template>);
+ await render(<template>{{bodyClass this.dynamic}}</template>);
assert.dom(document.body).hasClass("bar");
this.set("dynamic", "baz");
diff --git a/frontend/discourse/tests/integration/helpers/slice-test.gjs b/frontend/discourse/tests/integration/helpers/slice-test.gjs
index d20a041aef0..f7e50b6ba8a 100644
--- a/frontend/discourse/tests/integration/helpers/slice-test.gjs
+++ b/frontend/discourse/tests/integration/helpers/slice-test.gjs
@@ -25,12 +25,10 @@ module("Integration | Helper | {{slice}}", function (hooks) {
});
test("it recomputes the slice if an item in the array changes", async function (assert) {
- const self = this;
-
let array = new TrackedArray([2, 4, 6]);
this.set("array", array);
- await render(<template>{{slice 1 3 self.array}}</template>);
+ await render(<template>{{slice 1 3 this.array}}</template>);
assert.dom().hasText("4,6", "sliced values");
diff --git a/package.json b/package.json
index 1f336b93bfb..968bf136848 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"license": "GPL-2.0-only",
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.28.0",
- "@discourse/lint-configs": "^2.33.0",
+ "@discourse/lint-configs": "^2.34.0",
"@discourse/moment-timezone-names-translations": "^1.0.0",
"@fortawesome/fontawesome-free": "6.7.2",
"@glint/ember-tsc": "^1.0.3",
diff --git a/plugins/automation/test/javascripts/integration/components/da-boolean-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-boolean-field-test.gjs
index e841eba2004..819fa222624 100644
--- a/plugins/automation/test/javascripts/integration/components/da-boolean-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-boolean-field-test.gjs
@@ -13,15 +13,13 @@ module("Integration | Component | da-boolean-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field();
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-categories-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-categories-field-test.gjs
index fd99264fa0e..9b560372d66 100644
--- a/plugins/automation/test/javascripts/integration/components/da-categories-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-categories-field-test.gjs
@@ -14,8 +14,6 @@ module("Integration | Component | da-categories-field", function (hooks) {
});
test("sets values", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "categories",
});
@@ -23,8 +21,8 @@ module("Integration | Component | da-categories-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -37,8 +35,6 @@ module("Integration | Component | da-categories-field", function (hooks) {
});
test("empty", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "categories",
});
@@ -46,8 +42,8 @@ module("Integration | Component | da-categories-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-category-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-category-field-test.gjs
index b60199f46f0..4209de37b33 100644
--- a/plugins/automation/test/javascripts/integration/components/da-category-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-category-field-test.gjs
@@ -14,8 +14,6 @@ module("Integration | Component | da-category-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "category",
});
@@ -23,8 +21,8 @@ module("Integration | Component | da-category-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-category-notification-level-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-category-notification-level-field-test.gjs
index 8b6bf33f5ad..9a7c4eabf45 100644
--- a/plugins/automation/test/javascripts/integration/components/da-category-notification-level-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-category-notification-level-field-test.gjs
@@ -16,8 +16,6 @@ module(
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "category_notification_level",
});
@@ -25,8 +23,8 @@ module(
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-choices-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-choices-field-test.gjs
index b1c19cf86c0..95de2595903 100644
--- a/plugins/automation/test/javascripts/integration/components/da-choices-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-choices-field-test.gjs
@@ -14,8 +14,6 @@ module("Integration | Component | da-choices-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "choices",
extra: { content: [{ name: "One", id: 1 }] },
@@ -24,8 +22,8 @@ module("Integration | Component | da-choices-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -37,8 +35,6 @@ module("Integration | Component | da-choices-field", function (hooks) {
});
test("empty multiselect", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "choices",
extra: { multiselect: true, content: [{ name: "One", id: 1 }] },
@@ -47,8 +43,8 @@ module("Integration | Component | da-choices-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-custom-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-custom-field-test.gjs
index f1ced1f5997..0855869c354 100644
--- a/plugins/automation/test/javascripts/integration/components/da-custom-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-custom-field-test.gjs
@@ -34,8 +34,6 @@ module("Integration | Component | da-custom-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "custom_field",
});
@@ -43,8 +41,8 @@ module("Integration | Component | da-custom-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-date-time-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-date-time-field-test.gjs
index a711d377fec..117eadf808f 100644
--- a/plugins/automation/test/javascripts/integration/components/da-date-time-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-date-time-field-test.gjs
@@ -13,8 +13,6 @@ module("Integration | Component | da-date-time-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "date_time",
});
@@ -22,8 +20,8 @@ module("Integration | Component | da-date-time-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-group-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-group-field-test.gjs
index 5e5734d9dd2..6d013ea8cf2 100644
--- a/plugins/automation/test/javascripts/integration/components/da-group-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-group-field-test.gjs
@@ -27,8 +27,6 @@ module("Integration | Component | da-group-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "group",
});
@@ -36,8 +34,8 @@ module("Integration | Component | da-group-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-groups-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-groups-field-test.gjs
index c82dfde1dc4..e62158937ac 100644
--- a/plugins/automation/test/javascripts/integration/components/da-groups-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-groups-field-test.gjs
@@ -34,8 +34,6 @@ module("Integration | Component | da-groups-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "groups",
});
@@ -43,8 +41,8 @@ module("Integration | Component | da-groups-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -56,8 +54,6 @@ module("Integration | Component | da-groups-field", function (hooks) {
});
test("supports a maximum value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "groups",
extra: { maximum: 1 },
@@ -66,8 +62,8 @@ module("Integration | Component | da-groups-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -84,8 +80,6 @@ module("Integration | Component | da-groups-field", function (hooks) {
});
test("empty", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "groups",
});
@@ -93,8 +87,8 @@ module("Integration | Component | da-groups-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-message-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-message-field-test.gjs
index 5cf9a2dcc54..2a7d37fa69d 100644
--- a/plugins/automation/test/javascripts/integration/components/da-message-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-message-field-test.gjs
@@ -13,8 +13,6 @@ module("Integration | Component | da-message-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "message",
});
@@ -22,8 +20,8 @@ module("Integration | Component | da-message-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -33,8 +31,6 @@ module("Integration | Component | da-message-field", function (hooks) {
});
test("render placeholders", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "message",
});
@@ -43,8 +39,8 @@ module("Integration | Component | da-message-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-pms-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-pms-field-test.gjs
index dca35d6f316..c346823dd64 100644
--- a/plugins/automation/test/javascripts/integration/components/da-pms-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-pms-field-test.gjs
@@ -13,8 +13,6 @@ module("Integration | Component | da-pms-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "pms",
});
@@ -22,8 +20,8 @@ module("Integration | Component | da-pms-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-post-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-post-field-test.gjs
index f87a8f85bd5..3563e898e2d 100644
--- a/plugins/automation/test/javascripts/integration/components/da-post-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-post-field-test.gjs
@@ -13,8 +13,6 @@ module("Integration | Component | da-post-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "post",
});
@@ -22,8 +20,8 @@ module("Integration | Component | da-post-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-tags-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-tags-field-test.gjs
index 6d8948ed755..54b3b026014 100644
--- a/plugins/automation/test/javascripts/integration/components/da-tags-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-tags-field-test.gjs
@@ -14,8 +14,6 @@ module("Integration | Component | da-tags-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "tags",
});
@@ -23,8 +21,8 @@ module("Integration | Component | da-tags-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -36,8 +34,6 @@ module("Integration | Component | da-tags-field", function (hooks) {
});
test("empty tags", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "tags",
});
@@ -45,8 +41,8 @@ module("Integration | Component | da-tags-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-text-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-text-field-test.gjs
index e0635cb21a9..c4041af2dcf 100644
--- a/plugins/automation/test/javascripts/integration/components/da-text-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-text-field-test.gjs
@@ -13,8 +13,6 @@ module("Integration | Component | da-text-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "text",
});
@@ -22,8 +20,8 @@ module("Integration | Component | da-text-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-text-list-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-text-list-field-test.gjs
index 46891730770..c11641a06f2 100644
--- a/plugins/automation/test/javascripts/integration/components/da-text-list-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-text-list-field-test.gjs
@@ -14,8 +14,6 @@ module("Integration | Component | da-text-list-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "text_list",
});
@@ -23,8 +21,8 @@ module("Integration | Component | da-text-list-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-trust-levels-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-trust-levels-field-test.gjs
index 4c76f658ca1..64aa26174bb 100644
--- a/plugins/automation/test/javascripts/integration/components/da-trust-levels-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-trust-levels-field-test.gjs
@@ -14,8 +14,6 @@ module("Integration | Component | da-trust-levels-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "trust-levels",
});
@@ -23,8 +21,8 @@ module("Integration | Component | da-trust-levels-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -37,8 +35,6 @@ module("Integration | Component | da-trust-levels-field", function (hooks) {
});
test("empty", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "trust-levels",
});
@@ -46,8 +42,8 @@ module("Integration | Component | da-trust-levels-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-user-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-user-field-test.gjs
index ee1f3a2484c..75166703007 100644
--- a/plugins/automation/test/javascripts/integration/components/da-user-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-user-field-test.gjs
@@ -27,8 +27,6 @@ module("Integration | Component | da-user-field", function (hooks) {
});
test("set value", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "user",
});
@@ -36,8 +34,8 @@ module("Integration | Component | da-user-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/automation/test/javascripts/integration/components/da-users-field-test.gjs b/plugins/automation/test/javascripts/integration/components/da-users-field-test.gjs
index dcf713584a7..6514576e8d1 100644
--- a/plugins/automation/test/javascripts/integration/components/da-users-field-test.gjs
+++ b/plugins/automation/test/javascripts/integration/components/da-users-field-test.gjs
@@ -32,8 +32,6 @@ module("Integration | Component | da-users-field", function (hooks) {
});
test("sets values", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "users",
});
@@ -41,8 +39,8 @@ module("Integration | Component | da-users-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -57,8 +55,6 @@ module("Integration | Component | da-users-field", function (hooks) {
});
test("allows emails", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "users",
});
@@ -66,8 +62,8 @@ module("Integration | Component | da-users-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
@@ -80,8 +76,6 @@ module("Integration | Component | da-users-field", function (hooks) {
});
test("empty", async function (assert) {
- const self = this;
-
this.field = new AutomationFabricators(getOwner(this)).field({
component: "users",
});
@@ -89,8 +83,8 @@ module("Integration | Component | da-users-field", function (hooks) {
await render(
<template>
<AutomationField
- @automation={{self.automation}}
- @field={{self.field}}
+ @automation={{this.automation}}
+ @field={{this.field}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs
index 3134c7fc973..e03b38ef78b 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs
@@ -16,89 +16,73 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
});
test("escapes channel title", async function (assert) {
- const self = this;
-
this.channel.title = "<div class='xss'>evil</div>";
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".xss").doesNotExist();
});
test("escapes channel description", async function (assert) {
- const self = this;
-
this.channel.description = "<div class='xss'>evil</div>";
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".xss").doesNotExist();
});
test("Closed channel", async function (assert) {
- const self = this;
-
this.channel.status = "closed";
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-card.--closed").exists();
});
test("Archived channel", async function (assert) {
- const self = this;
-
this.channel.status = "archived";
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-card.--archived").exists();
});
test("Muted channel", async function (assert) {
- const self = this;
-
this.channel.currentUserMembership.muted = true;
this.channel.currentUserMembership.following = true;
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-card__muted").exists();
});
test("Joined channel", async function (assert) {
- const self = this;
-
this.channel.currentUserMembership.following = true;
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".toggle-channel-membership-button.-leave").exists();
});
test("Joinable channel", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-card__join-btn").exists();
});
test("Memberships count", async function (assert) {
- const self = this;
-
this.channel.membershipsCount = 4;
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert
@@ -107,21 +91,17 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
});
test("No description", async function (assert) {
- const self = this;
-
this.channel.description = null;
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-card__description").doesNotExist();
});
test("Description", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert
@@ -130,21 +110,17 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
});
test("Name", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-card__name").hasText(this.channel.title);
});
test("Read restricted chatable", async function (assert) {
- const self = this;
-
this.channel.chatable.read_restricted = true;
await render(
- <template><ChatChannelCard @channel={{self.channel}} /></template>
+ <template><ChatChannelCard @channel={{this.channel}} /></template>
);
assert.dom(".d-icon-lock").exists();
});
diff --git a/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs
index e7ae4fd1dd0..11a48f1d6a2 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs
@@ -12,8 +12,6 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
setupRenderingTest(hooks);
test("accepts an optional onLeaveChannel callback", async function (assert) {
- const self = this;
-
this.foo = 1;
this.onLeaveChannel = () => (this.foo = 2);
this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();
@@ -21,8 +19,8 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
await render(
<template>
<ChatChannelLeaveBtn
- @channel={{self.channel}}
- @onLeaveChannel={{self.onLeaveChannel}}
+ @channel={{this.channel}}
+ @onLeaveChannel={{this.onLeaveChannel}}
/>
</template>
);
@@ -37,12 +35,10 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
});
test("has a specific title for direct message channel", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();
await render(
- <template><ChatChannelLeaveBtn @channel={{self.channel}} /></template>
+ <template><ChatChannelLeaveBtn @channel={{this.channel}} /></template>
);
assert
@@ -51,12 +47,10 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
});
test("has a specific title for message channel", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
await render(
- <template><ChatChannelLeaveBtn @channel={{self.channel}} /></template>
+ <template><ChatChannelLeaveBtn @channel={{this.channel}} /></template>
);
assert
@@ -65,13 +59,11 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
});
test("is not visible on mobile", async function (assert) {
- const self = this;
-
forceMobile();
this.channel = new ChatFabricators(getOwner(this)).channel();
await render(
- <template><ChatChannelLeaveBtn @channel={{self.channel}} /></template>
+ <template><ChatChannelLeaveBtn @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-leave-btn").doesNotExist();
diff --git a/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs
index 3a0f662662d..e92171980de 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs
@@ -9,7 +9,6 @@ module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {
setupRenderingTest(hooks);
test("displays created at placeholder for empty chat", async function (assert) {
- const self = this;
this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();
this.channel.lastMessage = new ChatFabricators(getOwner(this)).message({
channel: this.channel,
@@ -18,15 +17,13 @@ module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {
});
await render(
- <template><ChatChannelMetadata @channel={{self.channel}} /></template>
+ <template><ChatChannelMetadata @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel__metadata-date").hasText("–");
});
test("displays last message created at", async function (assert) {
- const self = this;
-
let lastMessageSentAt = moment().subtract(1, "day").format();
this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();
this.channel.lastMessage = new ChatFabricators(getOwner(this)).message({
@@ -35,7 +32,7 @@ module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {
});
await render(
- <template><ChatChannelMetadata @channel={{self.channel}} /></template>
+ <template><ChatChannelMetadata @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel__metadata-date").hasText("Yesterday");
@@ -43,7 +40,7 @@ module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {
lastMessageSentAt = moment();
this.channel.lastMessage.createdAt = lastMessageSentAt;
await render(
- <template><ChatChannelMetadata @channel={{self.channel}} /></template>
+ <template><ChatChannelMetadata @channel={{this.channel}} /></template>
);
assert
diff --git a/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs
index fb6b58e6598..d5cbd4288cc 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs
@@ -26,11 +26,9 @@ module(
});
test("channel title", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelPreviewCard @channel={{self.channel}} />
+ <ChatChannelPreviewCard @channel={{this.channel}} />
</template>
);
@@ -44,11 +42,9 @@ module(
});
test("channel description", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelPreviewCard @channel={{self.channel}} />
+ <ChatChannelPreviewCard @channel={{this.channel}} />
</template>
);
@@ -58,13 +54,11 @@ module(
});
test("no channel description", async function (assert) {
- const self = this;
-
this.channel.description = null;
await render(
<template>
- <ChatChannelPreviewCard @channel={{self.channel}} />
+ <ChatChannelPreviewCard @channel={{this.channel}} />
</template>
);
@@ -80,11 +74,9 @@ module(
});
test("join", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelPreviewCard @channel={{self.channel}} />
+ <ChatChannelPreviewCard @channel={{this.channel}} />
</template>
);
@@ -94,11 +86,9 @@ module(
});
test("browse all", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelPreviewCard @channel={{self.channel}} />
+ <ChatChannelPreviewCard @channel={{this.channel}} />
</template>
);
@@ -108,12 +98,10 @@ module(
});
test("closed channel", async function (assert) {
- const self = this;
-
this.channel.status = "closed";
await render(
<template>
- <ChatChannelPreviewCard @channel={{self.channel}} />
+ <ChatChannelPreviewCard @channel={{this.channel}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs
index 44aa735bd58..32978caf00f 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs
@@ -19,11 +19,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("links to correct channel", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -36,11 +34,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("allows tabbing", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -48,11 +44,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("channel id data attribute", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -65,11 +59,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("renders correct channel title", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -79,8 +71,6 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("renders correct channel metadata", async function (assert) {
- const self = this;
-
this.categoryChatChannel.lastMessage = new ChatFabricators(
getOwner(this)
).message({
@@ -88,7 +78,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -100,13 +90,11 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("renders membership toggling button when necessary", async function (assert) {
- const self = this;
-
forceMobile();
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -116,7 +104,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -127,7 +115,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
<ChatChannelRow
- @channel={{self.categoryChatChannel}}
+ @channel={{this.categoryChatChannel}}
@options={{hash leaveButton=true}}
/>
</template>
@@ -137,11 +125,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("focused channel has correct class", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -151,7 +137,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -159,11 +145,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("muted channel has correct class", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -173,7 +157,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -181,11 +165,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("leaveButton options adds correct class", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -194,7 +176,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
<ChatChannelRow
- @channel={{self.categoryChatChannel}}
+ @channel={{this.categoryChatChannel}}
@options={{hash leaveButton=true}}
/>
</template>
@@ -204,11 +186,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("active channel adds correct class", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -220,7 +200,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -228,11 +208,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("unreads adds correct class", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -242,7 +220,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -250,11 +228,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("user status with category channel", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannelRow @channel={{self.categoryChatChannel}} />
+ <ChatChannelRow @channel={{this.categoryChatChannel}} />
</template>
);
@@ -262,8 +238,6 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("user status with direct message channel", async function (assert) {
- const self = this;
-
this.directMessageChannel.chatable = new ChatFabricators(
getOwner(this)
).directMessage({
@@ -274,7 +248,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.directMessageChannel}} />
+ <ChatChannelRow @channel={{this.directMessageChannel}} />
</template>
);
@@ -282,8 +256,6 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
});
test("user status with direct message channel and multiple users", async function (assert) {
- const self = this;
-
const status = { description: "Off to dentist", emoji: "tooth" };
this.directMessageChannel.chatable.users[0].status = status;
@@ -296,7 +268,7 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
await render(
<template>
- <ChatChannelRow @channel={{self.directMessageChannel}} />
+ <ChatChannelRow @channel={{this.directMessageChannel}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs
index 256801d61db..ea568e0d050 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs
@@ -14,26 +14,22 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {
setupRenderingTest(hooks);
test("renders nothing when channel is opened", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
await render(
- <template><ChatChannelStatus @channel={{self.channel}} /></template>
+ <template><ChatChannelStatus @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-status").doesNotExist();
});
test("defaults to long format", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel({
status: CHANNEL_STATUSES.closed,
});
await render(
- <template><ChatChannelStatus @channel={{self.channel}} /></template>
+ <template><ChatChannelStatus @channel={{this.channel}} /></template>
);
assert
@@ -42,15 +38,13 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {
});
test("accepts a format argument", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel({
status: CHANNEL_STATUSES.archived,
});
await render(
<template>
- <ChatChannelStatus @channel={{self.channel}} @format="short" />
+ <ChatChannelStatus @channel={{this.channel}} @format="short" />
</template>
);
@@ -60,22 +54,18 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {
});
test("renders the correct icon", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel({
status: CHANNEL_STATUSES.archived,
});
await render(
- <template><ChatChannelStatus @channel={{self.channel}} /></template>
+ <template><ChatChannelStatus @channel={{this.channel}} /></template>
);
assert.dom(`.d-icon-${channelStatusIcon(this.channel.status)}`).exists();
});
test("renders archive status", async function (assert) {
- const self = this;
-
this.currentUser.admin = true;
this.channel = new ChatFabricators(getOwner(this)).channel({
status: CHANNEL_STATUSES.archived,
@@ -83,7 +73,7 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {
});
await render(
- <template><ChatChannelStatus @channel={{self.channel}} /></template>
+ <template><ChatChannelStatus @channel={{this.channel}} /></template>
);
assert.dom(".chat-channel-retry-archive").exists();
diff --git a/plugins/chat/test/javascripts/components/chat-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-test.gjs
index 68d5b4169a1..300b50b9e96 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-channel-test.gjs
@@ -69,10 +69,8 @@ module(
});
test("it shows status on mentions", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannel @channel={{self.channel}} /></template>
+ <template><ChatChannel @channel={{this.channel}} /></template>
);
assertStatusIsRendered(
@@ -83,10 +81,8 @@ module(
});
test("it updates status on mentions", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannel @channel={{self.channel}} /></template>
+ <template><ChatChannel @channel={{this.channel}} /></template>
);
const newStatus = {
@@ -109,10 +105,8 @@ module(
});
test("it deletes status on mentions", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannel @channel={{self.channel}} /></template>
+ <template><ChatChannel @channel={{this.channel}} /></template>
);
this.appEvents.trigger("user-status:changed", {
@@ -125,10 +119,8 @@ module(
});
test("it shows status on mentions on messages that came from Message Bus", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannel @channel={{self.channel}} /></template>
+ <template><ChatChannel @channel={{this.channel}} /></template>
);
await receiveChatMessageViaMessageBus();
@@ -141,10 +133,8 @@ module(
});
test("it updates status on mentions on messages that came from Message Bus", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannel @channel={{self.channel}} /></template>
+ <template><ChatChannel @channel={{this.channel}} /></template>
);
await receiveChatMessageViaMessageBus();
@@ -166,10 +156,8 @@ module(
});
test("it deletes status on mentions on messages that came from Message Bus", async function (assert) {
- const self = this;
-
await render(
- <template><ChatChannel @channel={{self.channel}} /></template>
+ <template><ChatChannel @channel={{this.channel}} /></template>
);
await receiveChatMessageViaMessageBus();
@@ -183,11 +171,9 @@ module(
});
test("it shows status tooltip", async function (assert) {
- const self = this;
-
await render(
<template>
- <ChatChannel @channel={{self.channel}} /><DTooltips />
+ <ChatChannel @channel={{this.channel}} /><DTooltips />
</template>
);
await triggerEvent(statusSelector(mentionedUser.username), "pointermove");
diff --git a/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs
index 042ad4069ae..bbbb1f4a06d 100644
--- a/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs
@@ -7,12 +7,10 @@ module("Discourse Chat | Component | chat-composer-dropdown", function (hooks) {
setupRenderingTest(hooks);
test("buttons", async function (assert) {
- const self = this;
-
this.set("buttons", [{ id: "foo", icon: "xmark", action: () => {} }]);
await render(
- <template><ChatComposerDropdown @buttons={{self.buttons}} /></template>
+ <template><ChatComposerDropdown @buttons={{this.buttons}} /></template>
);
await click(".chat-composer-dropdown__trigger-btn");
diff --git a/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs
index f99a5c76b69..f752639ee4c 100644
--- a/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs
@@ -11,13 +11,11 @@ module(
setupRenderingTest(hooks);
test("data-id attribute", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message();
await render(
<template>
- <ChatComposerMessageDetails @message={{self.message}} />
+ <ChatComposerMessageDetails @message={{this.message}} />
</template>
);
@@ -27,15 +25,13 @@ module(
});
test("editing a message has the pencil icon", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
editing: true,
});
await render(
<template>
- <ChatComposerMessageDetails @message={{self.message}} />
+ <ChatComposerMessageDetails @message={{this.message}} />
</template>
);
@@ -43,8 +39,6 @@ module(
});
test("replying to a message has the reply icon", async function (assert) {
- const self = this;
-
const firstMessage = new ChatFabricators(getOwner(this)).message();
this.message = new ChatFabricators(getOwner(this)).message({
inReplyTo: firstMessage,
@@ -52,7 +46,7 @@ module(
await render(
<template>
- <ChatComposerMessageDetails @message={{self.message}} />
+ <ChatComposerMessageDetails @message={{this.message}} />
</template>
);
@@ -60,13 +54,11 @@ module(
});
test("displays user avatar", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message();
await render(
<template>
- <ChatComposerMessageDetails @message={{self.message}} />
+ <ChatComposerMessageDetails @message={{this.message}} />
</template>
);
@@ -76,13 +68,11 @@ module(
});
test("displays message excerpt", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message();
await render(
<template>
- <ChatComposerMessageDetails @message={{self.message}} />
+ <ChatComposerMessageDetails @message={{this.message}} />
</template>
);
@@ -90,13 +80,11 @@ module(
});
test("displays user’s username", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message();
await render(
<template>
- <ChatComposerMessageDetails @message={{self.message}} />
+ <ChatComposerMessageDetails @message={{this.message}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs
index 1466238ab8c..0de52c5c81f 100644
--- a/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs
@@ -12,8 +12,6 @@ module(
setupRenderingTest(hooks);
test("direct message to self shows Jot something down", async function (assert) {
- const self = this;
-
pretender.get("/emojis.json", () => [200, [], {}]);
this.currentUser.set("id", 1);
@@ -24,7 +22,7 @@ module(
},
});
- await render(<template><Channel @channel={{self.channel}} /></template>);
+ await render(<template><Channel @channel={{this.channel}} /></template>);
assert
.dom(".chat-composer__input")
@@ -32,8 +30,6 @@ module(
});
test("direct message to multiple folks shows their names when not a group", async function (assert) {
- const self = this;
-
pretender.get("/emojis.json", () => [200, [], {}]);
this.channel = ChatChannel.create({
@@ -48,7 +44,7 @@ module(
},
});
- await render(<template><Channel @channel={{self.channel}} /></template>);
+ await render(<template><Channel @channel={{this.channel}} /></template>);
assert
.dom(".chat-composer__input")
@@ -56,8 +52,6 @@ module(
});
test("direct message to group shows Chat in group", async function (assert) {
- const self = this;
-
pretender.get("/chat/emojis.json", () => [200, [], {}]);
this.channel = ChatChannel.create({
@@ -73,7 +67,7 @@ module(
},
});
- await render(<template><Channel @channel={{self.channel}} /></template>);
+ await render(<template><Channel @channel={{this.channel}} /></template>);
assert
.dom(".chat-composer__input")
@@ -81,8 +75,6 @@ module(
});
test("message to channel shows send message to channel name", async function (assert) {
- const self = this;
-
pretender.get("/emojis.json", () => [200, [], {}]);
this.channel = ChatChannel.create({
@@ -90,7 +82,7 @@ module(
title: "just-cats",
});
- await render(<template><Channel @channel={{self.channel}} /></template>);
+ await render(<template><Channel @channel={{this.channel}} /></template>);
assert
.dom(".chat-composer__input")
diff --git a/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs
index 8af4671c063..4f2736b599f 100644
--- a/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs
@@ -10,8 +10,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
setupRenderingTest(hooks);
test("file - uploading in progress", async function (assert) {
- const self = this;
-
this.set("upload", {
progress: 50,
extension: ".pdf",
@@ -19,7 +17,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
await render(
- <template><ChatComposerUpload @upload={{self.upload}} /></template>
+ <template><ChatComposerUpload @upload={{this.upload}} /></template>
);
assert.dom(".upload-progress[value='50']").exists();
@@ -27,8 +25,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
test("image - uploading in progress", async function (assert) {
- const self = this;
-
this.set("upload", {
extension: ".png",
progress: 78,
@@ -36,7 +32,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
await render(
- <template><ChatComposerUpload @upload={{self.upload}} /></template>
+ <template><ChatComposerUpload @upload={{this.upload}} /></template>
);
assert.dom(".d-icon-far-image").exists();
@@ -45,8 +41,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
test("image - preprocessing upload in progress", async function (assert) {
- const self = this;
-
this.set("upload", {
extension: ".png",
progress: 78,
@@ -55,15 +49,13 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
await render(
- <template><ChatComposerUpload @upload={{self.upload}} /></template>
+ <template><ChatComposerUpload @upload={{this.upload}} /></template>
);
assert.dom(".processing").hasText(i18n("processing"));
});
test("file - upload complete", async function (assert) {
- const self = this;
-
this.set("upload", {
type: ".pdf",
original_filename: "some file.pdf",
@@ -72,7 +64,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
await render(
<template>
- <ChatComposerUpload @isDone={{true}} @upload={{self.upload}} />
+ <ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />
</template>
);
@@ -82,8 +74,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
test("image - upload complete", async function (assert) {
- const self = this;
-
this.set("upload", {
type: ".png",
original_filename: "bar_image.png",
@@ -93,7 +83,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
await render(
<template>
- <ChatComposerUpload @isDone={{true}} @upload={{self.upload}} />
+ <ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />
</template>
);
@@ -101,8 +91,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
test("image - upload complete uses CDN in preview", async function (assert) {
- const self = this;
-
try {
setupURL("//cdn.example.com", "http://test.local", "", {
snapshot: true,
@@ -117,7 +105,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
await render(
<template>
- <ChatComposerUpload @isDone={{true}} @upload={{self.upload}} />
+ <ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />
</template>
);
@@ -130,8 +118,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
test("removing completed upload", async function (assert) {
- const self = this;
-
this.set("uploadRemoved", false);
this.set("removeUpload", () => {
this.set("uploadRemoved", true);
@@ -147,8 +133,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
<template>
<ChatComposerUpload
@isDone={{true}}
- @upload={{self.upload}}
- @onCancel={{fn self.removeUpload self.upload}}
+ @upload={{this.upload}}
+ @onCancel={{fn this.removeUpload this.upload}}
/>
</template>
);
@@ -158,8 +144,6 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
});
test("cancelling in progress upload", async function (assert) {
- const self = this;
-
this.set("uploadRemoved", false);
this.set("removeUpload", () => {
this.set("uploadRemoved", true);
@@ -174,8 +158,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
await render(
<template>
<ChatComposerUpload
- @upload={{self.upload}}
- @onCancel={{fn self.removeUpload self.upload}}
+ @upload={{this.upload}}
+ @onCancel={{fn this.removeUpload this.upload}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs
index 38d12ff933d..7c51e1c4159 100644
--- a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs
@@ -42,14 +42,12 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
setupRenderingTest(hooks);
test("loading uploads from an outside source (e.g. draft or editing message)", async function (assert) {
- const self = this;
-
this.existingUploads = [fakeUpload];
await render(
<template>
<ChatComposerUploads
- @existingUploads={{self.existingUploads}}
+ @existingUploads={{this.existingUploads}}
@fileUploadElementId="chat-widget-uploader"
/>
</template>
@@ -59,8 +57,6 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
});
test("upload starts and completes", async function (assert) {
- const self = this;
-
setupUploadPretender();
this.set("onUploadChanged", () => {});
@@ -68,7 +64,7 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
<template>
<ChatComposerUploads
@fileUploadElementId="chat-widget-uploader"
- @onUploadChanged={{self.onUploadChanged}}
+ @onUploadChanged={{this.onUploadChanged}}
/>
</template>
);
@@ -94,8 +90,6 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
});
test("removing a completed upload", async function (assert) {
- const self = this;
-
this.set("changedUploads", null);
this.set("onUploadChanged", () => {});
@@ -104,9 +98,9 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
await render(
<template>
<ChatComposerUploads
- @existingUploads={{self.existingUploads}}
+ @existingUploads={{this.existingUploads}}
@fileUploadElementId="chat-widget-uploader"
- @onUploadChanged={{self.onUploadChanged}}
+ @onUploadChanged={{this.onUploadChanged}}
/>
</template>
);
@@ -119,8 +113,6 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
});
test("cancelling in progress upload", async function (assert) {
- const self = this;
-
setupUploadPretender();
this.set("changedUploads", null);
@@ -132,7 +124,7 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
<template>
<ChatComposerUploads
@fileUploadElementId="chat-widget-uploader"
- @onUploadChanged={{self.onUploadChanged}}
+ @onUploadChanged={{this.onUploadChanged}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs
index 97313587772..742cf49c135 100644
--- a/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs
@@ -7,12 +7,10 @@ module("Discourse Chat | Component | chat-emoji-avatar", function (hooks) {
setupRenderingTest(hooks);
test("uses an emoji as avatar", async function (assert) {
- const self = this;
-
this.set("emoji", ":otter:");
await render(
- <template><ChatEmojiAvatar @emoji={{self.emoji}} /></template>
+ <template><ChatEmojiAvatar @emoji={{this.emoji}} /></template>
);
assert
diff --git a/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs
index 8d697067892..ae87c804fe7 100644
--- a/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs
@@ -10,8 +10,6 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
setupRenderingTest(hooks);
test("chat_webhook_event", async function (assert) {
- const self = this;
-
this.message = ChatMessage.create(
new ChatFabricators(getOwner(this)).channel(),
{
@@ -19,14 +17,12 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
}
);
- await render(<template><Avatar @message={{self.message}} /></template>);
+ await render(<template><Avatar @message={{this.message}} /></template>);
assert.dom(".chat-emoji-avatar .emoji").hasAttribute("title", "heart");
});
test("user", async function (assert) {
- const self = this;
-
this.message = ChatMessage.create(
new ChatFabricators(getOwner(this)).channel(),
{
@@ -34,7 +30,7 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
}
);
- await render(<template><Avatar @message={{self.message}} /></template>);
+ await render(<template><Avatar @message={{this.message}} /></template>);
assert.dom('.chat-user-avatar [data-user-card="discobot"]').exists();
});
diff --git a/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs b/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs
index 880dc62ca10..4e4475ff302 100644
--- a/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs
@@ -50,11 +50,9 @@ module("Discourse Chat | Component | chat message collapser", function (hooks) {
setupRenderingTest(hooks);
test("escapes uploads header", async function (assert) {
- const self = this;
-
this.set("uploads", [{ original_filename: evilString }]);
await render(
- <template><ChatMessageCollapser @uploads={{self.uploads}} /></template>
+ <template><ChatMessageCollapser @uploads={{this.uploads}} /></template>
);
assert
@@ -69,8 +67,6 @@ module(
setupRenderingTest(hooks);
test("escapes youtube header", async function (assert) {
- const self = this;
-
this.set(
"cooked",
youtubeCooked.replace(
@@ -79,7 +75,7 @@ module(
)
);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
assert
@@ -91,12 +87,10 @@ module(
});
test("shows youtube link in header", async function (assert) {
- const self = this;
-
this.set("cooked", youtubeCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const link = queryAll(".chat-message-collapser-link");
@@ -111,13 +105,11 @@ module(
});
test("shows all user written text", async function (assert) {
- const self = this;
-
youtubeCooked.youtubeid;
this.set("cooked", youtubeCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const text = queryAll(".chat-message-collapser p");
@@ -133,12 +125,10 @@ module(
});
test("collapses and expands cooked youtube", async function (assert) {
- const self = this;
-
this.set("cooked", youtubeCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const youtubeDivs = queryAll(".youtube-onebox");
@@ -193,16 +183,14 @@ module(
const imageTextCooked = "<p>A picture of Tomtom</p>";
test("shows filename for one image", async function (assert) {
- const self = this;
-
this.set("cooked", imageTextCooked);
this.set("uploads", [{ original_filename: "tomtom.jpeg" }]);
await render(
<template>
<ChatMessageCollapser
- @cooked={{self.cooked}}
- @uploads={{self.uploads}}
+ @cooked={{this.cooked}}
+ @uploads={{this.uploads}}
/>
</template>
);
@@ -213,16 +201,14 @@ module(
});
test("shows number of files for multiple images", async function (assert) {
- const self = this;
-
this.set("cooked", imageTextCooked);
this.set("uploads", [{}, {}]);
await render(
<template>
<ChatMessageCollapser
- @cooked={{self.cooked}}
- @uploads={{self.uploads}}
+ @cooked={{this.cooked}}
+ @uploads={{this.uploads}}
/>
</template>
);
@@ -231,8 +217,6 @@ module(
});
test("collapses and expands images", async function (assert) {
- const self = this;
-
this.set("cooked", imageTextCooked);
this.set("uploads", [
{
@@ -246,8 +230,8 @@ module(
await render(
<template>
<ChatMessageCollapser
- @cooked={{self.cooked}}
- @uploads={{self.uploads}}
+ @cooked={{this.cooked}}
+ @uploads={{this.uploads}}
/>
</template>
);
@@ -272,12 +256,10 @@ module(
setupRenderingTest(hooks);
test("shows links for animated image", async function (assert) {
- const self = this;
-
this.set("cooked", animatedImageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const links = queryAll("a.chat-message-collapser-link-small");
@@ -292,12 +274,10 @@ module(
});
test("shows all user written text", async function (assert) {
- const self = this;
-
this.set("cooked", animatedImageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const text = queryAll(".chat-message-collapser p");
@@ -309,12 +289,10 @@ module(
});
test("collapses and expands animated image onebox", async function (assert) {
- const self = this;
-
this.set("cooked", animatedImageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const animatedOneboxes = queryAll(".animated.onebox");
@@ -356,12 +334,10 @@ module(
setupRenderingTest(hooks);
test("shows links for animated image", async function (assert) {
- const self = this;
-
this.set("cooked", externalImageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const links = queryAll("a.chat-message-collapser-link-small");
@@ -374,12 +350,10 @@ module(
});
test("shows all user written text", async function (assert) {
- const self = this;
-
this.set("cooked", externalImageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const text = queryAll(".chat-message-collapser p");
@@ -391,12 +365,10 @@ module(
});
test("collapses and expands image oneboxes", async function (assert) {
- const self = this;
-
this.set("cooked", externalImageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const imageOneboxes = queryAll(".onebox");
@@ -438,8 +410,6 @@ module(
setupRenderingTest(hooks);
skip("escapes link", async function (assert) {
- const self = this;
-
this.set(
"cooked",
imageCooked
@@ -447,7 +417,7 @@ module(
.replace("/images/d-logo-sketch-small.png", evilString)
);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const links = [
@@ -461,12 +431,10 @@ module(
});
test("shows alt or links (if no alt) for linked image", async function (assert) {
- const self = this;
-
this.set("cooked", imageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const links = queryAll("a.chat-message-collapser-link-small");
@@ -481,12 +449,10 @@ module(
});
test("shows all user written text", async function (assert) {
- const self = this;
-
this.set("cooked", imageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const text = queryAll(".chat-message-collapser p");
@@ -498,12 +464,10 @@ module(
});
test("collapses and expands images", async function (assert) {
- const self = this;
-
this.set("cooked", imageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const images = queryAll("img");
@@ -538,12 +502,10 @@ module(
});
test("does not show collapser for emoji images", async function (assert) {
- const self = this;
-
this.set("cooked", imageCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const links = queryAll("a.chat-message-collapser-link-small");
@@ -563,8 +525,6 @@ module(
setupRenderingTest(hooks);
test("escapes title/link", async function (assert) {
- const self = this;
-
this.set(
"cooked",
galleryCooked
@@ -572,7 +532,7 @@ module(
.replace("Le tomtom album", evilString)
);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
assert
@@ -582,24 +542,20 @@ module(
});
test("removes album title overlay", async function (assert) {
- const self = this;
-
this.set("cooked", galleryCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
assert.dom(".album-title").doesNotExist("album title removed");
});
test("shows gallery link", async function (assert) {
- const self = this;
-
this.set("cooked", galleryCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
assert
@@ -608,12 +564,10 @@ module(
});
test("shows all user written text", async function (assert) {
- const self = this;
-
this.set("cooked", galleryCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
const text = queryAll(".chat-message-collapser p");
@@ -624,12 +578,10 @@ module(
});
test("collapses and expands images", async function (assert) {
- const self = this;
-
this.set("cooked", galleryCooked);
await render(
- <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>
+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>
);
assert.dom("img").isVisible("image visible initially");
diff --git a/plugins/chat/test/javascripts/components/chat-message-info-test.gjs b/plugins/chat/test/javascripts/components/chat-message-info-test.gjs
index 80e7f7f6b19..6e5cc3c6f5c 100644
--- a/plugins/chat/test/javascripts/components/chat-message-info-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-info-test.gjs
@@ -12,14 +12,12 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
setupRenderingTest(hooks);
test("chat_webhook_event", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
chat_webhook_event: { username: "discobot" },
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert
@@ -29,14 +27,12 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
test("user", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: { username: "discobot" },
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert
@@ -45,23 +41,19 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
test("date", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: { username: "discobot" },
created_at: moment(),
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert.dom(".chat-message-info__date").exists();
});
test("bookmark (with reminder)", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: { username: "discobot" },
bookmark: Bookmark.create({
@@ -71,7 +63,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert
@@ -80,8 +72,6 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
test("bookmark (no reminder)", async function (assert) {
- const self = this;
-
this.message = ChatMessage.create(
new ChatFabricators(getOwner(this)).channel(),
{
@@ -93,37 +83,33 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
);
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert.dom(".chat-message-info__bookmark .d-icon-bookmark").exists();
});
test("user status", async function (assert) {
- const self = this;
-
const status = { description: "off to dentist", emoji: "tooth" };
this.message = new ChatFabricators(getOwner(this)).message({
user: { status },
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert.dom(".chat-message-info__status .user-status-message").exists();
});
test("flag status", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: { username: "discobot" },
user_flag_status: 0,
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert
@@ -132,15 +118,13 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
test("reviewable", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: { username: "discobot" },
user_flag_status: 0,
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert
@@ -149,8 +133,6 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
test("with username classes", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: {
username: "discobot",
@@ -162,7 +144,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert.dom(".chat-message-info__username.is-staff").exists();
@@ -173,14 +155,12 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
});
test("without username classes", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: { username: "discobot" },
});
await render(
- <template><Info @message={{self.message}} @show={{true}} /></template>
+ <template><Info @message={{this.message}} @show={{true}} /></template>
);
assert.dom(".chat-message-info__username.is-staff").doesNotExist();
diff --git a/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs b/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs
index bd122d4edc8..a87d13e96f5 100644
--- a/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs
@@ -13,26 +13,22 @@ module(
setupRenderingTest(hooks);
test("default", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message();
await render(
- <template><LeftGutter @message={{self.message}} /></template>
+ <template><LeftGutter @message={{this.message}} /></template>
);
assert.dom(".chat-message-left-gutter__date").exists();
});
test("with reviewable", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
reviewable_id: 1,
});
await render(
- <template><LeftGutter @message={{self.message}} /></template>
+ <template><LeftGutter @message={{this.message}} /></template>
);
assert
@@ -41,14 +37,12 @@ module(
});
test("with flag status", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user_flag_status: 0,
});
await render(
- <template><LeftGutter @message={{self.message}} /></template>
+ <template><LeftGutter @message={{this.message}} /></template>
);
assert
@@ -57,14 +51,12 @@ module(
});
test("bookmark", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
bookmark: new CoreFabricators(getOwner(this)).bookmark(),
});
await render(
- <template><LeftGutter @message={{self.message}} /></template>
+ <template><LeftGutter @message={{this.message}} /></template>
);
assert.dom(".chat-message-left-gutter__date").exists();
diff --git a/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs b/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs
index 980adf37ee8..dad3f9f9952 100644
--- a/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs
@@ -39,14 +39,12 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
});
test("count of reactions", async function (assert) {
- const self = this;
-
this.set("count", 0);
await render(
<template>
<ChatMessageReaction
- @reaction={{hash emoji="heart" count=self.count}}
+ @reaction={{hash emoji="heart" count=this.count}}
/>
</template>
);
@@ -68,8 +66,6 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
});
test("click action", async function (assert) {
- const self = this;
-
this.set("count", 0);
this.set("react", () => {
this.set("count", 1);
@@ -79,8 +75,8 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
<template>
<ChatMessageReaction
class="show"
- @reaction={{hash emoji="heart" count=self.count}}
- @onReaction={{self.react}}
+ @reaction={{hash emoji="heart" count=this.count}}
+ @onReaction={{this.react}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-message-test.gjs b/plugins/chat/test/javascripts/components/chat-message-test.gjs
index 72fd4e66abe..cccc3358c5f 100644
--- a/plugins/chat/test/javascripts/components/chat-message-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-test.gjs
@@ -10,27 +10,23 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
setupRenderingTest(hooks);
test("Message with edits", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
edited: true,
});
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert.dom(".chat-message-edited").exists("has the correct css class");
});
test("Deleted message", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
user: this.currentUser,
deleted_at: moment(),
});
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
@@ -39,13 +35,11 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
test("Hidden message", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
hidden: true,
});
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
@@ -54,29 +48,25 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
test("Message by a bot", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
message: "what <mark>test</mark>",
user: new CoreFabricators(getOwner(this)).user({ id: -10 }),
});
await this.message.cook();
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert.dom(".chat-message-container.is-bot").exists("has the bot class");
});
test("Message with mark html tag", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
message: "what <mark>test</mark>",
});
await this.message.cook();
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
@@ -85,13 +75,11 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
test("Message with reply", async function (assert) {
- const self = this;
-
this.message = new ChatFabricators(getOwner(this)).message({
inReplyTo: new ChatFabricators(getOwner(this)).message(),
});
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
@@ -100,8 +88,6 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
test("Message with streaming", async function (assert) {
- const self = this;
-
// admin
this.currentUser.admin = true;
@@ -111,7 +97,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
await this.message.cook();
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
@@ -129,7 +115,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
await this.message.cook();
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
@@ -149,7 +135,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
});
await this.message.cook();
await render(
- <template><ChatMessage @message={{self.message}} /></template>
+ <template><ChatMessage @message={{this.message}} /></template>
);
assert
diff --git a/plugins/chat/test/javascripts/components/chat-message-text-test.gjs b/plugins/chat/test/javascripts/components/chat-message-text-test.gjs
index e12debed1d6..7e152b849e4 100644
--- a/plugins/chat/test/javascripts/components/chat-message-text-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-message-text-test.gjs
@@ -7,13 +7,11 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
setupRenderingTest(hooks);
test("yields", async function (assert) {
- const self = this;
-
this.set("cooked", "<p></p>");
await render(
<template>
- <ChatMessageText @cooked={{self.cooked}} @uploads={{self.uploads}}>
+ <ChatMessageText @cooked={{this.cooked}} @uploads={{this.uploads}}>
<div class="yield-me"></div>
</ChatMessageText>
</template>
@@ -23,8 +21,6 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
});
test("shows collapsed", async function (assert) {
- const self = this;
-
this.set(
"cooked",
'<div class="youtube-onebox lazy-video-container" data-video-id="WaT_rLGuUr8" data-video-title="Japanese Katsu Curry (Pork Cutlet)" data-provider-name="youtube"/>'
@@ -32,7 +28,7 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
await render(
<template>
- <ChatMessageText @cooked={{self.cooked}} @uploads={{self.uploads}} />
+ <ChatMessageText @cooked={{this.cooked}} @uploads={{this.uploads}} />
</template>
);
@@ -40,25 +36,21 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
});
test("does not collapse a non-image onebox", async function (assert) {
- const self = this;
-
this.set("cooked", '<p><a href="http://cat1.com" class="onebox"></a></p>');
await render(
- <template><ChatMessageText @cooked={{self.cooked}} /></template>
+ <template><ChatMessageText @cooked={{this.cooked}} /></template>
);
assert.dom(".chat-message-collapser").doesNotExist();
});
test("shows edits - regular message", async function (assert) {
- const self = this;
-
this.set("cooked", "<p></p>");
await render(
<template>
- <ChatMessageText @cooked={{self.cooked}} @edited={{true}} />
+ <ChatMessageText @cooked={{this.cooked}} @edited={{true}} />
</template>
);
@@ -66,8 +58,6 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
});
test("shows edits - collapsible message", async function (assert) {
- const self = this;
-
this.set(
"cooked",
'<div class="youtube-onebox lazy-video-container"></div>'
@@ -75,7 +65,7 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
await render(
<template>
- <ChatMessageText @cooked={{self.cooked}} @edited={{true}} />
+ <ChatMessageText @cooked={{this.cooked}} @edited={{true}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs
index cb60d2d61d6..46e5920f68c 100644
--- a/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs
@@ -12,8 +12,6 @@ module(
setupRenderingTest(hooks);
test("channel title is escaped in instructions correctly", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel({
title: `<script>someeviltitle</script>`,
});
@@ -22,7 +20,7 @@ module(
<template>
<ArchiveChannel
@inline={{true}}
- @model={{hash channel=self.channel}}
+ @model={{hash channel=this.channel}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs
index 5d915f9cb4e..554008413ef 100644
--- a/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs
@@ -12,8 +12,6 @@ module(
setupRenderingTest(hooks);
test("channel title is escaped in instructions correctly", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel({
title: `<script>someeviltitle</script>`,
});
@@ -22,7 +20,7 @@ module(
<template>
<DeleteChannel
@inline={{true}}
- @model={{hash channel=self.channel}}
+ @model={{hash channel=this.channel}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs
index 6977ae147b7..fc721c8483a 100644
--- a/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs
@@ -12,8 +12,6 @@ module(
setupRenderingTest(hooks);
test("channel title is escaped in instructions correctly", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel({
title: "<script>someeviltitle</script>",
});
@@ -24,8 +22,8 @@ module(
<MoveMessageToChannel
@inline={{true}}
@model={{hash
- sourceChannel=self.channel
- selectedMessageIds=self.selectedMessageIds
+ sourceChannel=this.channel
+ selectedMessageIds=this.selectedMessageIds
}}
/>
</template>
diff --git a/plugins/chat/test/javascripts/components/chat-notices-test.gjs b/plugins/chat/test/javascripts/components/chat-notices-test.gjs
index ae3e0282fe3..2715215ec9e 100644
--- a/plugins/chat/test/javascripts/components/chat-notices-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-notices-test.gjs
@@ -12,8 +12,6 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
setupRenderingTest(hooks);
test("displays all notices for a channel", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
this.manager = this.container.lookup(
"service:chat-channel-notices-manager"
@@ -32,7 +30,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
});
await render(
- <template><ChatNotices @channel={{self.channel}} /></template>
+ <template><ChatNotices @channel={{this.channel}} /></template>
);
const notices = queryAll(".chat-notices .chat-notices__notice");
@@ -44,8 +42,6 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
});
test("Notices can be cleared", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
this.manager = this.container.lookup(
"service:chat-channel-notices-manager"
@@ -56,7 +52,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
});
await render(
- <template><ChatNotices @channel={{self.channel}} /></template>
+ <template><ChatNotices @channel={{this.channel}} /></template>
);
assert.strictEqual(
@@ -74,8 +70,6 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
);
});
test("MentionWithoutMembership notice renders", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
this.manager = this.container.lookup(
"service:chat-channel-notices-manager"
@@ -88,7 +82,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
});
await render(
- <template><ChatNotices @channel={{self.channel}} /></template>
+ <template><ChatNotices @channel={{this.channel}} /></template>
);
assert.strictEqual(
diff --git a/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs b/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs
index 0d6de2c6b81..673aef73a3f 100644
--- a/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs
@@ -162,8 +162,6 @@ module(
});
test("resets presence when channel changes", async function (assert) {
- const self = this;
-
this.set("presenceChannelName", "/chat-reply/1");
await addUser(1, "sam");
@@ -171,7 +169,7 @@ module(
await render(
<template>
<ChatReplyingIndicator
- @presenceChannelName={{self.presenceChannelName}}
+ @presenceChannelName={{this.presenceChannelName}}
/>
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs b/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs
index 3df50c496d0..ec845f28a37 100644
--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs
@@ -11,13 +11,11 @@ module(
setupRenderingTest(hooks);
test("display retention info", async function (assert) {
- const self = this;
-
this.channel = ChatChannel.create({ chatable_type: "Category" });
this.currentUser.set("needs_channel_retention_reminder", true);
await render(
- <template><ChatRetentionReminder @channel={{self.channel}} /></template>
+ <template><ChatRetentionReminder @channel={{this.channel}} /></template>
);
assert.dom(".chat-retention-reminder").includesText(
@@ -28,14 +26,12 @@ module(
});
test("@type=short", async function (assert) {
- const self = this;
-
this.channel = ChatChannel.create({ chatable_type: "Category" });
this.currentUser.set("needs_channel_retention_reminder", true);
await render(
<template>
- <ChatRetentionReminder @channel={{self.channel}} @type="short" />
+ <ChatRetentionReminder @channel={{this.channel}} @type="short" />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs
index 638f76fd6ef..a7d49b720df 100644
--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs
@@ -12,14 +12,12 @@ module(
setupRenderingTest(hooks);
test("when setting is set on 0", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
this.siteSettings.chat_channel_retention_days = 0;
await render(
<template>
- <ChatRetentionReminderText @channel={{self.channel}} />
+ <ChatRetentionReminderText @channel={{this.channel}} />
</template>
);
@@ -29,7 +27,7 @@ module(
await render(
<template>
- <ChatRetentionReminderText @channel={{self.channel}} @type="short" />
+ <ChatRetentionReminderText @channel={{this.channel}} @type="short" />
</template>
);
@@ -39,14 +37,12 @@ module(
});
test("when channel is a public channel", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).channel();
this.siteSettings.chat_channel_retention_days = 10;
await render(
<template>
- <ChatRetentionReminderText @channel={{self.channel}} />
+ <ChatRetentionReminderText @channel={{this.channel}} />
</template>
);
@@ -56,7 +52,7 @@ module(
await render(
<template>
- <ChatRetentionReminderText @channel={{self.channel}} @type="short" />
+ <ChatRetentionReminderText @channel={{this.channel}} @type="short" />
</template>
);
@@ -66,14 +62,12 @@ module(
});
test("when channel is a DM channel", async function (assert) {
- const self = this;
-
this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();
this.siteSettings.chat_dm_retention_days = 10;
await render(
<template>
- <ChatRetentionReminderText @channel={{self.channel}} />
+ <ChatRetentionReminderText @channel={{this.channel}} />
</template>
);
@@ -83,7 +77,7 @@ module(
await render(
<template>
- <ChatRetentionReminderText @channel={{self.channel}} @type="short" />
+ <ChatRetentionReminderText @channel={{this.channel}} @type="short" />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs
index 03871c89572..48fdcd8ffae 100644
--- a/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs
@@ -9,14 +9,12 @@ module("Discourse Chat | Component | chat-thread-header", function (hooks) {
setupRenderingTest(hooks);
test("it safely renders title", async function (assert) {
- const self = this;
-
const title = "<style>body { background: red;}</style>";
this.thread = new ChatFabricators(getOwner(this)).thread({ title });
await render(
<template>
- <Header @thread={{self.thread}} @channel={{self.thread.channel}} />
+ <Header @thread={{this.thread}} @channel={{this.thread.channel}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs
index eeee55ffc3a..269307e47fe 100644
--- a/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs
@@ -9,12 +9,10 @@ module("Discourse Chat | Component | chat-thread-list-item", function (hooks) {
setupRenderingTest(hooks);
test("it safely renders title", async function (assert) {
- const self = this;
-
const title = "<style>body { background: red;}</style>";
this.thread = new ChatFabricators(getOwner(this)).thread({ title });
- await render(<template><Item @thread={{self.thread}} /></template>);
+ await render(<template><Item @thread={{this.thread}} /></template>);
assert
.dom(".chat-thread-list-item__title")
diff --git a/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs
index 5ba56f5ce2c..d063a6b7b58 100644
--- a/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs
@@ -12,19 +12,15 @@ module(
setupRenderingTest(hooks);
test("no participants", async function (assert) {
- const self = this;
-
this.thread = new ChatFabricators(getOwner(this)).thread();
await render(
- <template><ChatThreadParticipants @thread={{self.thread}} /></template>
+ <template><ChatThreadParticipants @thread={{this.thread}} /></template>
);
assert.dom(".chat-thread-participants").doesNotExist();
});
test("@includeOriginalMessageUser=true", async function (assert) {
- const self = this;
-
const originalMessageUser = new CoreFabricators(getOwner(this)).user({
username: "bob",
});
@@ -42,15 +38,13 @@ module(
});
await render(
- <template><ChatThreadParticipants @thread={{self.thread}} /></template>
+ <template><ChatThreadParticipants @thread={{this.thread}} /></template>
);
assert.dom(".chat-user-avatar[data-username]").exists({ count: 2 });
});
test("@includeOriginalMessageUser=false", async function (assert) {
- const self = this;
-
const originalMessageUser = new CoreFabricators(getOwner(this)).user({
username: "bob",
});
@@ -70,7 +64,7 @@ module(
await render(
<template>
<ChatThreadParticipants
- @thread={{self.thread}}
+ @thread={{this.thread}}
@includeOriginalMessageUser={{false}}
/>
</template>
diff --git a/plugins/chat/test/javascripts/components/chat-upload-test.gjs b/plugins/chat/test/javascripts/components/chat-upload-test.gjs
index 15aef53bcd3..99d676557c9 100644
--- a/plugins/chat/test/javascripts/components/chat-upload-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-upload-test.gjs
@@ -70,11 +70,9 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
setupRenderingTest(hooks);
test("with an image", async function (assert) {
- const self = this;
-
this.set("upload", IMAGE_FIXTURE);
- await render(<template><ChatUpload @upload={{self.upload}} /></template>);
+ await render(<template><ChatUpload @upload={{this.upload}} /></template>);
assert.dom("img.chat-img-upload").exists("displays as an image");
assert
@@ -99,11 +97,9 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
});
test("with a video", async function (assert) {
- const self = this;
-
this.set("upload", VIDEO_FIXTURE);
- await render(<template><ChatUpload @upload={{self.upload}} /></template>);
+ await render(<template><ChatUpload @upload={{this.upload}} /></template>);
assert.dom("video.chat-video-upload").exists("displays as an video");
assert.dom("video.chat-video-upload").hasAttribute("controls");
@@ -117,11 +113,9 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
});
test("with a audio", async function (assert) {
- const self = this;
-
this.set("upload", AUDIO_FIXTURE);
- await render(<template><ChatUpload @upload={{self.upload}} /></template>);
+ await render(<template><ChatUpload @upload={{this.upload}} /></template>);
assert.dom("audio.chat-audio-upload").exists("displays as an audio");
assert.dom("audio.chat-audio-upload").hasAttribute("controls");
@@ -135,11 +129,9 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
});
test("non image upload", async function (assert) {
- const self = this;
-
this.set("upload", TXT_FIXTURE);
- await render(<template><ChatUpload @upload={{self.upload}} /></template>);
+ await render(<template><ChatUpload @upload={{this.upload}} /></template>);
assert.dom("a.chat-other-upload").exists("displays as a link");
assert
@@ -161,14 +153,13 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
});
test("adds timestamp parameter for Safari", async function (assert) {
- const self = this;
this.set("upload", {
...VIDEO_FIXTURE,
url: "https://example.com/video.mp4",
});
mockCapabilities.isSafari = true;
- await render(<template><ChatUpload @upload={{self.upload}} /></template>);
+ await render(<template><ChatUpload @upload={{this.upload}} /></template>);
assert
.dom("video.chat-video-upload source")
@@ -180,14 +171,13 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
});
test("does not add timestamp parameter for other browsers", async function (assert) {
- const self = this;
this.set("upload", {
...VIDEO_FIXTURE,
url: "https://example.com/video.mp4",
});
mockCapabilities.isSafari = false;
- await render(<template><ChatUpload @upload={{self.upload}} /></template>);
+ await render(<template><ChatUpload @upload={{this.upload}} /></template>);
assert
.dom("video.chat-video-upload source")
diff --git a/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs
index bfeefb93d1f..50849b99810 100644
--- a/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs
@@ -18,14 +18,12 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {
setupRenderingTest(hooks);
test("when user is not online", async function (assert) {
- const self = this;
-
this.user = new CoreFabricators(getOwner(this)).user();
this.chat = { presenceChannel: { users: [] } };
await render(
<template>
- <ChatUserAvatar @chat={{self.chat}} @user={{self.user}} />
+ <ChatUserAvatar @chat={{this.chat}} @user={{this.user}} />
</template>
);
@@ -33,8 +31,6 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {
});
test("user is online", async function (assert) {
- const self = this;
-
this.user = new CoreFabricators(getOwner(this)).user();
this.chat = {
presenceChannel: { users: [{ id: this.user.id }] },
@@ -42,7 +38,7 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {
await render(
<template>
- <ChatUserAvatar @chat={{self.chat}} @user={{self.user}} />
+ <ChatUserAvatar @chat={{this.chat}} @user={{this.user}} />
</template>
);
@@ -50,8 +46,6 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {
});
test("@showPresence=false", async function (assert) {
- const self = this;
-
this.user = new CoreFabricators(getOwner(this)).user();
this.chat = {
presenceChannel: { users: [{ id: this.user.id }] },
@@ -61,8 +55,8 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {
<template>
<ChatUserAvatar
@showPresence={{false}}
- @chat={{self.chat}}
- @user={{self.user}}
+ @chat={{this.chat}}
+ @user={{this.user}}
/>
</template>
);
@@ -71,13 +65,11 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {
});
test("@interactive=true", async function (assert) {
- const self = this;
-
this.user = new CoreFabricators(getOwner(this)).user();
await render(
<template>
- <ChatUserAvatar @interactive={{false}} @user={{self.user}} />
+ <ChatUserAvatar @interactive={{false}} @user={{this.user}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs b/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs
index 4d556b5546d..a0797151249 100644
--- a/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs
@@ -12,8 +12,6 @@ module(
setupRenderingTest(hooks);
test("when current user can send direct messages", async function (assert) {
- const self = this;
-
sinon
.stub(this.owner.lookup("service:chat"), "userCanDirectMessage")
.value(true);
@@ -21,7 +19,7 @@ module(
await render(
<template>
- <DirectMessageButton @user={{self.user}} @modal={{true}} />
+ <DirectMessageButton @user={{this.user}} @modal={{true}} />
</template>
);
@@ -29,8 +27,6 @@ module(
});
test("when current user can’t send direct messages", async function (assert) {
- const self = this;
-
sinon
.stub(this.owner.lookup("service:chat"), "userCanDirectMessage")
.value(false);
@@ -38,7 +34,7 @@ module(
await render(
<template>
- <DirectMessageButton @user={{self.user}} @modal={{true}} />
+ <DirectMessageButton @user={{this.user}} @modal={{true}} />
</template>
);
@@ -48,8 +44,6 @@ module(
});
test("when displayed user has disabled PMs / DMs", async function (assert) {
- const self = this;
-
sinon
.stub(this.owner.lookup("service:chat"), "userCanDirectMessage")
.value(true);
@@ -60,7 +54,7 @@ module(
await render(
<template>
- <DirectMessageButton @user={{self.user}} @modal={{true}} />
+ <DirectMessageButton @user={{this.user}} @modal={{true}} />
</template>
);
diff --git a/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs b/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs
index cb53e32af94..a1f3adae5b3 100644
--- a/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs
@@ -9,26 +9,22 @@ module(
setupRenderingTest(hooks);
test("username and no name", async function (assert) {
- const self = this;
-
this.siteSettings.prioritize_username_in_ux = true;
this.set("user", { username: "bob", name: null });
await render(
- <template><ChatUserDisplayName @user={{self.user}} /></template>
+ <template><ChatUserDisplayName @user={{this.user}} /></template>
);
assert.dom(".chat-user-display-name").hasText("bob");
});
test("username and name", async function (assert) {
- const self = this;
-
this.siteSettings.prioritize_username_in_ux = true;
this.set("user", { username: "bob", name: "Bobcat" });
await render(
- <template><ChatUserDisplayName @user={{self.user}} /></template>
+ <template><ChatUserDisplayName @user={{this.user}} /></template>
);
assert.dom(".chat-user-display-name").hasText("bob Bobcat");
@@ -42,26 +38,22 @@ module(
setupRenderingTest(hooks);
test("no name", async function (assert) {
- const self = this;
-
this.siteSettings.prioritize_username_in_ux = false;
this.set("user", { username: "bob", name: null });
await render(
- <template><ChatUserDisplayName @user={{self.user}} /></template>
+ <template><ChatUserDisplayName @user={{this.user}} /></template>
);
assert.dom(".chat-user-display-name").hasText("bob");
});
test("name and username", async function (assert) {
- const self = this;
-
this.siteSettings.prioritize_username_in_ux = false;
this.set("user", { username: "bob", name: "Bobcat" });
await render(
- <template><ChatUserDisplayName @user={{self.user}} /></template>
+ <template><ChatUserDisplayName @user={{this.user}} /></template>
);
assert.dom(".chat-user-display-name").hasText("Bobcat bob");
diff --git a/plugins/chat/test/javascripts/components/chat-user-info-test.gjs b/plugins/chat/test/javascripts/components/chat-user-info-test.gjs
index f4675cfa3fc..dda8b1d7bdb 100644
--- a/plugins/chat/test/javascripts/components/chat-user-info-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-user-info-test.gjs
@@ -7,19 +7,15 @@ module("Discourse Chat | Component | chat-user-info", function (hooks) {
setupRenderingTest(hooks);
test("avatar and name", async function (assert) {
- const self = this;
-
this.set("user", this.currentUser);
- await render(<template><ChatUserInfo @user={{self.user}} /></template>);
+ await render(<template><ChatUserInfo @user={{this.user}} /></template>);
assert.dom().containsText(this.user.username);
assert.dom().containsText(this.user.name);
});
test("status message", async function (assert) {
- const self = this;
-
this.siteSettings.enable_user_status = true;
this.set("user", this.currentUser);
@@ -31,7 +27,7 @@ module("Discourse Chat | Component | chat-user-info", function (hooks) {
await render(
<template>
<ChatUserInfo
- @user={{self.user}}
+ @user={{this.user}}
@showStatus={{true}}
@showStatusDescription={{true}}
/>
diff --git a/plugins/chat/test/javascripts/components/collapser-test.gjs b/plugins/chat/test/javascripts/components/collapser-test.gjs
index a721964588a..f75b73d7fb8 100644
--- a/plugins/chat/test/javascripts/components/collapser-test.gjs
+++ b/plugins/chat/test/javascripts/components/collapser-test.gjs
@@ -8,11 +8,9 @@ module("Discourse Chat | Component | collapser", function (hooks) {
setupRenderingTest(hooks);
test("renders header", async function (assert) {
- const self = this;
-
this.set("header", htmlSafe(`<div class="cat">tomtom</div>`));
- await render(<template><Collapser @header={{self.header}} /></template>);
+ await render(<template><Collapser @header={{this.header}} /></template>);
assert.dom(".cat").exists();
});
diff --git a/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-item-test.gjs b/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-item-test.gjs
index 7628892c7d7..60f45f34459 100644
--- a/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-item-test.gjs
+++ b/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-item-test.gjs
@@ -7,8 +7,6 @@ module("Integration | Component | AdminHolidaysListItem", function (hooks) {
setupRenderingTest(hooks);
test("when a holiday is disabled, it displays an enable button and adds a disabled CSS class", async function (assert) {
- const self = this;
-
this.set("holiday", {
date: "2022-01-01",
name: "New Year's Day",
@@ -19,9 +17,9 @@ module("Integration | Component | AdminHolidaysListItem", function (hooks) {
await render(
<template>
<AdminHolidaysListItem
- @holiday={{self.holiday}}
- @region_code={{self.region_code}}
- @isHolidayDisabled={{self.holiday.disabled}}
+ @holiday={{this.holiday}}
+ @region_code={{this.region_code}}
+ @isHolidayDisabled={{this.holiday.disabled}}
/>
</template>
);
@@ -31,8 +29,6 @@ module("Integration | Component | AdminHolidaysListItem", function (hooks) {
});
test("when a holiday is enabled, it displays a disable button and does not add a disabled CSS class", async function (assert) {
- const self = this;
-
this.set("holiday", {
date: "2022-01-01",
name: "New Year's Day",
@@ -43,9 +39,9 @@ module("Integration | Component | AdminHolidaysListItem", function (hooks) {
await render(
<template>
<AdminHolidaysListItem
- @holiday={{self.holiday}}
- @region_code={{self.region_code}}
- @isHolidayDisabled={{self.holiday.disabled}}
+ @holiday={{this.holiday}}
+ @region_code={{this.region_code}}
+ @isHolidayDisabled={{this.holiday.disabled}}
/>
</template>
);
diff --git a/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-test.gjs b/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-test.gjs
index ac6c8f710a3..06bdfeee8a4 100644
--- a/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-test.gjs
+++ b/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-test.gjs
@@ -7,15 +7,13 @@ module("Integration | Component | admin-holidays-list", function (hooks) {
setupRenderingTest(hooks);
test("displaying a list of the provided holidays", async function (assert) {
- const self = this;
-
this.set("holidays", [
{ date: "2022-01-01", name: "New Year's Day" },
{ date: "2022-01-17", name: "Martin Luther King, Jr. Day" },
]);
await render(
- <template><AdminHolidaysList @holidays={{self.holidays}} /></template>
+ <template><AdminHolidaysList @holidays={{this.holidays}} /></template>
);
assert
diff --git a/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs b/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs
index 8f0b036786b..b12646ad742 100644
--- a/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs
+++ b/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs
@@ -40,8 +40,6 @@ module("Data Explorer Plugin | Component | explorer-schema", function (hooks) {
setupRenderingTest(hooks);
test("will automatically convert to lowercase", async function (assert) {
- const self = this;
-
this.setProperties({
schema,
hideSchema: false,
@@ -51,9 +49,9 @@ module("Data Explorer Plugin | Component | explorer-schema", function (hooks) {
await render(
<template>
<ExplorerSchema
- @schema={{self.schema}}
- @hideSchema={{self.hideSchema}}
- @updateHideSchema={{self.updateHideSchema}}
+ @schema={{this.schema}}
+ @hideSchema={{this.hideSchema}}
+ @updateHideSchema={{this.updateHideSchema}}
/>
</template>
);
diff --git a/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs b/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs
index 41f43e1ec53..3f1c796b903 100644
--- a/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs
+++ b/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs
@@ -171,8 +171,6 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
}
test(testName.join(" "), async function (assert) {
- const self = this;
-
this.setProperties({
param_info: [
{
@@ -195,9 +193,9 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
<template>
<ParamInputForm
@hasParams="true"
- @initialValues={{self.initialValues}}
- @paramInfo={{self.param_info}}
- @onRegisterApi={{self.onRegisterApi}}
+ @initialValues={{this.initialValues}}
+ @paramInfo={{this.param_info}}
+ @onRegisterApi={{this.onRegisterApi}}
/>
</template>
);
@@ -251,8 +249,6 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
}
test("empty form will reject submit", async function (assert) {
- const self = this;
-
this.setProperties({
param_info: [
{
@@ -271,9 +267,9 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
await render(
<template>
<ParamInputForm
- @initialValues={{self.initialValues}}
- @paramInfo={{self.param_info}}
- @onRegisterApi={{self.onRegisterApi}}
+ @initialValues={{this.initialValues}}
+ @paramInfo={{this.param_info}}
+ @onRegisterApi={{this.onRegisterApi}}
/>
</template>
);
@@ -288,8 +284,6 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
});
test("async normalization", async function (assert) {
- const self = this;
-
this.setProperties({
param_info: [
{
@@ -308,9 +302,9 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
await render(
<template>
<ParamInputForm
- @initialValues={{self.initialValues}}
- @paramInfo={{self.param_info}}
- @onRegisterApi={{self.onRegisterApi}}
+ @initialValues={{this.initialValues}}
+ @paramInfo={{this.param_info}}
+ @onRegisterApi={{this.onRegisterApi}}
/>
</template>
);
@@ -323,8 +317,6 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
});
test("show error message when default value is invalid", async function (assert) {
- const self = this;
-
this.setProperties({
param_info: [
{
@@ -341,9 +333,9 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
await render(
<template>
<ParamInputForm
- @initialValues={{self.initialValues}}
- @paramInfo={{self.param_info}}
- @onRegisterApi={{self.onRegisterApi}}
+ @initialValues={{this.initialValues}}
+ @paramInfo={{this.param_info}}
+ @onRegisterApi={{this.onRegisterApi}}
/>
</template>
);
@@ -355,8 +347,6 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
});
test("date, time, datetime with initial value in other formats", async function (assert) {
- const self = this;
-
this.setProperties({
param_info: [
{
@@ -391,9 +381,9 @@ module("Data Explorer Plugin | Component | param-input", function (hooks) {
await render(
<template>
<ParamInputForm
- @initialValues={{self.initialValues}}
- @paramInfo={{self.param_info}}
- @onRegisterApi={{self.onRegisterApi}}
+ @initialValues={{this.initialValues}}
+ @paramInfo={{this.param_info}}
+ @onRegisterApi={{this.onRegisterApi}}
/>
</template>
);
diff --git a/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs b/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs
index 5e214c7b4ef..7e7d8f16af0 100644
--- a/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs
+++ b/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs
@@ -17,36 +17,32 @@ module("Discourse Lazy Videos | Component | lazy-video", function (hooks) {
};
test("displays the correct video title", async function (assert) {
- const self = this;
await render(
- <template><LazyVideo @videoAttributes={{self.attributes}} /></template>
+ <template><LazyVideo @videoAttributes={{this.attributes}} /></template>
);
assert.dom(".title-link").hasText(this.attributes.title);
});
test("uses the correct video start time", async function (assert) {
- const self = this;
await render(
- <template><LazyVideo @videoAttributes={{self.attributes}} /></template>
+ <template><LazyVideo @videoAttributes={{this.attributes}} /></template>
);
assert.dom(".youtube-onebox").hasAttribute("data-video-start-time", "234");
});
test("displays the correct provider icon", async function (assert) {
- const self = this;
await render(
- <template><LazyVideo @videoAttributes={{self.attributes}} /></template>
+ <template><LazyVideo @videoAttributes={{this.attributes}} /></template>
);
assert.dom(".icon.youtube-icon").exists();
});
test("uses the dominant color from the dom", async function (assert) {
- const self = this;
await render(
- <template><LazyVideo @videoAttributes={{self.attributes}} /></template>
+ <template><LazyVideo @videoAttributes={{this.attributes}} /></template>
);
assert
@@ -55,9 +51,8 @@ module("Discourse Lazy Videos | Component | lazy-video", function (hooks) {
});
test("loads the iframe when clicked", async function (assert) {
- const self = this;
await render(
- <template><LazyVideo @videoAttributes={{self.attributes}} /></template>
+ <template><LazyVideo @videoAttributes={{this.attributes}} /></template>
);
assert.dom(".lazy-video-container.video-loaded").doesNotExist();
@@ -66,15 +61,14 @@ module("Discourse Lazy Videos | Component | lazy-video", function (hooks) {
});
test("accepts an optional onLoadedVideo callback function", async function (assert) {
- const self = this;
this.set("foo", 1);
this.set("onLoadedVideo", () => this.set("foo", 2));
await render(
<template>
<LazyVideo
- @videoAttributes={{self.attributes}}
- @onLoadedVideo={{self.onLoadedVideo}}
+ @videoAttributes={{this.attributes}}
+ @onLoadedVideo={{this.onLoadedVideo}}
/>
</template>
);
diff --git a/plugins/discourse-policy/test/javascripts/integration/components/policy-builder-form-test.gjs b/plugins/discourse-policy/test/javascripts/integration/components/policy-builder-form-test.gjs
index a8597965e57..e137c226f20 100644
--- a/plugins/discourse-policy/test/javascripts/integration/components/policy-builder-form-test.gjs
+++ b/plugins/discourse-policy/test/javascripts/integration/components/policy-builder-form-test.gjs
@@ -13,8 +13,6 @@ module(
setupRenderingTest(hooks);
test("onChange", async function (assert) {
- const self = this;
-
this.set("policy", new EmberObject());
this.set("onChange", (key, value) => {
query(".output").innerText = `${key}=${value}`;
@@ -24,8 +22,8 @@ module(
<template>
<span class="output"></span>
<PolicyBuilderForm
- @onChange={{self.onChange}}
- @policy={{self.policy}}
+ @onChange={{this.onChange}}
+ @policy={{this.policy}}
/>
</template>
);
diff --git a/plugins/discourse-policy/test/javascripts/integration/components/post-policy-test.gjs b/plugins/discourse-policy/test/javascripts/integration/components/post-policy-test.gjs
index 1343556b029..a560348a6eb 100644
--- a/plugins/discourse-policy/test/javascripts/integration/components/post-policy-test.gjs
+++ b/plugins/discourse-policy/test/javascripts/integration/components/post-policy-test.gjs
@@ -20,11 +20,9 @@ module(
setupRenderingTest(hooks);
test("empty post", async function (assert) {
- const self = this;
-
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -32,14 +30,12 @@ module(
});
test("post#policy_can_accept", async function (assert) {
- const self = this;
-
this.set("post", fabricatePost({ policy_can_accept: true }));
this.set("policy", fabricatePolicy());
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -48,14 +44,12 @@ module(
});
test("post#policy_can_revoke", async function (assert) {
- const self = this;
-
this.set("post", fabricatePost({ policy_can_revoke: true }));
this.set("policy", fabricatePolicy());
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -64,14 +58,12 @@ module(
});
test("post#policy_accepted_by_count", async function (assert) {
- const self = this;
-
this.set("post", fabricatePost({ policy_accepted_by_count: 10 }));
this.set("policy", fabricatePolicy());
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -79,14 +71,12 @@ module(
});
test("post#policy_not_accepted_by_count", async function (assert) {
- const self = this;
-
this.set("post", fabricatePost({ policy_not_accepted_by_count: 10 }));
this.set("policy", fabricatePolicy());
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -94,8 +84,6 @@ module(
});
test("no possible users", async function (assert) {
- const self = this;
-
this.set(
"post",
fabricatePost({
@@ -108,7 +96,7 @@ module(
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -118,8 +106,6 @@ module(
});
test("does not show 'no possible users' when no access to stats", async function (assert) {
- const self = this;
-
this.set(
"post",
fabricatePost({
@@ -131,7 +117,7 @@ module(
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -139,8 +125,6 @@ module(
});
test("toggle state", async function (assert) {
- const self = this;
-
const acceptedByUsers = [
{ id: 1, username: "jeanne", avatar_template: "/images/avatar.png" },
];
@@ -163,7 +147,7 @@ module(
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -185,8 +169,6 @@ module(
});
test("accept policy", async function (assert) {
- const self = this;
-
this.set("currentUser", {
id: 1,
username: "bob",
@@ -204,7 +186,7 @@ module(
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
@@ -221,8 +203,6 @@ module(
});
test("revoke policy", async function (assert) {
- const self = this;
-
this.set("currentUser", {
id: 1,
username: "bob",
@@ -240,7 +220,7 @@ module(
await render(
<template>
- <PostPolicy @post={{self.post}} @policy={{self.policy}} />
+ <PostPolicy @post={{this.post}} @policy={{this.policy}} />
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs b/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs
index b40eacd8593..fd8281cfd7a 100644
--- a/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs
@@ -8,8 +8,6 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
setupRenderingTest(hooks);
test("Renders a clickable dropdown menu with a close option", async function (assert) {
- const self = this;
-
this.siteSettings.data_explorer_enabled = true;
this.siteSettings.poll_export_data_explorer_query_id = 18;
this.currentUser.setProperties({ admin: true });
@@ -28,14 +26,14 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
await render(
<template>
<PollButtonsDropdown
- @closed={{self.closed}}
- @voters={{self.voters}}
- @isStaff={{self.isStaff}}
- @isMe={{self.isMe}}
- @topicArchived={{self.topicArchived}}
- @groupableUserFields={{self.groupableUserFields}}
- @isAutomaticallyClosed={{self.isAutomaticallyClosed}}
- @dropDownClick={{self.dropDownClick}}
+ @closed={{this.closed}}
+ @voters={{this.voters}}
+ @isStaff={{this.isStaff}}
+ @isMe={{this.isMe}}
+ @topicArchived={{this.topicArchived}}
+ @groupableUserFields={{this.groupableUserFields}}
+ @isAutomaticallyClosed={{this.isAutomaticallyClosed}}
+ @dropDownClick={{this.dropDownClick}}
/>
</template>
);
@@ -52,8 +50,6 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
});
test("Renders a show-tally button when poll is a bar chart", async function (assert) {
- const self = this;
-
this.setProperties({
closed: false,
voters: 2,
@@ -69,15 +65,15 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
await render(
<template>
<PollButtonsDropdown
- @closed={{self.closed}}
- @voters={{self.voters}}
- @isStaff={{self.isStaff}}
- @isMe={{self.isMe}}
- @topicArchived={{self.topicArchived}}
- @groupableUserFields={{self.groupableUserFields}}
- @isAutomaticallyClosed={{self.isAutomaticallyClosed}}
- @dropDownClick={{self.dropDownClick}}
- @availableDisplayMode={{self.availableDisplayMode}}
+ @closed={{this.closed}}
+ @voters={{this.voters}}
+ @isStaff={{this.isStaff}}
+ @isMe={{this.isMe}}
+ @topicArchived={{this.topicArchived}}
+ @groupableUserFields={{this.groupableUserFields}}
+ @isAutomaticallyClosed={{this.isAutomaticallyClosed}}
+ @dropDownClick={{this.dropDownClick}}
+ @availableDisplayMode={{this.availableDisplayMode}}
/>
</template>
);
@@ -94,8 +90,6 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
});
test("Renders a single button when there is only one authorised action", async function (assert) {
- const self = this;
-
this.setProperties({
closed: false,
voters: 2,
@@ -110,14 +104,14 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
await render(
<template>
<PollButtonsDropdown
- @closed={{self.closed}}
- @voters={{self.voters}}
- @isStaff={{self.isStaff}}
- @isMe={{self.isMe}}
- @topicArchived={{self.topicArchived}}
- @groupableUserFields={{self.groupableUserFields}}
- @isAutomaticallyClosed={{self.isAutomaticallyClosed}}
- @dropDownClick={{self.dropDownClick}}
+ @closed={{this.closed}}
+ @voters={{this.voters}}
+ @isStaff={{this.isStaff}}
+ @isMe={{this.isMe}}
+ @topicArchived={{this.topicArchived}}
+ @groupableUserFields={{this.groupableUserFields}}
+ @isAutomaticallyClosed={{this.isAutomaticallyClosed}}
+ @dropDownClick={{this.dropDownClick}}
/>
</template>
);
@@ -133,8 +127,6 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
});
test("Doesn't render a button when user has no authorised actions", async function (assert) {
- const self = this;
-
this.setProperties({
closed: false,
voters: 0,
@@ -149,14 +141,14 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
await render(
<template>
<PollButtonsDropdown
- @closed={{self.closed}}
- @voters={{self.voters}}
- @isStaff={{self.isStaff}}
- @isMe={{self.isMe}}
- @topicArchived={{self.topicArchived}}
- @groupableUserFields={{self.groupableUserFields}}
- @isAutomaticallyClosed={{self.isAutomaticallyClosed}}
- @dropDownClick={{self.dropDownClick}}
+ @closed={{this.closed}}
+ @voters={{this.voters}}
+ @isStaff={{this.isStaff}}
+ @isMe={{this.isMe}}
+ @topicArchived={{this.topicArchived}}
+ @groupableUserFields={{this.groupableUserFields}}
+ @isAutomaticallyClosed={{this.isAutomaticallyClosed}}
+ @dropDownClick={{this.dropDownClick}}
/>
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-info-test.gjs b/plugins/poll/test/javascripts/component/poll-info-test.gjs
index bd47ac58ac9..3e5d9c36c2c 100644
--- a/plugins/poll/test/javascripts/component/poll-info-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-info-test.gjs
@@ -14,8 +14,6 @@ module("Poll | Component | poll-info", function (hooks) {
setupRenderingTest(hooks);
test("public multiple poll with results anytime", async function (assert) {
- const self = this;
-
this.setProperties({
isMultiple: true,
min: 1,
@@ -34,18 +32,18 @@ module("Poll | Component | poll-info", function (hooks) {
await render(
<template>
<PollInfo
- @options={{self.options}}
- @min={{self.min}}
- @max={{self.max}}
- @isMultiple={{self.isMultiple}}
- @close={{self.close}}
- @closed={{self.closed}}
- @results={{self.results}}
- @showResults={{self.showResults}}
- @postUserId={{self.postUserId}}
- @isPublic={{self.isPublic}}
- @hasVoted={{self.hasVoted}}
- @voters={{self.voters}}
+ @options={{this.options}}
+ @min={{this.min}}
+ @max={{this.max}}
+ @isMultiple={{this.isMultiple}}
+ @close={{this.close}}
+ @closed={{this.closed}}
+ @results={{this.results}}
+ @showResults={{this.showResults}}
+ @postUserId={{this.postUserId}}
+ @isPublic={{this.isPublic}}
+ @hasVoted={{this.hasVoted}}
+ @voters={{this.voters}}
/>
</template>
);
@@ -66,8 +64,6 @@ module("Poll | Component | poll-info", function (hooks) {
});
test("public multiple poll with results only shown on vote", async function (assert) {
- const self = this;
-
this.setProperties({
isMultiple: true,
min: 1,
@@ -86,18 +82,18 @@ module("Poll | Component | poll-info", function (hooks) {
await render(
<template>
<PollInfo
- @options={{self.options}}
- @min={{self.min}}
- @max={{self.max}}
- @isMultiple={{self.isMultiple}}
- @close={{self.close}}
- @closed={{self.closed}}
- @results={{self.results}}
- @showResults={{self.showResults}}
- @postUserId={{self.postUserId}}
- @isPublic={{self.isPublic}}
- @hasVoted={{self.hasVoted}}
- @voters={{self.voters}}
+ @options={{this.options}}
+ @min={{this.min}}
+ @max={{this.max}}
+ @isMultiple={{this.isMultiple}}
+ @close={{this.close}}
+ @closed={{this.closed}}
+ @results={{this.results}}
+ @showResults={{this.showResults}}
+ @postUserId={{this.postUserId}}
+ @isPublic={{this.isPublic}}
+ @hasVoted={{this.hasVoted}}
+ @voters={{this.voters}}
/>
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-options-test.gjs b/plugins/poll/test/javascripts/component/poll-options-test.gjs
index e485d103a53..247a0296785 100644
--- a/plugins/poll/test/javascripts/component/poll-options-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-options-test.gjs
@@ -29,8 +29,6 @@ module("Poll | Component | poll-options", function (hooks) {
setupRenderingTest(hooks);
test("single, not selected", async function (assert) {
- const self = this;
-
this.setProperties({
isCheckbox: false,
isRankedChoice: false,
@@ -42,12 +40,12 @@ module("Poll | Component | poll-options", function (hooks) {
await render(
<template>
<PollOptions
- @isCheckbox={{self.isCheckbox}}
- @isRankedChoice={{self.isRankedChoice}}
- @ranked_choice_dropdown_content={{self.ranked_choice_dropdown_content}}
- @options={{self.options}}
- @votes={{self.votes}}
- @sendRadioClick={{self.toggleOption}}
+ @isCheckbox={{this.isCheckbox}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @ranked_choice_dropdown_content={{this.ranked_choice_dropdown_content}}
+ @options={{this.options}}
+ @votes={{this.votes}}
+ @sendRadioClick={{this.toggleOption}}
/>
</template>
);
@@ -56,8 +54,6 @@ module("Poll | Component | poll-options", function (hooks) {
});
test("single, selected", async function (assert) {
- const self = this;
-
this.setProperties({
isCheckbox: false,
isRankedChoice: false,
@@ -69,12 +65,12 @@ module("Poll | Component | poll-options", function (hooks) {
await render(
<template>
<PollOptions
- @isCheckbox={{self.isCheckbox}}
- @isRankedChoice={{self.isRankedChoice}}
- @ranked_choice_dropdown_content={{self.ranked_choice_dropdown_content}}
- @options={{self.options}}
- @votes={{self.votes}}
- @sendRadioClick={{self.toggleOption}}
+ @isCheckbox={{this.isCheckbox}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @ranked_choice_dropdown_content={{this.ranked_choice_dropdown_content}}
+ @options={{this.options}}
+ @votes={{this.votes}}
+ @sendRadioClick={{this.toggleOption}}
/>
</template>
);
@@ -83,8 +79,6 @@ module("Poll | Component | poll-options", function (hooks) {
});
test("multi, not selected", async function (assert) {
- const self = this;
-
this.setProperties({
isCheckbox: true,
isRankedChoice: false,
@@ -96,12 +90,12 @@ module("Poll | Component | poll-options", function (hooks) {
await render(
<template>
<PollOptions
- @isCheckbox={{self.isCheckbox}}
- @isRankedChoice={{self.isRankedChoice}}
- @ranked_choice_dropdown_content={{self.ranked_choice_dropdown_content}}
- @options={{self.options}}
- @votes={{self.votes}}
- @sendRadioClick={{self.toggleOption}}
+ @isCheckbox={{this.isCheckbox}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @ranked_choice_dropdown_content={{this.ranked_choice_dropdown_content}}
+ @options={{this.options}}
+ @votes={{this.votes}}
+ @sendRadioClick={{this.toggleOption}}
/>
</template>
);
@@ -110,8 +104,6 @@ module("Poll | Component | poll-options", function (hooks) {
});
test("multi, selected", async function (assert) {
- const self = this;
-
this.setProperties({
isCheckbox: true,
isRankedChoice: false,
@@ -123,12 +115,12 @@ module("Poll | Component | poll-options", function (hooks) {
await render(
<template>
<PollOptions
- @isCheckbox={{self.isCheckbox}}
- @isRankedChoice={{self.isRankedChoice}}
- @ranked_choice_dropdown_content={{self.ranked_choice_dropdown_content}}
- @options={{self.options}}
- @votes={{self.votes}}
- @sendRadioClick={{self.toggleOption}}
+ @isCheckbox={{this.isCheckbox}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @ranked_choice_dropdown_content={{this.ranked_choice_dropdown_content}}
+ @options={{this.options}}
+ @votes={{this.votes}}
+ @sendRadioClick={{this.toggleOption}}
/>
</template>
);
@@ -139,8 +131,6 @@ module("Poll | Component | poll-options", function (hooks) {
});
test("single with images", async function (assert) {
- const self = this;
-
this.setProperties({
isCheckbox: false,
options: IMAGE_OPTIONS,
@@ -150,10 +140,10 @@ module("Poll | Component | poll-options", function (hooks) {
await render(
<template>
<PollOptions
- @isCheckbox={{self.isCheckbox}}
- @options={{self.options}}
- @votes={{self.votes}}
- @sendRadioClick={{self.toggleOption}}
+ @isCheckbox={{this.isCheckbox}}
+ @options={{this.options}}
+ @votes={{this.votes}}
+ @sendRadioClick={{this.toggleOption}}
/>
</template>
);
@@ -162,8 +152,6 @@ module("Poll | Component | poll-options", function (hooks) {
});
test("ranked choice - priorities", async function (assert) {
- const self = this;
-
this.setProperties({
isCheckbox: false,
isRankedChoice: true,
@@ -175,12 +163,12 @@ module("Poll | Component | poll-options", function (hooks) {
await render(
<template>
<PollOptions
- @isCheckbox={{self.isCheckbox}}
- @isRankedChoice={{self.isRankedChoice}}
- @ranked_choice_dropdown_content={{self.ranked_choice_dropdown_content}}
- @options={{self.options}}
- @votes={{self.votes}}
- @sendRadioClick={{self.toggleOption}}
+ @isCheckbox={{this.isCheckbox}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @ranked_choice_dropdown_content={{this.ranked_choice_dropdown_content}}
+ @options={{this.options}}
+ @votes={{this.votes}}
+ @sendRadioClick={{this.toggleOption}}
/>
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs b/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs
index 3f80c1ba1c5..ccb27418234 100644
--- a/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs
@@ -15,8 +15,6 @@ module("Poll | Component | poll-results-pie", function (hooks) {
setupRenderingTest(hooks);
test("Renders the pie chart Component correctly", async function (assert) {
- const self = this;
-
this.setProperties({
id: ID,
options: OPTIONS,
@@ -24,7 +22,7 @@ module("Poll | Component | poll-results-pie", function (hooks) {
await render(
<template>
- <PollResultsPie @id={{self.id}} @options={{self.options}} />
+ <PollResultsPie @id={{this.id}} @options={{this.options}} />
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs b/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs
index fcd5048a0cb..33eade92298 100644
--- a/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs
@@ -34,8 +34,6 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {
setupRenderingTest(hooks);
test("Renders the ranked choice results component correctly", async function (assert) {
- const self = this;
-
this.setProperties({
rankedChoiceOutcome: RANKED_CHOICE_OUTCOME,
});
@@ -43,7 +41,7 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {
await render(
<template>
<PollResultsRankedChoice
- @rankedChoiceOutcome={{self.rankedChoiceOutcome}}
+ @rankedChoiceOutcome={{this.rankedChoiceOutcome}}
/>
</template>
);
@@ -62,14 +60,12 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {
});
test("Renders the ranked choice results component without error when outcome data is empty", async function (assert) {
- const self = this;
-
this.rankedChoiceOutcome = null;
await render(
<template>
<PollResultsRankedChoice
- @rankedChoiceOutcome={{self.rankedChoiceOutcome}}
+ @rankedChoiceOutcome={{this.rankedChoiceOutcome}}
/>
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs b/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs
index 7c4fcaf4ae9..2770f94289d 100644
--- a/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs
@@ -38,8 +38,6 @@ module("Poll | Component | poll-results-standard", function (hooks) {
setupRenderingTest(hooks);
test("Renders the standard results Component correctly", async function (assert) {
- const self = this;
-
this.setProperties({
options: TWO_OPTIONS,
pollName: "Two Choice Poll",
@@ -55,15 +53,15 @@ module("Poll | Component | poll-results-standard", function (hooks) {
await render(
<template>
<PollResultsStandard
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @isPublic={{self.isPublic}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @isPublic={{this.isPublic}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
@@ -74,8 +72,6 @@ module("Poll | Component | poll-results-standard", function (hooks) {
});
test("Omits voters for private polls", async function (assert) {
- const self = this;
-
this.setProperties({
options: TWO_OPTIONS,
pollName: "Two Choice Poll",
@@ -91,15 +87,15 @@ module("Poll | Component | poll-results-standard", function (hooks) {
await render(
<template>
<PollResultsStandard
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @isPublic={{self.isPublic}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @isPublic={{this.isPublic}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
@@ -108,8 +104,6 @@ module("Poll | Component | poll-results-standard", function (hooks) {
});
test("options in ascending order", async function (assert) {
- const self = this;
-
this.setProperties({
options: TWO_OPTIONS_REVERSED,
pollName: "Two Choice Poll",
@@ -124,14 +118,14 @@ module("Poll | Component | poll-results-standard", function (hooks) {
await render(
<template>
<PollResultsStandard
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
@@ -141,8 +135,6 @@ module("Poll | Component | poll-results-standard", function (hooks) {
});
test("options in ascending order", async function (assert) {
- const self = this;
-
this.setProperties({
options: FIVE_OPTIONS,
pollName: "Five Multi Option Poll",
@@ -157,14 +149,14 @@ module("Poll | Component | poll-results-standard", function (hooks) {
await render(
<template>
<PollResultsStandard
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
@@ -181,8 +173,6 @@ module("Poll | Component | poll-results-standard", function (hooks) {
});
test("options in ascending order, showing absolute vote number", async function (assert) {
- const self = this;
-
this.setProperties({
options: FIVE_OPTIONS,
pollName: "Five Multi Option Poll",
@@ -198,15 +188,15 @@ module("Poll | Component | poll-results-standard", function (hooks) {
await render(
<template>
<PollResultsStandard
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
- @showTally={{self.showTally}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
+ @showTally={{this.showTally}}
/>
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs b/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs
index 6a6f72936a9..c9b17cefedb 100644
--- a/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs
@@ -59,8 +59,6 @@ module("Poll | Component | poll-results-tabs", function (hooks) {
setupRenderingTest(hooks);
test("Renders one tab for non-ranked-choice poll", async function (assert) {
- const self = this;
-
this.setProperties({
options: TWO_OPTIONS,
pollName: "Two Choice Poll",
@@ -77,16 +75,16 @@ module("Poll | Component | poll-results-tabs", function (hooks) {
await render(
<template>
<PollResultsTabs
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @isPublic={{self.isPublic}}
- @isRankedChoice={{self.isRankedChoice}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @isPublic={{this.isPublic}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
@@ -95,8 +93,6 @@ module("Poll | Component | poll-results-tabs", function (hooks) {
});
test("Renders two tabs for public ranked choice poll", async function (assert) {
- const self = this;
-
this.setProperties({
options: TWO_OPTIONS,
pollName: "Two Choice Poll",
@@ -114,17 +110,17 @@ module("Poll | Component | poll-results-tabs", function (hooks) {
await render(
<template>
<PollResultsTabs
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @isPublic={{self.isPublic}}
- @isRankedChoice={{self.isRankedChoice}}
- @rankedChoiceOutcome={{self.rankedChoiceOutcome}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @isPublic={{this.isPublic}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @rankedChoiceOutcome={{this.rankedChoiceOutcome}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
@@ -133,8 +129,6 @@ module("Poll | Component | poll-results-tabs", function (hooks) {
});
test("Renders one tab for private ranked choice poll", async function (assert) {
- const self = this;
-
this.setProperties({
options: TWO_OPTIONS,
pollName: "Two Choice Poll",
@@ -152,17 +146,17 @@ module("Poll | Component | poll-results-tabs", function (hooks) {
await render(
<template>
<PollResultsTabs
- @options={{self.options}}
- @pollName={{self.pollName}}
- @pollType={{self.pollType}}
- @isPublic={{self.isPublic}}
- @isRankedChoice={{self.isRankedChoice}}
- @rankedChoiceOutcome={{self.rankedChoiceOutcome}}
- @postId={{self.postId}}
- @vote={{self.vote}}
- @voters={{self.voters}}
- @votersCount={{self.votersCount}}
- @fetchVoters={{self.fetchVoters}}
+ @options={{this.options}}
+ @pollName={{this.pollName}}
+ @pollType={{this.pollType}}
+ @isPublic={{this.isPublic}}
+ @isRankedChoice={{this.isRankedChoice}}
+ @rankedChoiceOutcome={{this.rankedChoiceOutcome}}
+ @postId={{this.postId}}
+ @vote={{this.vote}}
+ @voters={{this.voters}}
+ @votersCount={{this.votersCount}}
+ @fetchVoters={{this.fetchVoters}}
/>
</template>
);
diff --git a/plugins/poll/test/javascripts/component/poll-test.gjs b/plugins/poll/test/javascripts/component/poll-test.gjs
index 06d3f38810c..681e994f01d 100644
--- a/plugins/poll/test/javascripts/component/poll-test.gjs
+++ b/plugins/poll/test/javascripts/component/poll-test.gjs
@@ -42,8 +42,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("valid ranks with which you can vote", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -99,7 +97,7 @@ module("Poll | Component | poll", function (hooks) {
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
assert.dom(".poll-buttons .cast-votes:disabled").doesNotExist();
@@ -107,8 +105,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("invalid ranks with which you cannot vote", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -148,7 +144,7 @@ module("Poll | Component | poll", function (hooks) {
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
await click(
@@ -179,8 +175,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("shows vote", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -204,7 +198,7 @@ module("Poll | Component | poll", function (hooks) {
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
assert.dom(".results li:nth-of-type(1) .option p").hasText("100% yes");
@@ -212,8 +206,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("does not show results after voting when results are to be shown only on closed", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -237,7 +229,7 @@ module("Poll | Component | poll", function (hooks) {
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
assert.dom("ul.options").exists("options are shown");
@@ -245,8 +237,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("can vote", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -270,7 +260,7 @@ module("Poll | Component | poll", function (hooks) {
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
requests = 0;
@@ -288,8 +278,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("cannot vote if not member of the right group", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -314,7 +302,7 @@ module("Poll | Component | poll", function (hooks) {
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
requests = 0;
@@ -330,8 +318,6 @@ module("Poll | Component | poll", function (hooks) {
});
test("voting on a multiple poll with no min attribute", async function (assert) {
- const self = this;
-
this.setProperties({
post: EmberObject.create({
id: 42,
@@ -355,7 +341,7 @@ module("Poll | Component | poll", function (hooks) {
}),
});
await render(
- <template><Poll @post={{self.post}} @poll={{self.poll}} /></template>
+ <template><Poll @post={{this.post}} @poll={{this.poll}} /></template>
);
assert.dom(".poll-buttons .cast-votes").isDisabled();
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 84d80a41c97..80b1b1cb28f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -35,8 +35,8 @@ importers:
specifier: ^7.28.0
version: 7.28.0(@babel/[email protected])
'@discourse/lint-configs':
- specifier: ^2.33.0
+ specifier: ^2.34.0
'@discourse/moment-timezone-names-translations':
specifier: ^1.0.0
version: 1.0.0
@@ -1743,8 +1743,8 @@ packages:
'@discourse/[email protected]':
resolution: {integrity: sha512-Jn1gdiyHMGUsmUfLFf4Q7VnTAv0l7NePbegU6pKhKHEmbzV3FosGxq30fTOYgVyTS1bxqGjlA6LvQttJpv3ROw==}
- '@discourse/[email protected]':
- resolution: {integrity: sha512-/YN2jhEHQHsh4Ho6ynsGkiDAJ6qN6ZkzlBpJ80LVAZ7RnhXQJv5K5lJvsk40XTDSrwZ6mCuB1hDu/LBuSz+mUg==}
+ '@discourse/[email protected]':
+ resolution: {integrity: sha512-lOckm6OwPtWl2LuTXl9yBPRiOCXCRxbsHNAhEZm5NMVS0QdUAF5j5j3C4wy1j6pw/s+5hPWTU3O/pwIMHlqbag==}
peerDependencies:
ember-template-lint: 7.9.3
eslint: 9.36.0
@@ -10143,7 +10143,7 @@ snapshots:
'@discourse/[email protected]': {}
dependencies:
'@babel/core': 7.28.5([email protected])
'@babel/eslint-parser': 7.28.4(@babel/[email protected])([email protected])