A platform for community discussion. Free, open, simple.
DEV: Use standalone `tracked()` for test state (#44531)
Jarek Radosz161ec38400c0
diff --git a/.skills/discourse-writing-js-tests/SKILL.md b/.skills/discourse-writing-js-tests/SKILL.mdindex 52220e4b69c..e0463c7f280 100644--- a/.skills/discourse-writing-js-tests/SKILL.md+++ b/.skills/discourse-writing-js-tests/SKILL.md@@ -126,6 +126,11 @@ module("Integration | Component | BookmarkIcon", function (hooks) {`{ stubRouter: true }` to stub `service:router`.- Interact with `@ember/test-helpers`: `click`, `fillIn`, `triggerKeyEvent`, `settled`; querythe rendered DOM with `find` (first match) / `findAll` (all matches).+- To change an argument after render, hold it in a standalone `tracked()` (from+ `@glimmer/tracking`) instead of a test-only class with `@tracked` fields:+ `const title = tracked("a")`, pass `@title={{title.value}}`, then `title.value = "b"` and+ `await settled()`. Start empty values as `tracked(undefined)`, since a bare `tracked()`+ returns a decorator. Writing an equal value (`Object.is`) does not re-render.- For select-kit and FormKit widgets, use `discourse/tests/helpers/select-kit-helper` and`discourse/tests/helpers/form-kit-helper` rather than poking the DOM directly.diff --git a/frontend/discourse/tests/acceptance/modal-service-test.gjs b/frontend/discourse/tests/acceptance/modal-service-test.gjsindex f8b582cbc1f..3a03785fcf3 100644--- a/frontend/discourse/tests/acceptance/modal-service-test.gjs+++ b/frontend/discourse/tests/acceptance/modal-service-test.gjs@@ -154,15 +154,11 @@ acceptance("Modal service: component-based API", function () {});test("alongside declarative modals", async function (assert) {- class State {- @tracked showDeclarativeModal;- }-- const testState = new State();- const closeModal = () => (testState.showDeclarativeModal = false);+ const showDeclarativeModal = tracked(undefined);+ const closeModal = () => (showDeclarativeModal.value = false);const MyConnector = <template>- {{#if testState.showDeclarativeModal}}+ {{#if showDeclarativeModal.value}}<DModalclass="declarative-modal"@closeModal={{closeModal}}@@ -186,7 +182,7 @@ acceptance("Modal service: component-based API", function () {await settled();assert.dom(".d-modal.service-modal").exists("modal should appear");- testState.showDeclarativeModal = true;+ showDeclarativeModal.value = true;await settled();assert.dom(".d-modal.declarative-modal")diff --git a/frontend/discourse/tests/integration/components/advanced-mode-toggle-test.gjs b/frontend/discourse/tests/integration/components/advanced-mode-toggle-test.gjsindex 4da8cdc49dc..904276b3c69 100644--- a/frontend/discourse/tests/integration/components/advanced-mode-toggle-test.gjs+++ b/frontend/discourse/tests/integration/components/advanced-mode-toggle-test.gjs@@ -9,14 +9,12 @@ module("Integration | Component | AdvancedModeToggle", function (hooks) {setupRenderingTest(hooks);test("label reflects @active and flips on toggle", async function (assert) {- const state = new (class {- @tracked active = false;- })();- const onToggle = () => (state.active = !state.active);+ const active = tracked(false);+ const onToggle = () => (active.value = !active.value);await render(<template>- <AdvancedModeToggle @active={{state.active}} @onToggle={{onToggle}} />+ <AdvancedModeToggle @active={{active.value}} @onToggle={{onToggle}} /></template>);diff --git a/frontend/discourse/tests/integration/components/category-title-link-test.gjs b/frontend/discourse/tests/integration/components/category-title-link-test.gjsindex 56408a30816..0752bc16db1 100644--- a/frontend/discourse/tests/integration/components/category-title-link-test.gjs+++ b/frontend/discourse/tests/integration/components/category-title-link-test.gjs@@ -34,22 +34,17 @@ module("Integration | Component | Category Title Link", function (hooks) {];test("Shows title, icon/emoji, and logo when switching categories in styled mode", async function (assert) {- const testState = new (class {- @tracked category = testCategories[0];- })();+ const category = tracked(testCategories[0]);await render(<template>- <CategoryTitleLink- @category={{testState.category}}- @unstyled={{false}}- />+ <CategoryTitleLink @category={{category.value}} @unstyled={{false}} /></template>);assert.dom(".category-title-link").hasText(testCategories[0].name);- testState.category = testCategories[1];+ category.value = testCategories[1];await settled();assert.dom(".category-title-link .badge-category svg")@@ -58,7 +53,7 @@ module("Integration | Component | Category Title Link", function (hooks) {.dom(".category-title-link").hasText(testCategories[1].name, "shows title");- testState.category = testCategories[2];+ category.value = testCategories[2];await settled();assert.dom(".category-title-link .category-logo img")@@ -76,23 +71,18 @@ module("Integration | Component | Category Title Link", function (hooks) {});test("Shows title only when switching categories in unstyled mode", async function (assert) {- const testState = new (class {- @tracked category = testCategories[0];- })();+ const category = tracked(testCategories[0]);await render(<template>- <CategoryTitleLink- @category={{testState.category}}- @unstyled={{true}}- />+ <CategoryTitleLink @category={{category.value}} @unstyled={{true}} /></template>);assert.dom(".category-title-link").hasText(testCategories[0].name, "shows title");- testState.category = testCategories[1];+ category.value = testCategories[1];await settled();assert.dom(".category-title-link .badge-category svg")@@ -101,7 +91,7 @@ module("Integration | Component | Category Title Link", function (hooks) {.dom(".category-title-link").hasText(testCategories[1].name, "shows title");- testState.category = testCategories[2];+ category.value = testCategories[2];await settled();assert.dom(".category-title-link .badge-category img.emoji")@@ -112,21 +102,17 @@ module("Integration | Component | Category Title Link", function (hooks) {});test("Respects the tagName attribute", async function (assert) {- const testState = new (class {- @tracked category = testCategories[0];- })();+ const category = tracked(testCategories[0]);await render(- <template>- <CategoryTitleLink @category={{testState.category}} />- </template>+ <template><CategoryTitleLink @category={{category.value}} /></template>);assert.dom("h3:has(> .category-title-link)").exists(); // defaults to h3await render(<template>- <CategoryTitleLink @category={{testState.category}} @tagName="h1" />+ <CategoryTitleLink @category={{category.value}} @tagName="h1" /></template>);@@ -134,7 +120,7 @@ module("Integration | Component | Category Title Link", function (hooks) {await render(<template>- <CategoryTitleLink @category={{testState.category}} @tagName="span" />+ <CategoryTitleLink @category={{category.value}} @tagName="span" /></template>);diff --git a/frontend/discourse/tests/integration/components/chart-test.gjs b/frontend/discourse/tests/integration/components/chart-test.gjsindex da189fb8ad8..2fc0cf0c0a5 100644--- a/frontend/discourse/tests/integration/components/chart-test.gjs+++ b/frontend/discourse/tests/integration/components/chart-test.gjs@@ -79,20 +79,16 @@ module("Integration | Component | Chart", function (hooks) {data: generateData(),};- const testState = new (class {- @tracked chartConfig;- })();-- testState.chartConfig = generateChartConfig(this.model);+ const chartConfig = tracked(generateChartConfig(this.model));await render(- <template><Chart @chartConfig={{testState.chartConfig}} /></template>+ <template><Chart @chartConfig={{chartConfig.value}} /></template>);const firstCanvasDataURL = await renderAsPNGURL(document.querySelector("canvas.chart-canvas"));- testState.chartConfig = generateChartConfig(this.model, {+ chartConfig.value = generateChartConfig(this.model, {backgroundColor: "red",});diff --git a/frontend/discourse/tests/integration/components/d-copy-button-test.gjs b/frontend/discourse/tests/integration/components/d-copy-button-test.gjsindex b9a48607fca..8d98d72292b 100644--- a/frontend/discourse/tests/integration/components/d-copy-button-test.gjs+++ b/frontend/discourse/tests/integration/components/d-copy-button-test.gjs@@ -51,15 +51,13 @@ module("Integration | Component | DCopyButton", function (hooks) {});test("@isCopied shows the confirmation for a copy made by the caller", async function (assert) {- const state = new (class {- @tracked isCopied = false;- })();+ const isCopied = tracked(false);await render(<template><input class="test-input" readonly value="hello" /><DCopyButton- @isCopied={{state.isCopied}}+ @isCopied={{isCopied.value}}@selector="input.test-input"@translatedLabel="Copy"@translatedLabelAfterCopy="Copied!"@@ -70,7 +68,7 @@ module("Integration | Component | DCopyButton", function (hooks) {assert.dom(".copy-button").hasText("Copy");assert.dom(".copy-button").doesNotHaveClass("ok");- state.isCopied = true;+ isCopied.value = true;await rerender();diff --git a/frontend/discourse/tests/integration/components/dashboard/configure-menu-reorderable-test.gjs b/frontend/discourse/tests/integration/components/dashboard/configure-menu-reorderable-test.gjsindex 2a4308a7d87..8d196a6dacb 100644--- a/frontend/discourse/tests/integration/components/dashboard/configure-menu-reorderable-test.gjs+++ b/frontend/discourse/tests/integration/components/dashboard/configure-menu-reorderable-test.gjs@@ -399,14 +399,12 @@ module(test(`${REORDER_TEST_PREFIX} keeps the moved row's handle focused once it has moved`, async function (assert) {// A live list, unlike the sibling tests: the row has to actually move for// this to say anything about what happens to focus when it does.- const state = new (class {- @tracked sections = [...FOUR_SECTIONS];- })();+ const sections = tracked([...FOUR_SECTIONS]);const onReorder = (from, to) => {- const next = [...state.sections];+ const next = [...sections.value];const [moved] = next.splice(from, 1);next.splice(to, 0, moved);- state.sections = next;+ sections.value = next;};const noop = () => {};@@ -416,7 +414,7 @@ module(<ConfigureMenuReorderable@onReorder={{onReorder}}@onToggleVisibility={{noop}}- @sections={{state.sections}}+ @sections={{sections.value}}/></template>);@@ -424,7 +422,7 @@ module(await moveVia("highlights", "down");assert.deepEqual(- state.sections.map((section) => section.id),+ sections.value.map((section) => section.id),["reports", "highlights", "traffic", "engagement"],"the row moved, so focus has something to survive");diff --git a/frontend/discourse/tests/integration/components/dashboard/date-range-test.gjs b/frontend/discourse/tests/integration/components/dashboard/date-range-test.gjsindex ff9b5532f54..6812c5e8262 100644--- a/frontend/discourse/tests/integration/components/dashboard/date-range-test.gjs+++ b/frontend/discourse/tests/integration/components/dashboard/date-range-test.gjs@@ -69,20 +69,17 @@ module("Integration | Component | Dashboard | DateRange", function (hooks) {});test("trigger label reacts to @period changes", async function (assert) {- class State {- @tracked period = "last_30_days";- }- const state = new State();+ const period = tracked("last_30_days");await render(- <template><DashboardDateRange @period={{state.period}} /></template>+ <template><DashboardDateRange @period={{period.value}} /></template>);assert.dom(".db-date-range__trigger .d-button-label").hasText("Last 30 days");- state.period = "last_7_days";+ period.value = "last_7_days";await settled();assertdiff --git a/frontend/discourse/tests/integration/components/dashboard/reports-test.gjs b/frontend/discourse/tests/integration/components/dashboard/reports-test.gjsindex af3e6d6b62c..3c8ba64870d 100644--- a/frontend/discourse/tests/integration/components/dashboard/reports-test.gjs+++ b/frontend/discourse/tests/integration/components/dashboard/reports-test.gjs@@ -199,17 +199,14 @@ module("Integration | Component | DashboardReports", function (hooks) {return new Promise((resolve) => (resolveSecondFetch = resolve));});- class State {- @tracked startDate = "2026-01-01";- }- const state = new State();+ const startDate = tracked("2026-01-01");const singleItem = [ITEMS[0]];await render(<template><DashboardReports@data={{hash items=singleItem}}- @startDate={{state.startDate}}+ @startDate={{startDate.value}}/></template>);@@ -218,7 +215,7 @@ module("Integration | Component | DashboardReports", function (hooks) {.dom('[data-identifier="test_source:signups"] .fake-report-renderer').exists("the initial load renders real content");- state.startDate = "2026-02-01";+ startDate.value = "2026-02-01";await waitFor('[data-identifier="test_source:signups"] .loading-container.visible');diff --git a/frontend/discourse/tests/integration/components/design-wizard-sections-test.gjs b/frontend/discourse/tests/integration/components/design-wizard-sections-test.gjsindex d17f7eda42b..c6a180850a8 100644--- a/frontend/discourse/tests/integration/components/design-wizard-sections-test.gjs+++ b/frontend/discourse/tests/integration/components/design-wizard-sections-test.gjs@@ -162,10 +162,8 @@ module(});test("the user selectable switch reflects and toggles its state", async function (assert) {- const state = new (class {- @tracked userSelectable = false;- })();- const toggle = () => (state.userSelectable = !state.userSelectable);+ const userSelectable = tracked(false);+ const toggle = () => (userSelectable.value = !userSelectable.value);await render(<template>@@ -178,7 +176,7 @@ module(@pairs={{PAIRS}}@selectedPairKey="default"@selectedPairName="Default"- @userSelectable={{state.userSelectable}}+ @userSelectable={{userSelectable.value}}/></template>);@@ -188,13 +186,13 @@ module(await click(SWITCH);assert.true(- state.userSelectable,+ userSelectable.value,"clicking the switch notifies the caller");assert.dom(SWITCH).hasAria("checked", "true", "renders the new state");await click(SWITCH);- assert.false(state.userSelectable, "clicking again toggles back off");+ assert.false(userSelectable.value, "clicking again toggles back off");assert.dom(SWITCH).hasAria("checked", "false", "renders the reverted state");@@ -208,15 +206,13 @@ module(setupRenderingTest(hooks);test("homepage controls expose their selected state", async function (assert) {- const state = new (class {- @tracked homepage = "latest";- })();+ const homepage = tracked("latest");await render(<template><HomepageSection@categoryPageStyle="categories_boxes"- @homepage={{state.homepage}}+ @homepage={{homepage.value}}@onSelectCategoryPageStyle={{noop}}@onSelectHomepage={{noop}}@themeId={{-1}}@@ -234,7 +230,7 @@ module(.dom(".design-wizard__option-row[data-topic-page='new']").hasAria("pressed", "false", "exposes an unselected topic page");- state.homepage = "categories";+ homepage.value = "categories";await settled();assert@@ -256,15 +252,13 @@ module(setupRenderingTest(hooks);test("the location choices only appear once the banner is enabled", async function (assert) {- const state = new (class {- @tracked enabled = false;- })();- const toggle = () => (state.enabled = !state.enabled);+ const enabled = tracked(false);+ const toggle = () => (enabled.value = !enabled.value);await render(<template><WelcomeBannerSection- @enabled={{state.enabled}}+ @enabled={{enabled.value}}@location="above_topic_content"@onSelectLocation={{noop}}@onToggle={{toggle}}@@ -280,7 +274,7 @@ module(await click(SWITCH);- assert.true(state.enabled, "clicking the switch notifies the caller");+ assert.true(enabled.value, "clicking the switch notifies the caller");assert.dom(".design-wizard__option-row[data-welcome-banner-location='above_topic_content']"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.gjsindex e2aa4fd2b3b..3aa580e160c 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@@ -1429,13 +1429,11 @@ module("Integration | Component | FloatKit | DMenu", function (hooks) {});test("destroys its instance when the menu itself is torn down", async function (assert) {- const state = new (class {- @tracked rendered = true;- })();+ const rendered = tracked(true);await render(<template>- {{#if state.rendered}}+ {{#if rendered.value}}<DMenu @content="content" @inline={{true}} @label="label" />{{/if}}</template>@@ -1447,7 +1445,7 @@ module("Integration | Component | FloatKit | DMenu", function (hooks) {const menuService = getOwner(this).lookup("service:menu");assert.strictEqual(menuService.registeredMenus.size, 1, "menu registered");- state.rendered = false;+ rendered.value = false;await rerender();assert.dom(".fk-d-menu").doesNotExist("the float is gone");@@ -1459,9 +1457,7 @@ module("Integration | Component | FloatKit | DMenu", function (hooks) {});test("a changing triggerComponent does not kill the menu", async function (assert) {- const state = new (class {- @tracked label = "first";- })();+ const label = tracked("first");const trigger = <template><button ...attributes type="button">{{@componentArgs.expanded}}</button>@@ -1475,7 +1471,7 @@ module("Integration | Component | FloatKit | DMenu", function (hooks) {<DMenu@content="content"@inline={{true}}- @triggerComponent={{if (eq state.label "first") trigger otherTrigger}}+ @triggerComponent={{if (eq label.value "first") trigger otherTrigger}}/></template>);@@ -1484,7 +1480,7 @@ module("Integration | Component | FloatKit | DMenu", function (hooks) {assert.dom(".fk-d-menu").exists("opens with the first trigger");await click(".fk-d-menu__trigger");- state.label = "second";+ label.value = "second";await rerender();await click(".fk-d-menu__trigger");diff --git a/frontend/discourse/tests/integration/components/plugin-outlet-test.gjs b/frontend/discourse/tests/integration/components/plugin-outlet-test.gjsindex 99a3cf76b9b..cf4de07dd1e 100644--- a/frontend/discourse/tests/integration/components/plugin-outlet-test.gjs+++ b/frontend/discourse/tests/integration/components/plugin-outlet-test.gjs@@ -1169,22 +1169,20 @@ module(});- const testState = new (class {- @tracked hello = "Hello world";- })();+ const hello = tracked("Hello world");await render(<template><PluginOutlet@name="test-name"- @outletArgs={{lazyHash arg1=testState.hello}}+ @outletArgs={{lazyHash arg1=hello.value}}/></template>);assert.dom(".glimmer-test").hasText("Hello world from glimmer");assert.deepEqual(events, ["constructor"], "constructor called once");- testState.hello = "changed";+ hello.value = "changed";await settled();assert.dom(".glimmer-test").hasText("changed from glimmer");assert.deepEqual(events, ["constructor"], "constructor not called again");diff --git a/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs b/frontend/discourse/tests/integration/components/relative-time-picker-test.gjsindex 5ce2d374dae..41c36ce269b 100644--- a/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs+++ b/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs@@ -77,15 +77,13 @@ module("Integration | Component | RelativeTimePicker", function (hooks) {});test("onChange callback works w/ a start value", async function (assert) {- const testState = new (class {- @tracked minutes = 120;- })();+ const minutes = tracked(120);- const update = (value) => (testState.minutes = value);+ const update = (value) => (minutes.value = value);await render(<template><DRelativeTimePicker- @durationMinutes={{testState.minutes}}+ @durationMinutes={{minutes.value}}@onChange={{update}}/></template>@@ -102,7 +100,7 @@ module("Integration | Component | RelativeTimePicker", function (hooks) {// clear the durationawait fillIn(".relative-time-duration", "");assert.dom(".relative-time-duration").hasValue("");- assert.strictEqual(testState.minutes, null, "onChange called with null");+ assert.strictEqual(minutes.value, null, "onChange called with null");// semi-acceptable behavior: because `initValues()` is called, it changes the interval:assert.strictEqual(selectKit().header().value(),@@ -113,14 +111,14 @@ module("Integration | Component | RelativeTimePicker", function (hooks) {// type <60 minutesawait typeIn(".relative-time-duration", "18");assert.dom(".relative-time-duration").hasValue("18");- assert.strictEqual(testState.minutes, 18, "onChange called with 18");+ assert.strictEqual(minutes.value, 18, "onChange called with 18");// select "days"await selectKit().expand();await selectKit().selectRowByValue("days");assert.dom(".relative-time-duration").hasValue("18");assert.strictEqual(- testState.minutes,+ minutes.value,18 * 60 * 24,"onChange called with 18 * 60 * 24");@@ -134,7 +132,7 @@ module("Integration | Component | RelativeTimePicker", function (hooks) {);assert.dom(".relative-time-duration").hasValue("2");assert.strictEqual(- testState.minutes,+ minutes.value,2 * 60 * 24,"onChange called with 2 * 60 * 24");@@ -143,12 +141,12 @@ module("Integration | Component | RelativeTimePicker", function (hooks) {await selectKit().expand();await selectKit().selectRowByValue("mins");assert.dom(".relative-time-duration").hasValue("2");- assert.strictEqual(testState.minutes, 2, "onChange called with 2");+ assert.strictEqual(minutes.value, 2, "onChange called with 2");// type >60 minutesawait fillIn(".relative-time-duration", "90");assert.dom(".relative-time-duration").hasValue("1.5");- assert.strictEqual(testState.minutes, 90, "onChange called with 90");+ assert.strictEqual(minutes.value, 90, "onChange called with 90");assert.strictEqual(selectKit().header().value(),"hours",@@ -157,21 +155,18 @@ module("Integration | Component | RelativeTimePicker", function (hooks) {});test("updates the input when args change", async function (assert) {- const testState = new (class {- @tracked value;- })();- testState.value = 10;+ const durationMinutes = tracked(10);await render(<template>- <DRelativeTimePicker @durationMinutes={{testState.value}} />+ <DRelativeTimePicker @durationMinutes={{durationMinutes.value}} /></template>);assert.strictEqual(selectKit().header().value(), "mins");assert.dom(".relative-time-duration").hasValue("10");- testState.value = 20;+ durationMinutes.value = 20;await settled();assert.dom(".relative-time-duration").hasValue("20");diff --git a/frontend/discourse/tests/integration/components/reviewable/item-test.gjs b/frontend/discourse/tests/integration/components/reviewable/item-test.gjsindex f2c434a06dc..e0ae7437d1c 100644--- a/frontend/discourse/tests/integration/components/reviewable/item-test.gjs+++ b/frontend/discourse/tests/integration/components/reviewable/item-test.gjs@@ -355,17 +355,17 @@ module("Integration | Component | Reviewable | Item", function (hooks) {});test("leaves edit mode when a different reviewable is passed in", async function (assert) {- const state = new (class {- @tracked reviewable = editableReviewable(1);- })();+ const currentReviewable = tracked(editableReviewable(1));await render(- <template><ReviewableItem @reviewable={{state.reviewable}} /></template>+ <template>+ <ReviewableItem @reviewable={{currentReviewable.value}} />+ </template>);await click(".reviewable-action.edit");- state.reviewable = editableReviewable(2);+ currentReviewable.value = editableReviewable(2);await settled();assert@@ -399,12 +399,14 @@ module("Integration | Component | Reviewable | Item", function (hooks) {});test("goes back to the timeline tab when a different reviewable is passed in", async function (assert) {- const state = new (class {- @tracked reviewable = plainReviewable({ id: 1, type: "ReviewableUser" });- })();+ const currentReviewable = tracked(+ plainReviewable({ id: 1, type: "ReviewableUser" })+ );await render(- <template><ReviewableItem @reviewable={{state.reviewable}} /></template>+ <template>+ <ReviewableItem @reviewable={{currentReviewable.value}} />+ </template>);await click(".d-nav-submenu__tabs .insights a");@@ -414,7 +416,10 @@ module("Integration | Component | Reviewable | Item", function (hooks) {.hasClass("active", "the insights tab is selected");assert.dom(".review-insight").exists("the insights tab is mounted");- state.reviewable = plainReviewable({ id: 2, type: "ReviewableUser" });+ currentReviewable.value = plainReviewable({+ id: 2,+ type: "ReviewableUser",+ });await settled();assertdiff --git a/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjs b/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjsindex 1812bc6c570..c1b4c3d89a5 100644--- a/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjs+++ b/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjs@@ -108,17 +108,14 @@ module("Integration | Component | Reviewable | Timeline", function (hooks) {});test("renders the notes of the reviewable currently passed in", async function (assert) {- const state = new (class {- @tracked- reviewable = {- reviewable_scores: [],- reviewable_notes: [note(10, "Note on the first reviewable")],- };- })();+ const reviewable = tracked({+ reviewable_scores: [],+ reviewable_notes: [note(10, "Note on the first reviewable")],+ });await render(<template>- <ReviewableTimeline @reviewable={{state.reviewable}} />+ <ReviewableTimeline @reviewable={{reviewable.value}} /></template>);@@ -126,7 +123,7 @@ module("Integration | Component | Reviewable | Timeline", function (hooks) {.dom(".timeline-event__description").hasText("Note on the first reviewable", "renders the note it owns");- state.reviewable = { reviewable_scores: [] };+ reviewable.value = { reviewable_scores: [] };await settled();assertdiff --git a/frontend/discourse/tests/integration/components/search-menu-test.gjs b/frontend/discourse/tests/integration/components/search-menu-test.gjsindex 4b3c4dbae71..f967f5ae6ea 100644--- a/frontend/discourse/tests/integration/components/search-menu-test.gjs+++ b/frontend/discourse/tests/integration/components/search-menu-test.gjs@@ -126,14 +126,12 @@ module("Integration | Component | SearchMenu", function (hooks) {});test("@hideResults closes the menu and keeps it closed", async function (assert) {- const state = new (class {- @tracked hidden = false;- })();+ const hidden = tracked(false);await render(<template><SearchMenu- @hideResults={{state.hidden}}+ @hideResults={{hidden.value}}@location="test"@searchInputId="icon-search-input"/>@@ -143,7 +141,7 @@ module("Integration | Component | SearchMenu", function (hooks) {await click("#icon-search-input");assert.dom(".menu-panel").exists("menu opens from the input");- state.hidden = true;+ hidden.value = true;await settled();assert.dom(".menu-panel")@@ -154,7 +152,7 @@ module("Integration | Component | SearchMenu", function (hooks) {.dom(".menu-panel").doesNotExist("menu cannot open while results are hidden");- state.hidden = false;+ hidden.value = false;await settled();assert.dom(".menu-panel")@@ -174,15 +172,13 @@ module("Integration | Component | SearchMenu", function (hooks) {});test("updates when the input placeholder changes", async function (assert) {- const state = new (class {- @tracked placeholder = "search.title";- })();+ const placeholder = tracked("search.title");await render(<template><SearchMenu@location="test"- @searchInputPlaceholder={{state.placeholder}}+ @searchInputPlaceholder={{placeholder.value}}/></template>);@@ -192,7 +188,7 @@ module("Integration | Component | SearchMenu", function (hooks) {.hasAttribute("placeholder", i18n("search.title")).hasAttribute("aria-label", i18n("search.title"));- state.placeholder = "welcome_banner.search_placeholder";+ placeholder.value = "welcome_banner.search_placeholder";await settled();assertdiff --git a/frontend/discourse/tests/integration/components/select-kit/topic-notifications-button-test.gjs b/frontend/discourse/tests/integration/components/select-kit/topic-notifications-button-test.gjsindex bdec5cc1876..31b96ccface 100644--- a/frontend/discourse/tests/integration/components/select-kit/topic-notifications-button-test.gjs+++ b/frontend/discourse/tests/integration/components/select-kit/topic-notifications-button-test.gjs@@ -6,10 +6,6 @@ import TopicNotificationsButton from "discourse/select-kit/components/topic-notiimport { setupRenderingTest } from "discourse/tests/helpers/component-test";import I18n, { i18n } from "discourse-i18n";-class TestClass {- @tracked topic;-}-function buildTopic(opts) {return this.store.createRecord("topic", {id: 4563,@@ -42,12 +38,11 @@ module(});test("the header has correct labels", async function (assert) {- const state = new TestClass();- state.topic = buildTopic.call(this, { level: 1 });+ const topic = tracked(buildTopic.call(this, { level: 1 }));await render(<template>- <TopicNotificationsButton @expanded={{true}} @topic={{state.topic}} />+ <TopicNotificationsButton @expanded={{true}} @topic={{topic.value}} /></template>);@@ -55,7 +50,7 @@ module(.dom(".notifications-tracking-trigger").hasText("Normal", "has the correct label");- state.topic = buildTopic.call(this, { level: 2 });+ topic.value = buildTopic.call(this, { level: 2 });await settled();assert@@ -100,16 +95,15 @@ module(});test("notification reason text - bad notification reason", async function (assert) {- const state = new TestClass();- state.topic = buildTopic.call(this, { level: 2 });+ const topic = tracked(buildTopic.call(this, { level: 2 }));await render(<template>- <TopicNotificationsButton @expanded={{true}} @topic={{state.topic}} />+ <TopicNotificationsButton @expanded={{true}} @topic={{topic.value}} /></template>);- state.topic = buildTopic.call(this, { level: 3, reason: 999 });+ topic.value = buildTopic.call(this, { level: 3, reason: 999 });await settled();assertdiff --git a/frontend/discourse/tests/integration/components/sidebar/section-link-test.gjs b/frontend/discourse/tests/integration/components/sidebar/section-link-test.gjsindex db4696fc2a3..50e0c4f4b43 100644--- a/frontend/discourse/tests/integration/components/sidebar/section-link-test.gjs+++ b/frontend/discourse/tests/integration/components/sidebar/section-link-test.gjs@@ -1,4 +1,4 @@-import { trackedObject } from "@ember/reactive/collections";+import { tracked } from "@glimmer/tracking";import {click,find,@@ -264,7 +264,7 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {);});test("moving an active destination between sections preserves the current scroll position", async function (assert) {- this.state = trackedObject({ moved: false });+ const moved = tracked(false);await render(<template>@@ -273,7 +273,7 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {style="height: 200px; overflow-y: auto; display: block"><ul style="height: 600px; margin: 0">- {{#unless this.state.moved}}+ {{#unless moved.value}}<SectionLink@href="/latest"@linkName="original"@@ -282,7 +282,7 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {{{/unless}}</ul><ul style="height: 600px; margin: 0">- {{#if this.state.moved}}+ {{#if moved.value}}<SectionLink@href="/latest"@linkName="moved"@@ -296,7 +296,7 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {const scroller = find(".sidebar-sections");scroller.scrollTop = 100;- this.state.moved = true;+ moved.value = true;await rerender();assert@@ -309,7 +309,7 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {);scroller.scrollTop = 300;- this.state.moved = false;+ moved.value = false;await rerender();assert.strictEqual(@@ -320,7 +320,8 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {});test("new destinations and reactivated links are still revealed", async function (assert) {- this.state = trackedObject({ destinations: ["/latest"], active: true });+ const destinations = tracked(["/latest"]);+ const active = tracked(true);await render(<template>@@ -330,11 +331,11 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {><div style="height: 600px"></div><ul>- {{#each this.state.destinations as |destination|}}+ {{#each destinations.value as |destination|}}<SectionLink@href={{destination}}@linkName="destination"- @scrollIntoView={{this.state.active}}+ @scrollIntoView={{active.value}}/>{{/each}}</ul>@@ -346,22 +347,22 @@ module("Integration | Component | Sidebar | SectionLink", function (hooks) {assert.true(scroller.scrollTop > 0, "the initial active link is revealed");scroller.scrollTop = 0;- this.state.destinations = ["/top"];+ destinations.value = ["/top"];await rerender();assert.true(scroller.scrollTop > 0, "a different destination is revealed");scroller.scrollTop = 0;- this.state.destinations = ["/latest"];+ destinations.value = ["/latest"];await rerender();assert.true(scroller.scrollTop > 0,"returning to a previous destination reveals it again");- this.state.active = false;+ active.value = false;await rerender();scroller.scrollTop = 0;- this.state.active = true;+ active.value = true;await rerender();assert.true(scroller.scrollTop > 0,diff --git a/frontend/discourse/tests/integration/components/simple-list-reorderable-test.gjs b/frontend/discourse/tests/integration/components/simple-list-reorderable-test.gjsindex 622a65e1016..160b6ffbb2c 100644--- a/frontend/discourse/tests/integration/components/simple-list-reorderable-test.gjs+++ b/frontend/discourse/tests/integration/components/simple-list-reorderable-test.gjs@@ -144,14 +144,12 @@ module("Integration | Component | SimpleList | reorderable", function (hooks) {});test("updates when values change", async function (assert) {- const state = new (class {- @tracked values = "vinkas|osama";- })();+ const values = tracked("vinkas|osama");await render(<template><DMenus />- <SimpleList @inputDelimiter="|" @values={{state.values}} />+ <SimpleList @inputDelimiter="|" @values={{values.value}} /></template>);@@ -159,7 +157,7 @@ module("Integration | Component | SimpleList | reorderable", function (hooks) {.dom(".values .value[data-reorderable-key='0'] .value-input").hasValue("vinkas");- state.values = "kris|jeff";+ values.value = "kris|jeff";await settled();assertdiff --git a/frontend/discourse/tests/integration/components/simple-list-test.gjs b/frontend/discourse/tests/integration/components/simple-list-test.gjsindex f627e2b4a58..305bcefd719 100644--- a/frontend/discourse/tests/integration/components/simple-list-test.gjs+++ b/frontend/discourse/tests/integration/components/simple-list-test.gjs@@ -119,13 +119,11 @@ module("Integration | Component | SimpleList", function (hooks) {});test("updates when values change", async function (assert) {- const state = new (class {- @tracked values = "vinkas|osama";- })();+ const values = tracked("vinkas|osama");await render(<template>- <SimpleList @inputDelimiter="|" @values={{state.values}} />+ <SimpleList @inputDelimiter="|" @values={{values.value}} /></template>);@@ -133,7 +131,7 @@ module("Integration | Component | SimpleList", function (hooks) {.dom(".values .value[data-index='0'] .value-input").hasValue("vinkas");- state.values = "kris|jeff";+ values.value = "kris|jeff";await settled();assert.dom(".values .value[data-index='0'] .value-input").hasValue("kris");diff --git a/frontend/discourse/tests/integration/components/site-settings/enum-test.gjs b/frontend/discourse/tests/integration/components/site-settings/enum-test.gjsindex 43f59da0bc4..feead7c886b 100644--- a/frontend/discourse/tests/integration/components/site-settings/enum-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/enum-test.gjs@@ -6,15 +6,11 @@ import SiteSetting from "discourse/admin/models/site-setting";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "simple";-}-module("Integration | Component | SiteSettings | Enum", function (hooks) {setupRenderingTest(hooks);test("reports the picked value and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("simple");const setting = SiteSetting.create({setting: "tag_style",type: "enum",@@ -26,7 +22,7 @@ module("Integration | Component | SiteSettings | Enum", function (hooks) {const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(@@ -34,7 +30,7 @@ module("Integration | Component | SiteSettings | Enum", function (hooks) {<Enum@changeValueCallback={{changeValue}}@setting={{setting}}- @value={{state.value}}+ @value={{settingValue.value}}/></template>);@@ -44,7 +40,7 @@ module("Integration | Component | SiteSettings | Enum", function (hooks) {assert.deepEqual(changes, ["box"], "reports the picked value");- state.value = "simple";+ settingValue.value = "simple";await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/components/site-settings/host-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/host-list-test.gjsindex fa9fa019824..b6291090a90 100644--- a/frontend/discourse/tests/integration/components/site-settings/host-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/host-list-test.gjs@@ -5,20 +5,16 @@ import HostList from "discourse/admin/components/site-settings/host-list";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "a.com|b.com";-}-module("Integration | Component | SiteSettings | HostList", function (hooks) {setupRenderingTest(hooks);test("reports changes as a pipe-joined string and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("a.com|b.com");const setting = { setting: "blocked_onebox_domains" };const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(@@ -27,7 +23,7 @@ module("Integration | Component | SiteSettings | HostList", function (hooks) {@allowAny={{true}}@changeValueCallback={{changeValue}}@setting={{setting}}- @value={{state.value}}+ @value={{settingValue.value}}/></template>);@@ -44,7 +40,7 @@ module("Integration | Component | SiteSettings | HostList", function (hooks) {assert.deepEqual(changes, ["a.com|b.com|c.com"], "ignores wildcard hosts");- state.value = "z.com";+ settingValue.value = "z.com";await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/components/site-settings/named-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/named-list-test.gjsindex e1a9b32377d..f8be13200b5 100644--- a/frontend/discourse/tests/integration/components/site-settings/named-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/named-list-test.gjs@@ -5,15 +5,11 @@ import NamedList from "discourse/admin/components/site-settings/named-list";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "1";-}-module("Integration | Component | SiteSettings | NamedList", function (hooks) {setupRenderingTest(hooks);test("reports changes as a pipe-joined string and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("1");const setting = {setting: "named_list_setting",choices: [@@ -24,7 +20,7 @@ module("Integration | Component | SiteSettings | NamedList", function (hooks) {const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(@@ -32,7 +28,7 @@ module("Integration | Component | SiteSettings | NamedList", function (hooks) {<NamedList@changeValueCallback={{changeValue}}@setting={{setting}}- @value={{state.value}}+ @value={{settingValue.value}}/></template>);@@ -43,7 +39,7 @@ module("Integration | Component | SiteSettings | NamedList", function (hooks) {assert.deepEqual(changes, ["1|2"], "reports the new list");- state.value = "2";+ settingValue.value = "2";await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/components/site-settings/simple-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/simple-list-test.gjsindex 195fbe74505..89c7ace6bfd 100644--- a/frontend/discourse/tests/integration/components/site-settings/simple-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/simple-list-test.gjs@@ -4,20 +4,16 @@ import { module, test } from "qunit";import SiteSettingSimpleList from "discourse/admin/components/site-settings/simple-list";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-class State {- @tracked value = "a|b";-}-module("Integration | Component | SiteSettings | SimpleList", function (hooks) {setupRenderingTest(hooks);test("reports changes as a pipe-joined string and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("a|b");const setting = {};const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(@@ -25,7 +21,7 @@ module("Integration | Component | SiteSettings | SimpleList", function (hooks) {<SiteSettingSimpleList@changeValueCallback={{changeValue}}@setting={{setting}}- @value={{state.value}}+ @value={{settingValue.value}}/></template>);@@ -35,7 +31,7 @@ module("Integration | Component | SiteSettings | SimpleList", function (hooks) {assert.deepEqual(changes, ["a|b|c"], "reports the new list");- state.value = "z";+ settingValue.value = "z";await settled();assertdiff --git a/frontend/discourse/tests/integration/components/site-settings/tag-group-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/tag-group-list-test.gjsindex 6d6daf7b680..74758e0f14c 100644--- a/frontend/discourse/tests/integration/components/site-settings/tag-group-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/tag-group-list-test.gjs@@ -5,28 +5,24 @@ import TagGroupList from "discourse/admin/components/site-settings/tag-group-lisimport { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "";-}-module("Integration | Component | SiteSettings | TagGroupList",function (hooks) {setupRenderingTest(hooks);test("reports changes as a pipe-joined string and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("");const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(<template><TagGroupList@changeValueCallback={{changeValue}}- @value={{state.value}}+ @value={{settingValue.value}}/></template>);@@ -37,7 +33,7 @@ module(assert.deepEqual(changes, ["TagGroup1"], "reports the picked group");- state.value = "TagGroup2";+ settingValue.value = "TagGroup2";await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/components/site-settings/tag-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/tag-list-test.gjsindex bdd6d16a225..b6ffa3cac8b 100644--- a/frontend/discourse/tests/integration/components/site-settings/tag-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/tag-list-test.gjs@@ -5,10 +5,6 @@ import TagList from "discourse/admin/components/site-settings/tag-list";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "";-}-module("Integration | Component | SiteSettings | TagList", function (hooks) {setupRenderingTest(hooks);@@ -17,16 +13,19 @@ module("Integration | Component | SiteSettings | TagList", function (hooks) {});test("selecting a tag reports the tag name", async function (assert) {- const state = new State();+ const settingValue = tracked("");const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(<template>- <TagList @changeValueCallback={{changeValue}} @value={{state.value}} />+ <TagList+ @changeValueCallback={{changeValue}}+ @value={{settingValue.value}}+ /></template>);@@ -45,12 +44,13 @@ module("Integration | Component | SiteSettings | TagList", function (hooks) {});test("follows a value set by the caller", async function (assert) {- const state = new State();- state.value = "foo";+ const settingValue = tracked("foo");- await render(<template><TagList @value={{state.value}} /></template>);+ await render(+ <template><TagList @value={{settingValue.value}} /></template>+ );- state.value = "foo|bar";+ settingValue.value = "foo|bar";await settled();assert.strictEqual(this.subject.header().value(), "foo,bar");diff --git a/frontend/discourse/tests/integration/components/site-settings/url-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/url-list-test.gjsindex 4cf92ab826c..0e8d738ad63 100644--- a/frontend/discourse/tests/integration/components/site-settings/url-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/url-list-test.gjs@@ -5,24 +5,23 @@ import UrlList from "discourse/admin/components/site-settings/url-list";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "https://a.com\nhttps://b.com";-}-module("Integration | Component | SiteSettings | UrlList", function (hooks) {setupRenderingTest(hooks);test("reports changes as a newline-joined string and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("https://a.com\nhttps://b.com");const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(<template>- <UrlList @changeValueCallback={{changeValue}} @value={{state.value}} />+ <UrlList+ @changeValueCallback={{changeValue}}+ @value={{settingValue.value}}+ /></template>);@@ -37,7 +36,7 @@ module("Integration | Component | SiteSettings | UrlList", function (hooks) {);assert.dom(".values .value").exists({ count: 3 }, "shows the added url");- state.value = "https://z.com";+ settingValue.value = "https://z.com";await settled();assertdiff --git a/frontend/discourse/tests/integration/components/site-settings/value-list-test.gjs b/frontend/discourse/tests/integration/components/site-settings/value-list-test.gjsindex a724e57a4b8..c5da4b4147c 100644--- a/frontend/discourse/tests/integration/components/site-settings/value-list-test.gjs+++ b/frontend/discourse/tests/integration/components/site-settings/value-list-test.gjs@@ -5,26 +5,22 @@ import SiteSettingValueList from "discourse/admin/components/site-settings/valueimport { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";-class State {- @tracked value = "a\nb";-}-module("Integration | Component | SiteSettings | ValueList", function (hooks) {setupRenderingTest(hooks);test("reports changes as a newline-joined string and follows @value", async function (assert) {- const state = new State();+ const settingValue = tracked("a\nb");const changes = [];const changeValue = (value) => {changes.push(value);- state.value = value;+ settingValue.value = value;};await render(<template><SiteSettingValueList@changeValueCallback={{changeValue}}- @value={{state.value}}+ @value={{settingValue.value}}/></template>);@@ -40,7 +36,7 @@ module("Integration | Component | SiteSettings | ValueList", function (hooks) {);assert.dom(".values .value").exists({ count: 3 }, "shows the added value");- state.value = "z";+ settingValue.value = "z";await settled();assertdiff --git a/frontend/discourse/tests/integration/helpers/element-class-test.gjs b/frontend/discourse/tests/integration/helpers/element-class-test.gjsindex 76cfb4064b4..fcad1d53efa 100644--- a/frontend/discourse/tests/integration/helpers/element-class-test.gjs+++ b/frontend/discourse/tests/integration/helpers/element-class-test.gjs@@ -42,13 +42,11 @@ module("Integration | Helper | body-class and html-class", function (hooks) {});test("HTML and body classes", async function (assert) {- const state = new (class {- @tracked condition = false;- })();+ const condition = tracked(false);await render(<template>- {{#if state.condition}}+ {{#if condition.value}}{{bodyClass "my-class" "persistent-class"}}{{htmlClass "my-class"}}{{else}}@@ -60,14 +58,14 @@ module("Integration | Helper | body-class and html-class", function (hooks) {assert.dom(document.documentElement).doesNotHaveClass("my-class");assert.dom(document.body).hasClass("persistent-class");- state.condition = true;+ condition.value = true;await settled();assert.dom(document.body).hasClass("my-class");assert.dom(document.documentElement).hasClass("my-class");assert.dom(document.body).hasClass("persistent-class");- state.condition = false;+ condition.value = false;await settled();assert.dom(document.body).doesNotHaveClass("my-class");diff --git a/frontend/discourse/tests/integration/modifiers/d-resize-edge-test.gjs b/frontend/discourse/tests/integration/modifiers/d-resize-edge-test.gjsindex 2f69340c178..171efabd3b1 100644--- a/frontend/discourse/tests/integration/modifiers/d-resize-edge-test.gjs+++ b/frontend/discourse/tests/integration/modifiers/d-resize-edge-test.gjs@@ -837,13 +837,11 @@ module("Integration | Modifier | d-resize-edge", function (hooks) {test("a writing direction change between gestures is picked up", async function (assert) {const state = new Harness();- const container = new (class {- @tracked dir = "ltr";- })();+ const dir = tracked("ltr");await render(<template>- <div dir={{container.dir}}>+ <div dir={{dir.value}}><divclass="resize-edge"{{dResizeEdge@@ -877,7 +875,7 @@ module("Integration | Modifier | d-resize-edge", function (hooks) {"moving right grows a start-docked element under LTR");- container.dir = "rtl";+ dir.value = "rtl";await settled();// The direction is held for the length of a gesture, not for the length ofdiff --git a/frontend/discourse/tests/integration/ui-kit/d-async-content-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-async-content-test.gjsindex ab29d4843ab..4c3ea7a54b2 100644--- a/frontend/discourse/tests/integration/ui-kit/d-async-content-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-async-content-test.gjs@@ -199,15 +199,8 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {});});- // Drives the debounced tests from outside a component, so state can be changed- // without `click` awaiting the debounce timer in between.- class DebounceState {- @tracked context = "first";- @tracked rendered = true;- @tracked debounce = true;- @tracked source = null;- }-+ // Debounced tests change tracked state directly instead of through `click`, which would+ // await the debounce timer in between.module("@debounce", function () {// The debounced path only engages from the second evaluation onward, so this asserts// after a context change rather than on first render.@@ -592,7 +585,7 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {// promise: an abandoned one would keep an async waiter pending and hang the test.test("it coalesces evaluations inside one window into a single call", async function (assert) {const seen = [];- const state = new DebounceState();+ const currentContext = tracked("first");const load = (context) => {seen.push(context);@@ -603,7 +596,7 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {<template><DAsyncContent@asyncData={{load}}- @context={{state.context}}+ @context={{currentContext.value}}@debounce={{true}}><:content as |data|>@@ -620,7 +613,7 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {);for (const next of ["a", "b", "c"]) {- state.context = next;+ currentContext.value = next;await rerender();}@@ -638,7 +631,8 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {// still drop the call the previous evaluation left waiting on its timer.test("it drops a scheduled call when the next evaluation is not debounced", async function (assert) {const seen = [];- const state = new DebounceState();+ const currentContext = tracked("first");+ const debounce = tracked(true);const load = (context) => {seen.push(context);@@ -649,8 +643,8 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {<template><DAsyncContent@asyncData={{load}}- @context={{state.context}}- @debounce={{state.debounce}}+ @context={{currentContext.value}}+ @debounce={{debounce.value}}><:content as |data|><div class="content">{{data}}</div>@@ -662,12 +656,12 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {assert.deepEqual(seen, ["first"]);// Schedules a debounced call for "second"...- state.context = "second";+ currentContext.value = "second";await rerender();// ...which this evaluation supersedes before the timer fires.- state.debounce = false;- state.context = "third";+ debounce.value = false;+ currentContext.value = "third";await rerender();await settled();@@ -684,17 +678,17 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {// does, for every shape the argument accepts.test("it drops a scheduled call when @asyncData is replaced by a promise", async function (assert) {const seen = [];- const state = new DebounceState();- state.source = (context) => {+ const currentContext = tracked("first");+ const source = tracked((context) => {seen.push(context);return context;- };+ });await render(<template><DAsyncContent- @asyncData={{state.source}}- @context={{state.context}}+ @asyncData={{source.value}}+ @context={{currentContext.value}}@debounce={{true}}><:content as |data|>@@ -706,10 +700,10 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {assert.deepEqual(seen, ["first"]);- state.context = "second";+ currentContext.value = "second";await rerender();- state.source = Promise.resolve("replacement");+ source.value = Promise.resolve("replacement");await rerender();await settled();@@ -724,17 +718,17 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {test("it drops a scheduled call when @asyncData is replaced by a TrackedAsyncData", async function (assert) {const seen = [];- const state = new DebounceState();- state.source = (context) => {+ const currentContext = tracked("first");+ const source = tracked((context) => {seen.push(context);return context;- };+ });await render(<template><DAsyncContent- @asyncData={{state.source}}- @context={{state.context}}+ @asyncData={{source.value}}+ @context={{currentContext.value}}@debounce={{true}}><:content as |data|>@@ -746,10 +740,10 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {assert.deepEqual(seen, ["first"]);- state.context = "second";+ currentContext.value = "second";await rerender();- state.source = new TrackedAsyncData(Promise.resolve("replacement"));+ source.value = new TrackedAsyncData(Promise.resolve("replacement"));await rerender();await settled();@@ -764,7 +758,8 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {test("it does not invoke a debounced source after the component is destroyed", async function (assert) {const seen = [];- const state = new DebounceState();+ const currentContext = tracked("first");+ const rendered = tracked(true);const load = (context) => {seen.push(context);@@ -773,10 +768,10 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {await render(<template>- {{#if state.rendered}}+ {{#if rendered.value}}<DAsyncContent@asyncData={{load}}- @context={{state.context}}+ @context={{currentContext.value}}@debounce={{true}}><:content as |data|>@@ -790,9 +785,9 @@ module("Integration | ui-kit | DAsyncContent", function (hooks) {assert.deepEqual(seen, ["first"]);// Schedule a debounced load, then tear the component down before its timer fires.- state.context = "second";+ currentContext.value = "second";await rerender();- state.rendered = false;+ rendered.value = false;await settled();diff --git a/frontend/discourse/tests/integration/ui-kit/d-combo-button-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-combo-button-test.gjsindex 42311b2b6f6..756ed3cb396 100644--- a/frontend/discourse/tests/integration/ui-kit/d-combo-button-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-combo-button-test.gjs@@ -106,13 +106,11 @@ module("Integration | ui-kit | DComboButton", function (hooks) {});test("toggling @hasMenu moves the class and the menu together", async function (assert) {- const state = new (class {- @tracked hasMenu = false;- })();+ const hasMenu = tracked(false);await render(<template>- <DComboButton @hasMenu={{state.hasMenu}} as |combo|>+ <DComboButton @hasMenu={{hasMenu.value}} as |combo|><combo.Button @translatedLabel="Action" /><combo.Menu @inline={{true}}>content</combo.Menu></DComboButton>@@ -122,13 +120,13 @@ module("Integration | ui-kit | DComboButton", function (hooks) {assert.dom(".d-combo-button").doesNotHaveClass("--has-menu");assert.dom(".d-combo-button-menu").doesNotExist();- state.hasMenu = true;+ hasMenu.value = true;await rerender();assert.dom(".d-combo-button").hasClass("--has-menu");assert.dom(".d-combo-button-menu").exists();- state.hasMenu = false;+ hasMenu.value = false;await rerender();assert.dom(".d-combo-button").doesNotHaveClass("--has-menu");@@ -166,13 +164,11 @@ module("Integration | ui-kit | DComboButton", function (hooks) {});test("--has-menu survives a consumer's dynamic class changing", async function (assert) {- const state = new (class {- @tracked extra = "first";- })();+ const extra = tracked("first");await render(<template>- <DComboButton class={{state.extra}} @hasMenu={{true}} as |combo|>+ <DComboButton class={{extra.value}} @hasMenu={{true}} as |combo|><combo.Button @translatedLabel="Action" /><combo.Menu @inline={{true}}>content</combo.Menu></DComboButton>@@ -182,7 +178,7 @@ module("Integration | ui-kit | DComboButton", function (hooks) {assert.dom(".d-combo-button").hasClass("--has-menu");assert.dom(".d-combo-button").hasClass("first");- state.extra = "second";+ extra.value = "second";await rerender();assertdiff --git a/frontend/discourse/tests/integration/ui-kit/d-decorated-html-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-decorated-html-test.gjsindex 4cc0db3f800..af330af18c9 100644--- a/frontend/discourse/tests/integration/ui-kit/d-decorated-html-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-decorated-html-test.gjs@@ -19,24 +19,20 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {setupRenderingTest(hooks);test("renders and re-renders content", async function (assert) {- const state = new (class {- @tracked html = trustHTML("<h1>Initial</h1>");- })();+ const html = tracked(trustHTML("<h1>Initial</h1>"));- await render(<template><DDecoratedHtml @html={{state.html}} /></template>);+ await render(<template><DDecoratedHtml @html={{html.value}} /></template>);assert.dom("h1").hasText("Initial");- state.html = trustHTML("<h1>Updated</h1>");+ html.value = trustHTML("<h1>Updated</h1>");await settled();assert.dom("h1").hasText("Updated");});test("defers replacement until the pressed control receives its click", async function (assert) {- const state = new (class {- @tracked html = trustHTML('<button id="target">Initial</button>');- })();+ const html = tracked(trustHTML('<button id="target">Initial</button>'));let clicks = 0;const decorate = (element, helper) => {element.querySelector("button").addEventListener("click", () => clicks++);@@ -51,7 +47,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {<template><DDecoratedHtml@decorate={{decorate}}- @html={{state.html}}+ @html={{html.value}}@preservePointerTarget={{true}}/></template>@@ -62,7 +58,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {isPrimary: true,pointerId: 1,});- state.html = trustHTML('<button id="target">Updated</button>');+ html.value = trustHTML('<button id="target">Updated</button>');await settled();assert.strictEqual(find("#target"),@@ -75,7 +71,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {"Nested content","nested components survive deferred rendering");- state.html = trustHTML('<button id="target">Updated again</button>');+ html.value = trustHTML('<button id="target">Updated again</button>');await settled();target.addEventListener("pointerup", (event) => event.stopPropagation());target.dispatchEvent(@@ -95,7 +91,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {.dom("#nested").hasText("Nested content", "nested components render in the replacement");for (let i = 0; i < 3; i++) {- state.html = trustHTML(`<button id="target">Update ${i}</button>`);+ html.value = trustHTML(`<button id="target">Update ${i}</button>`);await settled();assert.dom("#nested")@@ -107,12 +103,10 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {});test("ignores descendant blur but releases on window blur", async function (assert) {- const state = new (class {- @tracked html = trustHTML('<button id="target">Initial</button>');- })();+ const html = tracked(trustHTML('<button id="target">Initial</button>'));await render(<template>- <DDecoratedHtml @html={{state.html}} @preservePointerTarget={{true}} />+ <DDecoratedHtml @html={{html.value}} @preservePointerTarget={{true}} /></template>);const target = find("#target");@@ -122,7 +116,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {pointerId: 1,});target.dispatchEvent(new FocusEvent("blur"));- state.html = trustHTML('<button id="target">Updated</button>');+ html.value = trustHTML('<button id="target">Updated</button>');await settled();assert.strictEqual(find("#target"),@@ -139,12 +133,10 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {});test("releases deferred HTML on pointer cancellation", async function (assert) {- const state = new (class {- @tracked html = trustHTML('<button id="target">Initial</button>');- })();+ const html = tracked(trustHTML('<button id="target">Initial</button>'));await render(<template>- <DDecoratedHtml @html={{state.html}} @preservePointerTarget={{true}} />+ <DDecoratedHtml @html={{html.value}} @preservePointerTarget={{true}} /></template>);const target = find("#target");@@ -153,7 +145,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {isPrimary: true,pointerId: 1,});- state.html = trustHTML('<button id="target">Updated</button>');+ html.value = trustHTML('<button id="target">Updated</button>');await settled();await triggerEvent(target, "pointercancel", { pointerId: 1 });@@ -175,9 +167,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {});test("can decorate content, including renderGlimmer", async function (assert) {- const state = new (class {- @tracked html = trustHTML("<h1>Initial</h1>");- })();+ const html = tracked(trustHTML("<h1>Initial</h1>"));const decorate = (element, helper) => {element.innerHTML += "<div id='appended'>Appended</div>";@@ -191,7 +181,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {await render(<template>- <DDecoratedHtml @decorate={{decorate}} @html={{state.html}} />+ <DDecoratedHtml @decorate={{decorate}} @html={{html.value}} /></template>);@@ -201,9 +191,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {});test("can decorate content with renderGlimmer using a curried component", async function (assert) {- const state = new (class {- @tracked html = trustHTML("<h1>Initial</h1>");- })();+ const html = tracked(trustHTML("<h1>Initial</h1>"));const decorate = (element, helper) => {element.innerHTML += "<div id='appended'>Appended</div>";@@ -221,7 +209,7 @@ module("Integration | ui-kit | DDecoratedHtml", function (hooks) {await render(<template>- <DDecoratedHtml @decorate={{decorate}} @html={{state.html}} />+ <DDecoratedHtml @decorate={{decorate}} @html={{html.value}} /></template>);diff --git a/frontend/discourse/tests/integration/ui-kit/d-highlighted-code-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-highlighted-code-test.gjsindex 97b79bf9e77..660d5a9ab99 100644--- a/frontend/discourse/tests/integration/ui-kit/d-highlighted-code-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-highlighted-code-test.gjs@@ -48,22 +48,18 @@ module("Integration | ui-kit | DHighlightedCode", function (hooks) {});test("re-highlights the code when it changes", async function (assert) {- class State {- @tracked code = "def foo; end";- }-- const testState = new State();+ const code = tracked("def foo; end");await render(<template>- <DHighlightedCode @code={{testState.code}} @lang="ruby" />- {{testState.code}}+ <DHighlightedCode @code={{code.value}} @lang="ruby" />+ {{code.value}}</template>);assert.dom("code.lang-ruby.hljs .hljs-title").hasText("foo");- testState.code = "def bar; end";+ code.value = "def bar; end";await settled();assert.dom("code.lang-ruby.hljs .hljs-title").hasText("bar");diff --git a/frontend/discourse/tests/integration/ui-kit/d-native-select-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-native-select-test.gjsindex 115f78aa078..7ebdc6bb5a9 100644--- a/frontend/discourse/tests/integration/ui-kit/d-native-select-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-native-select-test.gjs@@ -100,20 +100,15 @@ module("Integration | ui-kit | DNativeSelect", function (hooks) {});test("keeps the selection when options are rebuilt", async function (assert) {- class State {- @tracked- options = [- { value: "foo", label: "The real foo" },- { value: "bar", label: "The real bar" },- ];- }-- const state = new State();+ const options = tracked([+ { value: "foo", label: "The real foo" },+ { value: "bar", label: "The real bar" },+ ]);await render(<template><DNativeSelect @value="bar" as |s|>- {{#each state.options as |option|}}+ {{#each options.value as |option|}}<s.Option @value={{option.value}}>{{option.label}}</s.Option>{{/each}}</DNativeSelect>@@ -125,7 +120,7 @@ module("Integration | ui-kit | DNativeSelect", function (hooks) {label: "The real bar",});- state.options = [+ options.value = [{ value: "baz", label: "The real baz" },{ value: "foo", label: "The real foo" },{ value: "bar", label: "The real bar" },@@ -139,19 +134,15 @@ module("Integration | ui-kit | DNativeSelect", function (hooks) {});test("keeps the selection when the value is not a string", async function (assert) {- class State {- @tracked value = 30;- }-- const state = new State();- const handleChange = (value) => (state.value = value);+ const selectedValue = tracked(30);+ const handleChange = (value) => (selectedValue.value = value);await render(<template><DNativeSelect@includeNone={{false}}@onChange={{handleChange}}- @value={{state.value}}+ @value={{selectedValue.value}}as |s|><s.Option @value={{1}}>One</s.Option>diff --git a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-group-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-group-test.gjsindex 63d53fdb683..9fe6abd81ae 100644--- a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-group-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-group-test.gjs@@ -150,9 +150,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {test("a member re-registering during a re-render keeps its place in the group", async function (assert) {const outer = objectItems().slice(0, 1);const inner = objectItems().slice(0, 2);- const state = new (class {- @tracked frozen = false;- })();+ const frozen = tracked(false);let raised;setupOnerror((error) => {@@ -169,7 +167,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {the replacement member is constructed before the old one is torndown and both briefly claim the same listId. }}<DReorderableList- @disabled={{state.frozen}}+ @disabled={{frozen.value}}@items={{outer}}@key="id"@label={{label}}@@ -193,9 +191,9 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {</template>);- state.frozen = true;+ frozen.value = true;await settled();- state.frozen = false;+ frozen.value = false;await settled();} finally {resetOnerror();@@ -919,15 +917,13 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {// service's registry for the life of the app, holding the trigger element// and, through the menu data, the list itself.const items = objectItems();- const state = new (class {- @tracked showList = true;- })();+ const showList = tracked(true);const menu = this.owner.lookup("service:menu");await render(<template><DMenus />- {{#if state.showList}}+ {{#if showList.value}}<DReorderableListid="teardown-menu-list"@items={{items}}@@ -951,7 +947,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {"and the service is holding it");- state.showList = false;+ showList.value = false;await settled();assert@@ -970,9 +966,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {test("DReorderableList refuses a drop after the source member is torn down", async function (assert) {const primaryItems = [{ id: "primary-alpha", name: "Primary Alpha" }];const secondaryItems = [{ id: "secondary-alpha", name: "Secondary Alpha" }];- const state = new (class {- @tracked showPrimary = true;- })();+ const showPrimary = tracked(true);const onMove = sinon.spy();const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");@@ -980,7 +974,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {<template><DMenus /><DReorderableListGroup @onMove={{onMove}} as |group|>- {{#if state.showPrimary}}+ {{#if showPrimary.value}}<DReorderableListid="teardown-primary-list"@group={{group}}@@ -1024,7 +1018,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {...centerOf(sourceHandle),});- state.showPrimary = false;+ showPrimary.value = false;await settled();assert@@ -1112,9 +1106,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {const secondary = trackedArray([{ id: "secondary-alpha", name: "Secondary Alpha" },]);- const state = new (class {- @tracked secondaryLabel = "Secondary";- })();+ const secondaryLabel = tracked("Secondary");await render(<template>@@ -1138,7 +1130,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {@key="id"@label={{label}}@listId="secondary"- @listLabel={{state.secondaryLabel}}+ @listLabel={{secondaryLabel.value}}><:row as |item|><span data-test-item={{item.id}}>{{item.name}}</span>@@ -1148,7 +1140,7 @@ module("Integration | ui-kit | DReorderableList | group", function (hooks) {</template>);- state.secondaryLabel = "Renamed";+ secondaryLabel.value = "Renamed";await settled();await openMoveMenu("alpha");@@ -2187,9 +2179,7 @@ module(const secondaryItems = [{ id: "stale-secondary-alpha", name: "Stale Secondary Alpha" },];- const state = new (class {- @tracked showSecondary = true;- })();+ const showSecondary = tracked(true);const onMove = sinon.spy();const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");@@ -2209,7 +2199,7 @@ module(<span data-test-item={{item.id}}>{{item.name}}</span></:row></DReorderableList>- {{#if state.showSecondary}}+ {{#if showSecondary.value}}<DReorderableListid="rev-stale-target"@group={{group}}@@ -2235,7 +2225,7 @@ module("the destination stands in the menu while its member is mounted");- state.showSecondary = false;+ showSecondary.value = false;await settled();await click(moveItemSelector("list"));diff --git a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-keyboard-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-keyboard-test.gjsindex b2630b5b759..2800c5c1d21 100644--- a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-keyboard-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-keyboard-test.gjs@@ -193,11 +193,9 @@ module(});test("removal is announced and leaves focus on the row that took its place", async function (assert) {- const state = new (class {- @tracked items = objectItems();- })();+ const items = tracked(objectItems());const onRemove = (item) => {- state.items = state.items.filter((candidate) => candidate !== item);+ items.value = items.value.filter((candidate) => candidate !== item);};// Spied rather than read back off the service: an announcement schedules// its own clear, and `settled()` waits that timer out.@@ -207,7 +205,7 @@ module(<template><DMenus /><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@onMove={{noop}}@@ -1243,9 +1241,7 @@ module(test("a run cut short by teardown does not speak for a list that is gone", async function (assert) {const items = trackedArray(objectItems());const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");- const state = new (class {- @tracked show = true;- })();+ const show = tracked(true);const handleMove = (move) => {items.splice(0, items.length, ...move.proposedToItems);};@@ -1253,7 +1249,7 @@ module(await render(<template><DMenus />- {{#if state.show}}+ {{#if show.value}}<DReorderableList@items={{items}}@key="id"@@ -1279,7 +1275,7 @@ module(}));- state.show = false;+ show.value = false;await settled();assert.deepEqual(@@ -1407,16 +1403,14 @@ module(});test("a removal that defers is not spoken for until it completes", async function (assert) {- const state = new (class {- @tracked items = objectItems();- })();+ const items = tracked(objectItems());let release;const confirmed = new Promise((resolve) => (release = resolve));// What a consumer putting a confirmation in front of the removal returns:// the handler is back long before the reader has answered.const onRemove = (item) =>confirmed.then(() => {- state.items = state.items.filter((candidate) => candidate !== item);+ items.value = items.value.filter((candidate) => candidate !== item);});const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");@@ -1424,7 +1418,7 @@ module(<template><DMenus /><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@onMove={{noop}}@@ -1458,9 +1452,7 @@ module(});test("a removal behind a confirmation lands focus once the dialog has gone", async function (assert) {- const state = new (class {- @tracked items = objectItems();- })();+ const items = tracked(objectItems());const dialog = this.owner.lookup("service:dialog");// Exactly the shape a consumer with a confirmation writes: the promise is// returned so the list waits, and the store is only touched on confirm.@@ -1468,7 +1460,7 @@ module(dialog.yesNoConfirm({message: "Remove it?",didConfirm: () => {- state.items = state.items.filter((candidate) => candidate !== item);+ items.value = items.value.filter((candidate) => candidate !== item);},});const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");@@ -1478,7 +1470,7 @@ module(<DMenus /><DialogHolder /><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@onMove={{noop}}diff --git a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-repairs-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-repairs-test.gjsindex b330cecf09a..47e4a57ac55 100644--- a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-repairs-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-repairs-test.gjs@@ -211,9 +211,7 @@ module("Integration | ui-kit | DReorderableList | repairs", function (hooks) {test("fix42618 a handle whose destinations vanished still closes its own menu", async function (assert) {const soloItems = [{ id: "solo", name: "Solo" }];const partnerItems = [{ id: "partner-alpha", name: "Partner Alpha" }];- const state = new (class {- @tracked showPartner = true;- })();+ const showPartner = tracked(true);await render(<template>@@ -232,7 +230,7 @@ module("Integration | ui-kit | DReorderableList | repairs", function (hooks) {<span data-test-item={{item.id}}>{{item.name}}</span></:row></DReorderableList>- {{#if state.showPartner}}+ {{#if showPartner.value}}<DReorderableListid="repair-vanish-partner"@group={{group}}@@ -259,7 +257,7 @@ module("Integration | ui-kit | DReorderableList | repairs", function (hooks) {"the sibling is a destination while it is mounted, so the menu opens holding it");- state.showPartner = false;+ showPartner.value = false;await settled();assertdiff --git a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-supplemental-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-supplemental-test.gjsindex f1e41a4fe88..e1eda61b71a 100644--- a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-supplemental-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-supplemental-test.gjs@@ -881,9 +881,7 @@ module({ id: "st-b", name: "St B" },];const secondItems = [{ id: "st-c", name: "St C" }];- const state = new (class {- @tracked showSecond = true;- })();+ const showSecond = tracked(true);const onMove = sinon.spy();const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");let raised;@@ -910,7 +908,7 @@ module(<span data-test-item={{item.id}}>{{item.name}}</span></:row></DReorderableList>- {{#if state.showSecond}}+ {{#if showSecond.value}}<DReorderableListclass="stale-second"@group={{group}}@@ -934,7 +932,7 @@ module(.dom(moveItemSelector("list")).exists("the destination is offered while its list is mounted");- state.showSecond = false;+ showSecond.value = false;await settled();assert@@ -1070,18 +1068,15 @@ module(});test("supp42618 focus stays inside the list as removals empty it", async function (assert) {- const state = new (class {- @tracked- items = [- { id: "rm-pin", name: "Rm Pin" },- { id: "rm-a", name: "Rm A" },- { id: "rm-b", name: "Rm B" },- ];- })();+ const items = tracked([+ { id: "rm-pin", name: "Rm Pin" },+ { id: "rm-a", name: "Rm A" },+ { id: "rm-b", name: "Rm B" },+ ]);const movable = (item) => item.id !== "rm-pin";const removable = (item) => item.id !== "rm-pin";const onRemove = (item) => {- state.items = state.items.filter((candidate) => candidate !== item);+ items.value = items.value.filter((candidate) => candidate !== item);};await render(@@ -1089,7 +1084,7 @@ module(<DMenus /><div id="remove-focus-arena"><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@movable={{movable}}@@ -1236,9 +1231,7 @@ module(});test("supp42618 replacing the items under an open menu neither throws nor commits", async function (assert) {- const state = new (class {- @tracked items = objectItems();- })();+ const items = tracked(objectItems());const replacement = [{ id: "rep-a", name: "Rep A" },{ id: "rep-b", name: "Rep B" },@@ -1255,7 +1248,7 @@ module(<template><DMenus /><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@onMove={{onMove}}@@ -1272,7 +1265,7 @@ module(.dom(moveItemSelector("up")).exists("the menu opened over the row before the swap");- state.items = replacement;+ items.value = replacement;await settled();// The component may close the stale menu itself or leave it to bediff --git a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-test.gjsindex b1351411b3b..684320acf45 100644--- a/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-reorderable-list-test.gjs@@ -573,11 +573,9 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {// because nothing else swaps an argument after the first render.const items = trackedArray(objectItems());const announce = sinon.spy(this.owner.lookup("service:a11y"), "announce");- const state = new (class {- @tracked movable = () => true;- @tracked removable = () => true;- @tracked itemLabel = label;- })();+ const movable = tracked(() => true);+ const removable = tracked(() => true);+ const itemLabel = tracked(label);await render(<template>@@ -585,11 +583,11 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {<DReorderableList@items={{items}}@key="id"- @label={{state.itemLabel}}- @movable={{state.movable}}+ @label={{itemLabel.value}}+ @movable={{movable.value}}@onMove={{noop}}@onRemove={{noop}}- @removable={{state.removable}}+ @removable={{removable.value}}><:row as |item|><span data-test-item={{item.id}}>{{item.name}}</span>@@ -601,20 +599,20 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {assert.dom(".d-reorderable-list__handle").exists({ count: 3 });assert.dom(".d-reorderable-list__remove").exists({ count: 3 });- state.movable = (item) => item.id !== "bravo";+ movable.value = (item) => item.id !== "bravo";await settled();assert.dom(handleSelector("bravo")).doesNotExist("a swapped @movable re-freezes the row");assert.dom(".d-reorderable-list__handle").exists({ count: 2 });- state.removable = (item) => item.id !== "charlie";+ removable.value = (item) => item.id !== "charlie";await settled();assert.dom(`${rowSelector("charlie")} .d-reorderable-list__remove`).doesNotExist("a swapped @removable withdraws the control");- state.itemLabel = (item) => `Renamed ${item.name}`;+ itemLabel.value = (item) => `Renamed ${item.name}`;await settled();await moveVia("alpha", "down");assert.true(@@ -625,9 +623,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {test("lets a consumer choose the remove control's button weight", async function (assert) {const items = objectItems();- const state = new (class {- @tracked buttonClass;- })();+ const buttonClass = tracked(undefined);await render(<template>@@ -638,7 +634,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {@label={{label}}@onMove={{noop}}@onRemove={{noop}}- @removeButtonClass={{state.buttonClass}}+ @removeButtonClass={{buttonClass.value}}><:row as |item|><span data-test-item={{item.id}}>{{item.name}}</span>@@ -651,7 +647,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {.dom(".d-reorderable-list__remove").hasClass("btn-flat", "falls back to a flat control");- state.buttonClass = "btn-default";+ buttonClass.value = "btn-default";await settled();assert@@ -1038,9 +1034,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {{ ...initialItems[0], name: `${initialItems[0].name} current` },{ ...initialItems[1], name: `${initialItems[1].name} current` },];- const state = new (class {- @tracked items = initialItems;- })();+ const items = tracked(initialItems);const moves = [];const onMove = (move) => moves.push(move);@@ -1048,7 +1042,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {<template><DMenus /><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@onMove={{onMove}}@@ -1081,7 +1075,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {"the primitive marks the dragged row, so no state is mirrored by hand");- state.items = currentItems;+ items.value = currentItems;await settled();const target = rowSelector(initialItems[0].id);@@ -1273,15 +1267,13 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {test("uses object identity for keyed rerendering when key is omitted", async function (assert) {const items = objectItems();- const state = new (class {- @tracked items = items;- })();+ const listItems = tracked(items);await render(<template><DMenus /><DReorderableList- @items={{state.items}}+ @items={{listItems.value}}@label={{label}}@onMove={{noop}}>@@ -1315,7 +1307,7 @@ module("Integration | ui-kit | DReorderableList", function (hooks) {"distinct objects resolve distinct DOM keys");- state.items = [...items].reverse();+ listItems.value = [...items].reverse();await settled();assert.deepEqual(@@ -2055,15 +2047,13 @@ module(test("removing a dragged item clears its state before reinsertion", async function (assert) {const initialItems = objectItems();const draggedItem = initialItems[1];- const state = new (class {- @tracked items = initialItems;- })();+ const items = tracked(initialItems);await render(<template><DMenus /><DReorderableList- @items={{state.items}}+ @items={{items.value}}@key="id"@label={{label}}@onMove={{noop}}@@ -2090,7 +2080,7 @@ module("the primitive marks the dragged row, so no state is mirrored by hand");- state.items = initialItems.filter((item) => item !== draggedItem);+ items.value = initialItems.filter((item) => item !== draggedItem);await settled();assert.dom(rowSelector(draggedItem.id))@@ -2100,7 +2090,7 @@ module(dataTransfer,...sourceCoordinates,});- state.items = initialItems;+ items.value = initialItems;await settled();assert@@ -2502,15 +2492,13 @@ module(const items = objectItems();const firstOnMove = sinon.spy();const secondOnMove = sinon.spy();- const state = new (class {- @tracked onMove = firstOnMove;- })();+ const onMove = tracked(firstOnMove);await render(- <template><List @items={{items}} @onMove={{state.onMove}} /></template>+ <template><List @items={{items}} @onMove={{onMove.value}} /></template>);- state.onMove = secondOnMove;+ onMove.value = secondOnMove;await settled();await moveVia(items[1].id, "up");diff --git a/frontend/discourse/tests/integration/ui-kit/d-resize-handles-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-resize-handles-test.gjsindex 17e42b84736..03712b41c27 100644--- a/frontend/discourse/tests/integration/ui-kit/d-resize-handles-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-resize-handles-test.gjs@@ -777,10 +777,9 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("replacing a held descriptor ends its gesture rather than rebinding it", async function (assert) {- const state = new (class {- @tracked- handles = [{ payload: "first", key: "first", class: "handle-x" }];- })();+ const handles = tracked([+ { payload: "first", key: "first", class: "handle-x" },+ ]);const events = [];const onResize = (payload) => events.push(`resize:${payload}`);const onResizeCancel = (payload) => events.push(`cancel:${payload}`);@@ -788,7 +787,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {await render(<template><DResizeHandles- @handles={{state.handles}}+ @handles={{handles.value}}@onResize={{onResize}}@onResizeCancel={{onResizeCancel}}/>@@ -808,7 +807,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {clientY: 50,});- state.handles = [{ payload: "second", key: "second", class: "handle-x" }];+ handles.value = [{ payload: "second", key: "second", class: "handle-x" }];await settled();await triggerEvent(".handle-x", "pointermove", {@@ -840,14 +839,11 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("removing the held handle ends its gesture and leaves its neighbours in place", async function (assert) {- const state = new (class {- @tracked- handles = [- { payload: "a", key: "a", class: "handle-a" },- { payload: "b", key: "b", class: "handle-b" },- { payload: "c", key: "c", class: "handle-c" },- ];- })();+ const handles = tracked([+ { payload: "a", key: "a", class: "handle-a" },+ { payload: "b", key: "b", class: "handle-b" },+ { payload: "c", key: "c", class: "handle-c" },+ ]);const events = [];const onResize = (payload) => events.push(`resize:${payload}`);const onResizeCancel = (payload) => events.push(`cancel:${payload}`);@@ -855,7 +851,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {await render(<template><DResizeHandles- @handles={{state.handles}}+ @handles={{handles.value}}@onResize={{onResize}}@onResizeCancel={{onResizeCancel}}/>@@ -876,7 +872,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {clientY: 50,});- state.handles = [+ handles.value = [{ payload: "a", key: "a", class: "handle-a" },{ payload: "c", key: "c", class: "handle-c" },];@@ -900,9 +896,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("@directions shrinking mid-gesture ends the gesture on the handle it removed", async function (assert) {- const state = new (class {- @tracked directions = ["n", "e", "s"];- })();+ const directions = tracked(["n", "e", "s"]);const events = [];const onResize = (payload) => events.push(`resize:${payload}`);const onResizeCancel = (payload) => events.push(`cancel:${payload}`);@@ -910,7 +904,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {await render(<template><DResizeHandles- @directions={{state.directions}}+ @directions={{directions.value}}@handleClass="my-block__handle"@onResize={{onResize}}@onResizeCancel={{onResizeCancel}}@@ -931,7 +925,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {clientY: 50,});- state.directions = ["n", "s"];+ directions.value = ["n", "s"];await settled();assert.deepEqual(@@ -942,13 +936,10 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("@cancelCommits routes a removed handle's gesture to the commit callback", async function (assert) {- const state = new (class {- @tracked- handles = [- { payload: "a", key: "a", class: "handle-a" },- { payload: "b", key: "b", class: "handle-b" },- ];- })();+ const handles = tracked([+ { payload: "a", key: "a", class: "handle-a" },+ { payload: "b", key: "b", class: "handle-b" },+ ]);const ends = [];const cancels = [];const onResizeEnd = (payload, info) =>@@ -959,7 +950,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {<template><DResizeHandles@cancelCommits={{true}}- @handles={{state.handles}}+ @handles={{handles.value}}@onResizeCancel={{onResizeCancel}}@onResizeEnd={{onResizeEnd}}/>@@ -979,7 +970,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {clientY: 50,});- state.handles = [{ payload: "a", key: "a", class: "handle-a" }];+ handles.value = [{ payload: "a", key: "a", class: "handle-a" }];await settled();// `moved` has to survive. A handle destroyed before the first move must not@@ -1060,21 +1051,18 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("handles sharing a payload are told apart", async function (assert) {- const state = new (class {- @tracked- handles = [- { payload: 0, key: "run-a", class: "handle-run-a" },- { payload: 0, key: "run-b", class: "handle-run-b" },- { payload: 1, key: "other", class: "handle-other" },- ];- })();+ const handles = tracked([+ { payload: 0, key: "run-a", class: "handle-run-a" },+ { payload: 0, key: "run-b", class: "handle-run-b" },+ { payload: 1, key: "other", class: "handle-other" },+ ]);const events = [];const onResizeCancel = (payload) => events.push(`cancel:${payload}`);await render(<template><DResizeHandles- @handles={{state.handles}}+ @handles={{handles.value}}@onResizeCancel={{onResizeCancel}}/></template>@@ -1096,7 +1084,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {// One run of a gridline disappears while another run of the same line is// being dragged. Both carry the same payload, so the key has to tell them// apart.- state.handles = [+ handles.value = [{ payload: 0, key: "run-a", class: "handle-run-a" },{ payload: 1, key: "other", class: "handle-other" },];@@ -1115,20 +1103,17 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("removing an earlier twin leaves a gesture on the later one alone", async function (assert) {- const state = new (class {- @tracked- handles = [- { payload: 0, key: "run-a", class: "handle-run-a" },- { payload: 0, key: "run-b", class: "handle-run-b" },- ];- })();+ const handles = tracked([+ { payload: 0, key: "run-a", class: "handle-run-a" },+ { payload: 0, key: "run-b", class: "handle-run-b" },+ ]);const events = [];const onResizeCancel = (payload) => events.push(`cancel:${payload}`);await render(<template><DResizeHandles- @handles={{state.handles}}+ @handles={{handles.value}}@onResizeCancel={{onResizeCancel}}/></template>@@ -1145,7 +1130,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {// The dragged run survives and the one before it goes. Anything positional// would shift here and cancel a live gesture; the key does not move.- state.handles = [{ payload: 0, key: "run-b", class: "handle-run-b" }];+ handles.value = [{ payload: 0, key: "run-b", class: "handle-run-b" }];await settled();assert.deepEqual(events, [], "the surviving run keeps its gesture");@@ -1157,13 +1142,10 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});test("removing a measured handle mid-gesture releases the reflow listeners", async function (assert) {- const state = new (class {- @tracked- handles = [- { payload: "a", key: "a", class: "handle-a" },- { payload: "b", key: "b", class: "handle-b" },- ];- })();+ const handles = tracked([+ { payload: "a", key: "a", class: "handle-a" },+ { payload: "b", key: "b", class: "handle-b" },+ ]);const findBox = (handle) =>handle.closest(".fixture")?.querySelector(".box");@@ -1171,7 +1153,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {<template><div class="fixture"><div class="box" style="width: 220px; height: 90px"></div>- <DResizeHandles @handles={{state.handles}} @measure={{findBox}} />+ <DResizeHandles @handles={{handles.value}} @measure={{findBox}} /></div></template>);@@ -1185,7 +1167,7 @@ module("Integration | ui-kit | DResizeHandles", function (hooks) {});const removeSpy = sinon.spy(window, "removeEventListener");- state.handles = [{ payload: "a", key: "a", class: "handle-a" }];+ handles.value = [{ payload: "a", key: "a", class: "handle-a" }];await settled();// A stranded gesture used to leave this document-wide scroll listenerdiff --git a/frontend/discourse/tests/integration/ui-kit/d-resize-separator-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-resize-separator-test.gjsindex c8792b8a55a..dbf6af12291 100644--- a/frontend/discourse/tests/integration/ui-kit/d-resize-separator-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-resize-separator-test.gjs@@ -481,9 +481,7 @@ module("Integration | ui-kit | DResizeSeparator", function (hooks) {});test("a plain value is announced as it changes, without waiting for a gesture", async function (assert) {- const state = new (class {- @tracked ceiling = 400;- })();+ const ceiling = tracked(400);await render(<template>@@ -491,7 +489,7 @@ module("Integration | ui-kit | DResizeSeparator", function (hooks) {class="my-handle"@axis="vertical"@label="Resize the thing"- @max={{state.ceiling}}+ @max={{ceiling.value}}@min={{0}}@value={{120}}/>@@ -503,7 +501,7 @@ module("Integration | ui-kit | DResizeSeparator", function (hooks) {// A number given directly is already reactive, so it is read straight through// rather than mirrored: snapshotting it would freeze it until something else// happened to trigger a re-read.- state.ceiling = 900;+ ceiling.value = 900;await settled();assert.dom(".my-handle").hasAttribute("aria-valuemax", "900");@@ -539,9 +537,7 @@ module("Integration | ui-kit | DResizeSeparator", function (hooks) {});test("starts observing a box that only exists after the first render", async function (assert) {- const state = new (class {- @tracked target = null;- })();+ const target = tracked(null);const size = () => find(".late-box")?.clientHeight ?? null;await render(@@ -552,7 +548,7 @@ module("Integration | ui-kit | DResizeSeparator", function (hooks) {@axis="vertical"@label="Resize the thing"@max={{500}}- @measure={{state.target}}+ @measure={{target.value}}@min={{100}}@value={{size}}/>@@ -565,7 +561,7 @@ module("Integration | ui-kit | DResizeSeparator", function (hooks) {assert.dom(".my-handle").hasAttribute("aria-valuenow", "200");// A consumer that builds its own box after render hands it over once it exists.- state.target = find(".late-box");+ target.value = find(".late-box");await settled();find(".late-box").style.height = "340px";diff --git a/frontend/discourse/tests/integration/ui-kit/d-tabs-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-tabs-test.gjsindex f70a08e5911..05f215af33f 100644--- a/frontend/discourse/tests/integration/ui-kit/d-tabs-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-tabs-test.gjs@@ -548,22 +548,18 @@ module("Integration | ui-kit | DTabs", function (hooks) {});test("re-keys a live tab when its id changes", async function (assert) {- class IdState {- @tracked id = "original";- }-- const state = new IdState();+ const id = tracked("original");const onActivate = sinon.spy();await render(<template><DTabs- @active={{state.id}}+ @active={{id.value}}@label="Mutable tab id"@onActivate={{onActivate}}as |tabs|>- <tabs.Tab @key={{state.id}} @label="Mutable">Panel</tabs.Tab>+ <tabs.Tab @key={{id.value}} @label="Mutable">Panel</tabs.Tab></DTabs></template>);@@ -571,7 +567,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {const originalTab = find('[role="tab"]');const originalDomId = originalTab.id;- state.id = "replacement";+ id.value = "replacement";await settled();const tab = find('[role="tab"]');@@ -579,7 +575,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {assert.dom('[role="tablist"]').exists("the tablist remains exposed");assert.dom(tab)- .hasAttribute("data-d-tab", state.id, "the registry uses the new id");+ .hasAttribute("data-d-tab", id.value, "the registry uses the new id");assert.notStrictEqual(tab.id,originalDomId,@@ -1794,13 +1790,9 @@ module("Integration | ui-kit | DTabs", function (hooks) {});test("rejects a role tab impostor inserted after mount", async function (assert) {- class ImpostorState {- @tracked show = false;- }-const expectedMessage ="the declaration block may contain only tab declarations — found unexpected content in the tablist";- const state = new ImpostorState();+ const show = tracked(false);const onActivate = sinon.spy();let errors = 0;setupOnerror((error) => {@@ -1821,7 +1813,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {><tabs.Tab @key="valid" @label="Valid">Panel</tabs.Tab>{{! eslint-disable ember/template-require-context-role }}- {{#if state.show}}<button+ {{#if show.value}}<buttonrole="tab"type="button">Impostor</button>{{/if}}@@ -1830,7 +1822,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {</template>);- state.show = true;+ show.value = true;await settled();assert.strictEqual(errors, 1, "a late tab impostor raises one assertion");@@ -1936,11 +1928,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {});test("alternating declaration branches reusing a tab id do not false-positive the duplicate guard", async function (assert) {- class BranchState {- @tracked flip = false;- }-- const state = new BranchState();+ const flip = tracked(false);const onActivate = sinon.spy();let errors = 0;setupOnerror(() => errors++);@@ -1953,7 +1941,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {@onActivate={{onActivate}}as |tabs|>- {{#if state.flip}}+ {{#if flip.value}}<tabs.Tab @key="same" @label="One">1</tabs.Tab>{{else}}<tabs.Tab @key="same" @label="Two">2</tabs.Tab>@@ -1962,7 +1950,7 @@ module("Integration | ui-kit | DTabs", function (hooks) {</template>);- state.flip = true;+ flip.value = true;await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/anchoring-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/anchoring-test.gjsindex 53e27aae620..85557c2ee62 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/anchoring-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/anchoring-test.gjs@@ -17,14 +17,6 @@ import DVirtualList from "discourse/ui-kit/d-virtual-list";const ROW_PX = 40;const estimate = () => ROW_PX;-class State {- @tracked items;-- constructor(items) {- this.items = items;- }-}-function buildRows(count) {return Array.from({ length: count }, (_, index) => ({id: index,@@ -138,7 +130,7 @@ module("Integration | ui-kit | DVirtualList | anchoring", function (hooks) {}test("initial positioning runs only once", async function (assert) {- const state = new State(buildRows(1000));+ const items = tracked(buildRows(1000));await render(<template>@@ -152,7 +144,7 @@ module("Integration | ui-kit | DVirtualList | anchoring", function (hooks) {<DVirtualList@estimateSize={{estimate}}@initialIndex={{500}}- @items={{state.items}}+ @items={{items.value}}@key="id"@overscan={{0}}as |item|@@ -169,7 +161,7 @@ module("Integration | ui-kit | DVirtualList | anchoring", function (hooks) {);await scrollTo(0);- state.items = buildRows(1000);+ items.value = buildRows(1000);await settled();assertdiff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/container-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/container-test.gjsindex 21de25d9a9d..f60ecb4b72a 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/container-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/container-test.gjs@@ -22,10 +22,6 @@ function buildRows(count) {}));}-class State {- @tracked as = "div";-}-function sizerHeight() {const sizer = find(".d-virtual-list__sizer");return sizer ? parseFloat(sizer.style.height) : null;@@ -85,7 +81,7 @@ module("Integration | ui-kit | DVirtualList | container", function (hooks) {// keeps the engine's geometry on an element that cannot be swapped underneath it.test("container fallback: changing @as after mount keeps the sized container", async function (assert) {const items = buildRows(COUNT);- const state = new State();+ const tagName = tracked("div");await render(<template>@@ -97,7 +93,7 @@ module("Integration | ui-kit | DVirtualList | container", function (hooks) {}</style><DVirtualList- @as={{state.as}}+ @as={{tagName.value}}@estimateSize={{estimate}}@items={{items}}@key="id"@@ -111,7 +107,7 @@ module("Integration | ui-kit | DVirtualList | container", function (hooks) {const heightBefore = sizerHeight();assert.true(heightBefore > 0, "precondition: the sizer starts sized");- state.as = "ul";+ tagName.value = "ul";await settled();assert.true(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/deep-scroll-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/deep-scroll-test.gjsindex be30d1b4d32..abfe1be040d 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/deep-scroll-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/deep-scroll-test.gjs@@ -11,14 +11,6 @@ import DVirtualList from "discourse/ui-kit/d-virtual-list";const ROW_PX = 44;const estimate = () => ROW_PX;-class State {- @tracked items;-- constructor(items) {- this.items = items;- }-}-function buildRows(count) {return Array.from({ length: count }, (_, index) => ({id: index,@@ -56,7 +48,7 @@ module("Integration | ui-kit | DVirtualList | deep scroll", function (hooks) {});test("rows keep their absolute positioning across a keyed re-render", async function (assert) {- const state = new State(buildRows(10000));+ const items = tracked(buildRows(10000));await render(<template>@@ -70,7 +62,7 @@ module("Integration | ui-kit | DVirtualList | deep scroll", function (hooks) {<DVirtualList@estimateSize={{estimate}}@itemRole="listitem"- @items={{state.items}}+ @items={{items.value}}@key="id"@role="list"as |row|@@ -88,7 +80,7 @@ module("Integration | ui-kit | DVirtualList | deep scroll", function (hooks) {// SAME element. If the destroy runs last, its cleanup strips the styles the// new modifier just wrote.for (let i = 0; i < 5; i++) {- state.items = state.items.map((row) => ({ ...row }));+ items.value = items.value.map((row) => ({ ...row }));await settled();}diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/edge-threshold-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/edge-threshold-test.gjsindex 1dd24fdb0c6..089ad96739f 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/edge-threshold-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/edge-threshold-test.gjs@@ -24,14 +24,6 @@ async function scrollTo(top) {await triggerEvent(element, "scroll");}-class Config {- @tracked threshold;-- constructor(threshold) {- this.threshold = threshold;- }-}-// Supplemental regression coverage for a review finding NOT pinned by the// decorrelated oracle (edges-test.gjs): a runtime change to// @edgeThreshold must re-arm the edge latches. Kept in a separate file so the@@ -55,7 +47,7 @@ module(const onReachEnd = (range) => calls.push(range);// A wide threshold makes the top of the list already sit in the end band// (endBand = 99 - 90 = 9), so mount fires once and latches the end edge.- const config = new Config(90);+ const threshold = tracked(90);await render(<template>@@ -67,7 +59,7 @@ module(}</style><DVirtualList- @edgeThreshold={{config.threshold}}+ @edgeThreshold={{threshold.value}}@estimateSize={{estimate}}@items={{items}}@onReachEnd={{onReachEnd}}@@ -87,7 +79,7 @@ module(// The visible range does not move, but the end band narrows to the last// eight rows. The narrowed threshold must re-arm the latch even though no// scroll (and so no rendering-signature change) accompanies it.- config.threshold = 8;+ threshold.value = 8;await settled();// Jump straight to the true end, past any range that would have re-armed@@ -109,7 +101,7 @@ module(const items = buildRows(100);const calls = [];const onReachEnd = (range) => calls.push(range);- const config = new Config(NaN);+ const threshold = tracked(NaN);await render(<template>@@ -121,7 +113,7 @@ module(}</style><DVirtualList- @edgeThreshold={{config.threshold}}+ @edgeThreshold={{threshold.value}}@estimateSize={{estimate}}@items={{items}}@onReachEnd={{onReachEnd}}@@ -151,7 +143,7 @@ module(const items = buildRows(100);const calls = [];const onReachEnd = (range) => calls.push(range);- const config = new Config(-5);+ const threshold = tracked(-5);await render(<template>@@ -163,7 +155,7 @@ module(}</style><DVirtualList- @edgeThreshold={{config.threshold}}+ @edgeThreshold={{threshold.value}}@estimateSize={{estimate}}@items={{items}}@onReachEnd={{onReachEnd}}diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/estimate-reactivity-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/estimate-reactivity-test.gjsindex c05f97a3d82..db1744a596e 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/estimate-reactivity-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/estimate-reactivity-test.gjs@@ -26,10 +26,6 @@ function buildRows(count) {}));}-class State {- @tracked estimate = estimateSmall;-}-function sizerHeight() {const sizer = find(".d-virtual-list__sizer");return sizer ? parseFloat(sizer.style.height) : null;@@ -58,7 +54,7 @@ module(// A fresh array would rebuild that function and invalidate the memo for a// reason other than the estimate, so the defect would not surface.const items = buildRows(COUNT);- const state = new State();+ const estimate = tracked(estimateSmall);await render(<template>@@ -73,7 +69,7 @@ module(}</style><DVirtualList- @estimateSize={{state.estimate}}+ @estimateSize={{estimate.value}}@items={{items}}@key="id"as |item|@@ -96,7 +92,7 @@ module(const measured = mountedRows().length;const expected = measured * ROW_PX + (COUNT - measured) * SECOND_ESTIMATE;- state.estimate = estimateLarge;+ estimate.value = estimateLarge;await settled();const after = sizerHeight();diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/index-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/index-test.gjsindex b36f4149e33..e6b157cd4d3 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/index-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/index-test.gjs@@ -149,16 +149,6 @@ module("Integration | ui-kit | DVirtualList", function (hooks) {const ROW_PX = 40;-// Consumers hand DVirtualList a new array reference on change; this is the-// smallest tracked holder that lets a test do the same.-class State {- @tracked value;-- constructor(value) {- this.value = value;- }-}-function buildRows(count) {return Array.from({ length: count }, (_, i) => ({ id: i, text: `row ${i}` }));}@@ -328,7 +318,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {// awaiting settled() after render proves nothing: render has already settled,// so no engine callback fires and the assertion holds even with the gate removed.const items = buildRows(200);- const state = new State(() => 40);+ const estimateSize = tracked(() => 40);let ranges = 0;const onVisibleRangeChange = () => ranges++;@@ -342,7 +332,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {}</style><DVirtualList- @estimateSize={{state.value}}+ @estimateSize={{estimateSize.value}}@items={{items}}@onVisibleRangeChange={{onVisibleRangeChange}}as |item|@@ -357,7 +347,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {// A fresh function identity re-runs modify() and busts the engine's// measurement memo, but every size is identical, so the published window is// byte-for-byte the same and the gate must swallow it.- state.value = () => 40;+ estimateSize.value = () => 40;await settled();assert.strictEqual(@@ -376,7 +366,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {// anchorTo:"end" — which does NOT control resting position (it is consulted// only at the prepend-anchor gate and the wasAtEnd resize branch), so a// top-resting list can opt in without becoming bottom-anchored.- const state = new State(buildRows(200));+ const items = tracked(buildRows(200));await render(<template>@@ -389,7 +379,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {</style><DVirtualList@estimateSize={{estimate}}- @items={{state.value}}+ @items={{items.value}}as |item|><div class="row" style="height: 40px">{{item.text}}</div>@@ -411,7 +401,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {id: -100 + i,text: `older ${i}`,}));- state.value = [...older, ...state.value];+ items.value = [...older, ...items.value];await settled();const movedRow = findAll(".d-virtual-list__item").find(@@ -434,7 +424,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {// The published window pairs each virtual key with items[index]. Replacing an// object strictly inside the window must change that row's key, or keyed row// state stays attached to the previous object.- const state = new State(buildRows(1000));+ const items = tracked(buildRows(1000));await render(<template>@@ -447,7 +437,7 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {</style><DVirtualList@estimateSize={{estimate}}- @items={{state.value}}+ @items={{items.value}}as |item row|><div class="row" data-key={{row.key}} style="height: 40px">@@ -461,9 +451,9 @@ module("Integration | ui-kit | DVirtualList | windowing", function (hooks) {".d-virtual-list__item[data-index='5'] .row").getAttribute("data-key");- const next = state.value.slice();+ const next = items.value.slice();next[5] = { id: 5, text: "replaced" };- state.value = next;+ items.value = next;await settled();const keyAfter = find(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/inert-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/inert-test.gjsindex 01cfb5b3291..5955c48546a 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/inert-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/inert-test.gjs@@ -9,14 +9,6 @@ import DVirtualList from "discourse/ui-kit/d-virtual-list";const estimateSize = () => 40;-class State {- @tracked items;-- constructor(items) {- this.items = items;- }-}-function buildRows(count) {return Array.from({ length: count }, (_, id) => ({id,@@ -34,7 +26,7 @@ module("Integration | ui-kit | DVirtualList | inert", function (hooks) {test("disabled virtualization renders all rows without invoking callbacks", async function (assert) {disableVirtualization();- const state = new State(buildRows(5));+ const items = tracked(buildRows(5));const calls = {registerApi: 0,reachEnd: 0,@@ -57,7 +49,7 @@ module("Integration | ui-kit | DVirtualList | inert", function (hooks) {</style><DVirtualList@estimateSize={{estimateSize}}- @items={{state.items}}+ @items={{items.value}}@key="id"@onReachEnd={{onReachEnd}}@onReachStart={{onReachStart}}@@ -70,7 +62,7 @@ module("Integration | ui-kit | DVirtualList | inert", function (hooks) {</template>);- state.items = state.items.map((item) => ({+ items.value = items.value.map((item) => ({...item,text: `${item.text} replaced`,}));diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/lifecycle-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/lifecycle-test.gjsindex f8e7100a3a7..add6a2aa1bc 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/lifecycle-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/lifecycle-test.gjs@@ -28,12 +28,6 @@ function buildRows(count) {}));}-class State {- @tracked items = buildRows(100);- @tracked estimate = estimate;- @tracked edgeThreshold = 8;-}-async function scrollTo(top) {const element = find(".d-virtual-list");element.scrollTop = top;@@ -56,7 +50,7 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {// the remembered boundary keys return to their mount state, so a refill can// fire its end edge again.test("lifecycle pin: emptying and refilling a list clears its height and re-arms its edges", async function (assert) {- const state = new State();+ const items = tracked(buildRows(100));let endFires = 0;const onReachEnd = () => endFires++;@@ -71,7 +65,7 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {</style><DVirtualList@estimateSize={{estimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"@onReachEnd={{onReachEnd}}@overscan={{0}}@@ -89,7 +83,7 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {);const firesWhilePopulated = endFires;- state.items = [];+ items.value = [];await settled();assert.dom(".d-virtual-list__item").doesNotExist("no rows remain");@@ -99,7 +93,7 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {"the sizer drops its height rather than keeping the outgoing list's scroll range");- state.items = buildRows(12);+ items.value = buildRows(12);await settled();assert.true(@@ -120,7 +114,8 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {// the memo has to be dropped: keeping it would match every later identical// window and strand a mounted list on whatever it last drew.test("lifecycle pin: a publish that throws does not strand the window", async function (assert) {- const state = new State();+ const items = tracked(buildRows(100));+ const edgeThreshold = tracked(8);const payloads = [];let shouldThrow = true;const onState = (payload) => {@@ -137,10 +132,10 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {class="viewport"style="height: 400px; overflow-y: auto"{{dVirtualizer- items=state.items+ items=items.valueestimateSize=estimatekey="id"- edgeThreshold=state.edgeThreshold+ edgeThreshold=edgeThreshold.valueonState=onState}}>@@ -157,7 +152,7 @@ module("Integration | ui-kit | DVirtualList | lifecycle", function (hooks) {// Re-run the modifier without moving the window, so the republish depends on// the failed memo having been dropped rather than on the signature changing.- state.edgeThreshold = 4;+ edgeThreshold.value = 4;await settled();assert.true(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/options-reuse-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/options-reuse-test.gjsindex 95bbc99455b..86817e22392 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/options-reuse-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/options-reuse-test.gjs@@ -18,11 +18,6 @@ function buildRows(count, from = 0) {}));}-class State {- @tracked items = buildRows(COUNT);- @tracked edgeThreshold = 8;-}-module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {setupRenderingTest(hooks);@@ -39,7 +34,8 @@ module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {// arg change that moves nothing still walks every index in the list. The cost is// proportional to the whole list rather than the window.test("options reuse: an unrelated arg change does not re-estimate the whole list", async function (assert) {- const state = new State();+ const items = tracked(buildRows(COUNT));+ const edgeThreshold = tracked(8);let estimateCalls = 0;const countingEstimate = () => {estimateCalls++;@@ -56,9 +52,9 @@ module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {}</style><DVirtualList- @edgeThreshold={{state.edgeThreshold}}+ @edgeThreshold={{edgeThreshold.value}}@estimateSize={{countingEstimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"as |item|>@@ -75,7 +71,7 @@ module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {// Changes nothing about geometry, keys, or the window. It exists only to force// the modifier to rebuild its engine options.- state.edgeThreshold = 4;+ edgeThreshold.value = 4;await settled();assert.true(@@ -88,8 +84,7 @@ module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {// the item COUNT rather than on the items themselves would survive this suite's// happy paths and quietly key a new list by the outgoing list's rows.test("options reuse: replacing items with a same-length set still keys the new rows", async function (assert) {- const state = new State();- state.items = buildRows(20);+ const items = tracked(buildRows(20));const estimate = () => ROW_PX;await render(@@ -103,7 +98,7 @@ module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {</style><DVirtualList@estimateSize={{estimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"@overscan={{0}}as |item|@@ -118,7 +113,7 @@ module("Integration | ui-kit | DVirtualList | options reuse", function (hooks) {.hasText("row 0", "precondition: the first list is rendered");// Same length, entirely different keys.- state.items = buildRows(20, 500);+ items.value = buildRows(20, 500);await settled();const texts = findAll(".d-virtual-list__item .row").map((row) =>diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/pinned-guard-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/pinned-guard-test.gjsindex 4d0dc53a187..d67d83556a0 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/pinned-guard-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/pinned-guard-test.gjs@@ -46,14 +46,6 @@ function assertCoversViewportFromZero(assert, indices, label) {);}-class Harness {- @tracked items;-- constructor(items) {- this.items = items;- }-}-function buildRows(count) {return Array.from({ length: count }, (_, index) => ({id: index,@@ -136,7 +128,7 @@ module(// the rows between were never mounted. The window must track the element's// real (browser-clamped) offset after the set changes, leaving no gap.test("a pinned row leaves no gap after the item set shrinks then grows", async function (assert) {- const h = new Harness(buildRows(30));+ const items = tracked(buildRows(30));const pinFirst = () => [0];await render(@@ -150,7 +142,7 @@ module(</style><DVirtualList@estimateSize={{estimate}}- @items={{h.items}}+ @items={{items.value}}@key="id"@pinnedIndices={{pinFirst}}as |item|@@ -163,9 +155,9 @@ module(// Scroll away from the pinned row, then filter down to a single match and// widen it again — the sequence that stranded the stale offset.await scrollTo(ROW_PX * 8);- h.items = buildRows(1);+ items.value = buildRows(1);await settled();- h.items = buildRows(15);+ items.value = buildRows(15);await settled();assertCoversViewportFromZero(@@ -180,7 +172,7 @@ module(// mounted while scrolled away, and a shrink→grow must leave no hole between// any pin and the window.test("multiple pinned rows stay mounted and leave no gaps after shrink then grow", async function (assert) {- const h = new Harness(buildRows(60));+ const items = tracked(buildRows(60));const pinPair = () => [0, 3];await render(@@ -194,7 +186,7 @@ module(</style><DVirtualList@estimateSize={{estimate}}- @items={{h.items}}+ @items={{items.value}}@key="id"@overscan={{0}}@pinnedIndices={{pinPair}}@@ -225,9 +217,9 @@ module("the second row between the pins is not dragged along");- h.items = buildRows(1);+ items.value = buildRows(1);await settled();- h.items = buildRows(15);+ items.value = buildRows(15);await settled();assertCoversViewportFromZero(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/published-state-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/published-state-test.gjsindex 2c7a250d66c..9b982207fec 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/published-state-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/published-state-test.gjs@@ -11,10 +11,6 @@ import dVirtualizer from "discourse/ui-kit/modifiers/d-virtualizer";const ROW_PX = 40;const estimate = () => ROW_PX;-class ReSyncState {- @tracked estimate = estimate;-}-function buildRows(count) {return Array.from({ length: count }, (_, index) => ({id: index,@@ -48,7 +44,7 @@ module(const publishes = [];const onState = (state) => publishes.push(state);const items = buildRows(100);- const state = new ReSyncState();+ const estimateSize = tracked(estimate);await render(<template>@@ -57,7 +53,7 @@ module(style="height: 400px; overflow-y: auto"{{dVirtualizeritems=items- estimateSize=state.estimate+ estimateSize=estimateSize.valuekey="id"onState=onState}}@@ -72,7 +68,7 @@ module(// A different closure with identical behaviour, on the SAME instance: the// options object changes identity while the rendered window does not.- state.estimate = () => ROW_PX;+ estimateSize.value = () => ROW_PX;await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/sentinel-rearm-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/sentinel-rearm-test.gjsindex a55a06b569f..a7970f52e63 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/sentinel-rearm-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/sentinel-rearm-test.gjs@@ -23,10 +23,6 @@ function rowsThenSentinel(count) {];}-class State {- @tracked items = rowsThenSentinel(6);-}-// Supplemental coverage for the branch that arms both latches when the count// moved but neither boundary key did. A list that keeps a persistent sentinel// row at one end holds both boundary keys stable across a refresh, so nothing@@ -49,7 +45,7 @@ module(});test("a count change between stable boundary keys re-arms both edges", async function (assert) {- const state = new State();+ const items = tracked(rowsThenSentinel(6));const ends = [];const starts = [];const onReachEnd = () => ends.push(true);@@ -66,7 +62,7 @@ module(</style><DVirtualList@estimateSize={{estimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"@onReachEnd={{onReachEnd}}@onReachStart={{onReachStart}}@@ -85,7 +81,7 @@ module(// Same first row, same sentinel last row, fewer rows between them. The// window never leaves either band, so the retreat path cannot account for// any callback that follows.- state.items = rowsThenSentinel(1);+ items.value = rowsThenSentinel(1);await settled();assert.strictEqual(@@ -101,7 +97,7 @@ module(});test("a refresh that moves neither the count nor the keys arms nothing", async function (assert) {- const state = new State();+ const items = tracked(rowsThenSentinel(6));const ends = [];const onReachEnd = () => ends.push(true);@@ -116,7 +112,7 @@ module(</style><DVirtualList@estimateSize={{estimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"@onReachEnd={{onReachEnd}}as |item|@@ -130,7 +126,7 @@ module(// A fresh array of equivalent rows: same keys, same count. Re-arming here// would answer an edge callback with another edge callback.- state.items = rowsThenSentinel(6);+ items.value = rowsThenSentinel(6);await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/shrink-window-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/shrink-window-test.gjsindex 178b104d321..697a9f13fa4 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/shrink-window-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/shrink-window-test.gjs@@ -21,14 +21,6 @@ const SHORT_COUNT = 10;const estimate = () => ROW_PX;-class State {- @tracked items;-- constructor(items) {- this.items = items;- }-}-/*** Ids start at `from` so a shrink can hand over rows the outgoing list never* contained. The engine resolves its scroll anchor by key, so reusing ids would@@ -63,7 +55,7 @@ module("Integration | ui-kit | DVirtualList | shrink window", function (hooks) {// the shrunk total. Until that height lands the browser has not clamped// `scrollTop`, so the engine still answers from the outgoing list's offset// and the published range collapses onto the last row of the new list.- const state = new State(buildRows(LONG_COUNT));+ const items = tracked(buildRows(LONG_COUNT));const ranges = [];// Recorded as strings so a failure names the offending window rather than// printing `[object Object]`.@@ -81,7 +73,7 @@ module("Integration | ui-kit | DVirtualList | shrink window", function (hooks) {</style><DVirtualList@estimateSize={{estimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"@onVisibleRangeChange={{onVisibleRangeChange}}@overscan={{0}}@@ -103,7 +95,7 @@ module("Integration | ui-kit | DVirtualList | shrink window", function (hooks) {// list; only what is published from the shrink onwards is under test.ranges.length = 0;- state.items = buildRows(SHORT_COUNT, 1000);+ items.value = buildRows(SHORT_COUNT, 1000);await settled();assert.true(@@ -125,7 +117,7 @@ module("Integration | ui-kit | DVirtualList | shrink window", function (hooks) {// The positive half. This one can also pass on the defective ordering once// the browser's clamp fires its scroll event and a corrected flush lands, so// it guards the settled result rather than discriminating the bug.- const state = new State(buildRows(LONG_COUNT));+ const items = tracked(buildRows(LONG_COUNT));const ranges = [];const onVisibleRangeChange = (range) =>ranges.push(`${range.startIndex}-${range.endIndex}`);@@ -141,7 +133,7 @@ module("Integration | ui-kit | DVirtualList | shrink window", function (hooks) {</style><DVirtualList@estimateSize={{estimate}}- @items={{state.items}}+ @items={{items.value}}@key="id"@onVisibleRangeChange={{onVisibleRangeChange}}@overscan={{0}}@@ -154,7 +146,7 @@ module("Integration | ui-kit | DVirtualList | shrink window", function (hooks) {await scrollTo(LONG_COUNT * ROW_PX - VIEWPORT_PX);- state.items = buildRows(SHORT_COUNT, 1000);+ items.value = buildRows(SHORT_COUNT, 1000);await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/stable-key-test.gjs b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/stable-key-test.gjsindex cd7a6765c2b..fd26c214ab6 100644--- a/frontend/discourse/tests/integration/ui-kit/d-virtual-list/stable-key-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/d-virtual-list/stable-key-test.gjs@@ -13,14 +13,6 @@ import DVirtualList from "discourse/ui-kit/d-virtual-list";const ROW_HEIGHT = 40;const estimateSize = () => ROW_HEIGHT;-class State {- @tracked items;-- constructor(items) {- this.items = items;- }-}-function buildRows(count) {return Array.from({ length: count }, (_, id) => ({id: String(id),@@ -40,7 +32,7 @@ module("Integration | ui-kit | DVirtualList | stable key", function (hooks) {});test("stable @key reuses row DOM across an item-array replacement", async function (assert) {- const state = new State(buildRows(1000));+ const items = tracked(buildRows(1000));const insertCounts = new Map();const recordInsert = (id) => {insertCounts.set(id, (insertCounts.get(id) ?? 0) + 1);@@ -59,7 +51,7 @@ module("Integration | ui-kit | DVirtualList | stable key", function (hooks) {</style><DVirtualList@estimateSize={{estimateSize}}- @items={{state.items}}+ @items={{items.value}}@key="id"as |item|>@@ -86,7 +78,7 @@ module("Integration | ui-kit | DVirtualList | stable key", function (hooks) {`a real window mounts fewer than 40 rows (${rowsBefore.size} rows)`);- state.items = state.items.map((row) => ({ ...row }));+ items.value = items.value.map((row) => ({ ...row }));await settled();const rowsAfter = new Map(diff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-external-target-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-external-target-test.gjsindex d83ad69e311..99e2f169a36 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-external-target-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-external-target-test.gjs@@ -20,13 +20,11 @@ module(setupRenderingTest(hooks);test("registration marker follows the target lifecycle", async function (assert) {- const state = new (class {- @tracked show = true;- })();+ const show = tracked(true);await render(<template>- {{#if state.show}}+ {{#if show.value}}<divid="external-target"{{dDragAndDropExternalTarget accepts="files"}}@@ -41,7 +39,7 @@ module("the target is marked while registered");- state.show = false;+ show.value = false;await settled();assert.false(@@ -446,16 +444,14 @@ module(});test("an external target switching between destination and slot mid-hover shows one indicator family", async function (assert) {- const state = new (class {- @tracked axis = undefined;- })();+ const axis = tracked(undefined);await render(<template><divid="ext"style="height: 100px"- {{dDragAndDropExternalTarget accepts="text" axis=state.axis}}+ {{dDragAndDropExternalTarget accepts="text" axis=axis.value}}>ext</div></template>);@@ -480,7 +476,7 @@ module().doesNotHaveClass("--drag-below");- state.axis = "vertical";+ axis.value = "vertical";await settled();await dragEvent("#ext", "dragover", { dataTransfer, ...lowerHalf });@@ -492,7 +488,7 @@ module("and drops the destination class it had");- state.axis = undefined;+ axis.value = undefined;await settled();await dragEvent("#ext", "dragover", { dataTransfer, ...lowerHalf });diff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-test.gjsindex 34a126f750b..62288b7e8a9 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-and-drop-test.gjs@@ -30,13 +30,11 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {module("marker attribute lifecycle", function () {test("removes every marker when its element is destroyed", async function (assert) {- const state = new (class {- @tracked show = true;- })();+ const show = tracked(true);await render(<template>- {{#if state.show}}+ {{#if show.value}}<div id="source" {{dDragAndDropSource type="row"}}>source</div><div id="target" {{dDragAndDropTarget accepts="row"}}>target</div>{{/if}}@@ -54,7 +52,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {target.hasAttribute("data-drop-target"),"the element target starts registered");- state.show = false;+ show.value = false;await settled();assert.false(@@ -68,15 +66,13 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {});test("source marker follows the disabled registration cycle", async function (assert) {- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template><divid="source"- {{dDragAndDropSource type="row" disabled=state.disabled}}+ {{dDragAndDropSource type="row" disabled=disabled.value}}>source</div></template>);@@ -87,14 +83,14 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {"the enabled source is marked");- state.disabled = true;+ disabled.value = true;await settled();assert.false(source.hasAttribute("data-drag-source"),"disabling removes the marker from the live element");- state.disabled = false;+ disabled.value = false;await settled();assert.true(source.hasAttribute("data-drag-source"),@@ -872,15 +868,13 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {module("a torn-down source drops its deferred callbacks", function () {test("destroying the modifier before the runloop flushes cancels them", async function (assert) {const calls = [];- const state = new (class {- @tracked rendered = true;- })();+ const rendered = tracked(true);const onDragEnd = () => calls.push("dragEnd");const onDrop = () => calls.push("drop");await render(<template>- {{#if state.rendered}}+ {{#if rendered.value}}<divid="src"{{dDragAndDropSource@@ -900,7 +894,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {// Torn down in the same task as the drop, before the deferred callbacks flush.dragEventNow("#tgt", "drop", { dataTransfer, ...centerOf("#tgt") });- state.rendered = false;+ rendered.value = false;await settled();assert.deepEqual(@@ -912,9 +906,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("re-registering the modifier before the runloop flushes keeps them", async function (assert) {const calls = [];- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);const onDragEnd = () => calls.push("dragEnd");const onDrop = () => calls.push("drop");@@ -924,7 +916,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {id="src"{{dDragAndDropSourcetype="row"- disabled=state.disabled+ disabled=disabled.valueonDragEnd=onDragEndonDrop=onDrop}}@@ -938,7 +930,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {await dragOver("#tgt", { dataTransfer });dragEventNow("#tgt", "drop", { dataTransfer, ...centerOf("#tgt") });- state.disabled = true;+ disabled.value = true;await settled();assert.deepEqual(@@ -950,9 +942,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("a source disabled mid-drag still reports how that drag ended", async function (assert) {const calls = [];- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);const onDragEnd = () => calls.push("dragEnd");const onDrop = () => calls.push("drop");@@ -962,7 +952,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {id="src"{{dDragAndDropSourcetype="row"- disabled=state.disabled+ disabled=disabled.valueonDragEnd=onDragEndonDrop=onDrop}}@@ -981,7 +971,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {...centerOf("#tgt"),});- state.disabled = true;+ disabled.value = true;await settled();await dragEvent("#tgt", "dragover", {@@ -1004,15 +994,13 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {// White-box: a duplicate registration is only visible through the// library's dev-only warning, so that is what is asserted on.const warn = sinon.stub(console, "warn");- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template><divid="src"- {{dDragAndDropSource type="row" disabled=state.disabled}}+ {{dDragAndDropSource type="row" disabled=disabled.value}}>src</div><div id="tgt" {{dDragAndDropTarget accepts="row"}}>tgt</div></template>@@ -1024,9 +1012,9 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {...centerOf("#src"),});- state.disabled = true;+ disabled.value = true;await settled();- state.disabled = false;+ disabled.value = false;await settled();const duplicate = warn@@ -1131,9 +1119,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("a source disabled and re-enabled mid-drag still reports how that drag ended", async function (assert) {const calls = [];- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);const onDragEnd = () => calls.push("dragEnd");const onDrop = () => calls.push("drop");@@ -1143,7 +1129,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {id="src"{{dDragAndDropSourcetype="row"- disabled=state.disabled+ disabled=disabled.valueonDragEnd=onDragEndonDrop=onDrop}}@@ -1162,9 +1148,9 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {...centerOf("#tgt"),});- state.disabled = true;+ disabled.value = true;await settled();- state.disabled = false;+ disabled.value = false;await settled();assert@@ -1189,9 +1175,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("a source re-enabled between the drop and its deferred dispatch keeps its registration for the next drag", async function (assert) {const calls = [];- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);const onDragEnd = () => calls.push("dragEnd");const onDrop = () => calls.push("drop");@@ -1201,7 +1185,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {id="src"{{dDragAndDropSourcetype="row"- disabled=state.disabled+ disabled=disabled.valueonDragEnd=onDragEndonDrop=onDrop}}@@ -1213,11 +1197,11 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {const dataTransfer = new DataTransfer();await startDrag("#src", { dataTransfer });await dragOver("#tgt", { dataTransfer });- state.disabled = true;+ disabled.value = true;await settled();dragEventNow("#tgt", "drop", { dataTransfer, ...centerOf("#tgt") });- state.disabled = false;+ disabled.value = false;await settled();await dragEvent("#src", "dragend", { dataTransfer, ...centerOf("#src") });@@ -1311,21 +1295,19 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("a source disabled mid-drag and then destroyed drops its callbacks", async function (assert) {const calls = [];- const state = new (class {- @tracked disabled = false;- @tracked rendered = true;- })();+ const disabled = tracked(false);+ const rendered = tracked(true);const onDragEnd = () => calls.push("dragEnd");const onDrop = () => calls.push("drop");await render(<template>- {{#if state.rendered}}+ {{#if rendered.value}}<divid="src"{{dDragAndDropSourcetype="row"- disabled=state.disabled+ disabled=disabled.valueonDragEnd=onDragEndonDrop=onDrop}}@@ -1339,12 +1321,12 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {await startDrag("#src", { dataTransfer });await dragOver("#tgt", { dataTransfer });- state.disabled = true;+ disabled.value = true;await settled();// Destroyed in the same task as the drop, before its deferred callbacks flush.dragEventNow("#tgt", "drop", { dataTransfer, ...centerOf("#tgt") });- state.rendered = false;+ rendered.value = false;await settled();assert.deepEqual(@@ -1485,21 +1467,19 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {});test("a source still registered keeps answering after a sibling detaches", async function (assert) {- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template><divid="going"- {{dDragAndDropSource type="going" disabled=state.disabled}}+ {{dDragAndDropSource type="going" disabled=disabled.value}}>going</div><div id="staying" {{dDragAndDropSource type="staying"}}>staying</div></template>);- state.disabled = true;+ disabled.value = true;await settled();const dataTransfer = recordingTransfer();@@ -1518,21 +1498,19 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("the last source to go takes the shared listener with it", async function (assert) {// White-box, because the only thing a leak costs is an idle listener and// a map entry per registration, nothing a drag can observe.- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template><divid="row"- {{dDragAndDropSource type="row" disabled=state.disabled}}+ {{dDragAndDropSource type="row" disabled=disabled.value}}>row</div></template>);const released = sinon.spy(window, "removeEventListener");- state.disabled = true;+ disabled.value = true;await settled();assert.true(@@ -2330,9 +2308,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {});test("flipping indicator off mid-hover clears the class already shown", async function (assert) {- const state = new (class {- @tracked indicator = true;- })();+ const indicator = tracked(true);await render(<template>@@ -2342,7 +2318,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {{{dDragAndDropTargetaccepts="row"position="before"- indicator=state.indicator+ indicator=indicator.value}}>tgt</div></template>@@ -2354,7 +2330,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {assert.dom("#tgt").hasClass("--drag-above", "lit while indicating");- state.indicator = false;+ indicator.value = false;await settled();await dragEvent("#tgt", "dragover", {dataTransfer,@@ -2871,9 +2847,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {test("a throwing source onDrop still runs the teardown that was waiting on the drag", async function (assert) {const reported = [];setupOnerror((error) => reported.push(error));- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template>@@ -2882,7 +2856,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {{{dDragAndDropSourcetype="row"onDrop=blowUp- disabled=state.disabled+ disabled=disabled.value}}>src</div><div id="tgt" {{dDragAndDropTarget accepts="row"}}>tgt</div>@@ -2893,7 +2867,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {await startDrag("#src", { dataTransfer });await dragOver("#tgt", { dataTransfer });- state.disabled = true;+ disabled.value = true;await settled();assert.dom("#src").hasAttribute("data-drag-source", "", "waiting");@@ -2914,10 +2888,8 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {module("arg changes reach a drag already in flight", function () {test("disabling a source mid-drag still reports to its current callbacks", async function (assert) {const calls = [];- const state = new (class {- @tracked disabled = false;- @tracked onDragEnd = () => calls.push("before");- })();+ const disabled = tracked(false);+ const onDragEnd = tracked(() => calls.push("before"));await render(<template>@@ -2925,8 +2897,8 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {id="src"{{dDragAndDropSourcetype="row"- disabled=state.disabled- onDragEnd=state.onDragEnd+ disabled=disabled.value+ onDragEnd=onDragEnd.value}}>src</div><div id="tgt" {{dDragAndDropTarget accepts="row"}}>tgt</div>@@ -2944,8 +2916,8 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {});// One flush for both: the registration detaches with the callback replaced.- state.disabled = true;- state.onDragEnd = () => calls.push("after");+ disabled.value = true;+ onDragEnd.value = () => calls.push("after");await settled();await dragEvent("#tgt", "dragover", {@@ -3273,10 +3245,8 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {});test("a sticky target keeps its enter while the pointer is outside it and is left when stickiness ends", async function (assert) {- const state = new (class {- @tracked sticky = true;- })();- const isSticky = () => state.sticky;+ const sticky = tracked(true);+ const isSticky = () => sticky.value;const events = [];const onEnter = () => events.push("enter");const onLeave = () => events.push("leave");@@ -3312,7 +3282,7 @@ module("Integration | ui-kit | Modifier | dragAndDrop", function (hooks) {.dom("#tgt").hasClass("--drag-above", "and the indicator stays with the role");- state.sticky = false;+ sticky.value = false;await settled();await dragEvent("#away", "dragover", {dataTransfer,diff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-dwell-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-dwell-test.gjsindex cc53a0e2eae..4b460cd8e2e 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-dwell-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-drag-dwell-test.gjs@@ -887,15 +887,12 @@ module("Integration | ui-kit | Modifier | dDragDwell", function (hooks) {const onDwell = (event) => dwells.push(event);const onDwellEnd = (event) => ends.push(event);- class State {- @tracked show = true;- }- const state = new State();+ const show = tracked(true);await render(<template><div data-test-chip {{dDragAndDropSource type="card"}}>chip</div>- {{#if state.show}}+ {{#if show.value}}<divdata-test-dwellstyle="display: block; height: 60px;"@@ -912,7 +909,7 @@ module("Integration | ui-kit | Modifier | dDragDwell", function (hooks) {await settled();assert.strictEqual(dwells.length, 1, "fired");- state.show = false;+ show.value = false;await settled();assert.strictEqual(ends.length,diff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-pointer-drag-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-pointer-drag-test.gjsindex 7780ab89ea6..24c97a86df3 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-pointer-drag-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-pointer-drag-test.gjs@@ -1056,15 +1056,13 @@ module("Integration | ui-kit | d-pointer-drag", function (hooks) {});test("touchAction is re-reflected when the consumer changes it", async function (assert) {- const state = new (class {- @tracked touchAction = "pan-y";- })();+ const touchAction = tracked("pan-y");await render(<template><divclass="dpd-target"- {{dPointerDrag touchAction=state.touchAction}}+ {{dPointerDrag touchAction=touchAction.value}}></div></template>);@@ -1077,7 +1075,7 @@ module("Integration | ui-kit | d-pointer-drag", function (hooks) {"the initial value is reflected");- state.touchAction = "pan-x";+ touchAction.value = "pan-x";await settled();// The declaration has to be in place before a touch begins, so a valuediff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-cost-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-cost-test.gjsindex 41a7c2facb3..e6661a1a619 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-cost-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-cost-test.gjs@@ -236,9 +236,7 @@ module(setupRenderingTest(hooks);test("rovingCost M5 tabStop=false performs no per-item forced reads on modify", async function (assert) {- const state = new (class {- @tracked key = 0;- })();+ const key = tracked(0);await render(<template>@@ -248,7 +246,7 @@ module(orientation="vertical"itemSelector="[role=option]"tabStop=false- itemsKey=state.key+ itemsKey=key.value}}>{{#each SMALL_GROUP_ITEMS as |index|}}@@ -259,7 +257,7 @@ module();const reads = await measureForcedReads(async () => {- state.key++;+ key.value++;await settled();});@@ -273,17 +271,15 @@ module(});test("rovingCost M5 modify preserves at most one tab stop with author-supplied zeros", async function (assert) {- const state = new (class {- @tracked items = authorItems("initial");- })();+ const items = tracked(authorItems("initial"));await render(<template><divrole="listbox"- {{dRovingFocus itemSelector="[role=option]" itemsKey=state.items}}+ {{dRovingFocus itemSelector="[role=option]" itemsKey=items.value}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<buttonclass="author-item"data-id={{item.id}}@@ -301,7 +297,7 @@ module("initial modify collapses three author-supplied zeros to one tab stop");- state.items = authorItems("rerendered");+ items.value = authorItems("rerendered");await settled();assert.strictEqual(@@ -531,9 +527,7 @@ module(test("rovingCost M5 replacement and repeated steps preserve one tab stop", async function (assert) {let api;const registerApi = (registeredApi) => (api = registeredApi);- const state = new (class {- @tracked items = authorItems("initial-sequence");- })();+ const items = tracked(authorItems("initial-sequence"));await render(<template>@@ -542,11 +536,11 @@ module({{dRovingFocusorientation="vertical"itemSelector="[role=option]"- itemsKey=state.items+ itemsKey=items.valueonRegisterApi=registerApi}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<buttonclass="replacement-item"data-id={{item.id}}@@ -560,7 +554,7 @@ module(assert.true(api.focusIndex(2), "the old item set establishes a holder");- state.items = authorItems("replacement-sequence");+ items.value = authorItems("replacement-sequence");await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-lifecycle-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-lifecycle-test.gjsindex f2c784e9240..3ac4a9ce1af 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-lifecycle-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-lifecycle-test.gjs@@ -16,9 +16,7 @@ module(setupRenderingTest(hooks);test("replacing the active controller preserves the cursor and rebinds navigation", async function (assert) {- const state = new (class {- @tracked controller = ".first-controller";- })();+ const controller = tracked(".first-controller");const changes = [];const onActiveChange = (item) => changes.push(item);@@ -39,7 +37,7 @@ module(role="listbox"{{dRovingFocusfocusStrategy="active-descendant"- controllerElement=state.controller+ controllerElement=controller.valueitemSelector="[role=option]"activeClass="--active"entryFocus="first"@@ -54,7 +52,7 @@ module(const activeId = document.querySelector(".a").id;changes.length = 0;- state.controller = ".second-controller";+ controller.value = ".second-controller";await settled();assert@@ -87,9 +85,7 @@ module(});test("replacing the controller cancels a pending reannouncement", async function (assert) {- const state = new (class {- @tracked controller = ".first-controller";- })();+ const controller = tracked(".first-controller");let api;const register = (value) => (api = value);@@ -110,7 +106,7 @@ module(role="listbox"{{dRovingFocusfocusStrategy="active-descendant"- controllerElement=state.controller+ controllerElement=controller.valueitemSelector="[role=option]"activeClass="--active"entryFocus="first"@@ -126,7 +122,7 @@ module(const activeId = document.querySelector(".a").id;assert.true(api.reannounceActive(), "the reannouncement is scheduled");- state.controller = ".second-controller";+ controller.value = ".second-controller";await settled();assert@@ -146,10 +142,8 @@ module(});test("leaving active mode disarms a pending seed", async function (assert) {- const state = new (class {- @tracked mode = "active-descendant";- @tracked items = [];- })();+ const mode = tracked("active-descendant");+ const items = tracked([]);await render(<template>@@ -162,24 +156,24 @@ module(id="lifecycle-list"role="listbox"{{dRovingFocus- focusStrategy=state.mode+ focusStrategy=mode.valuecontrollerElement=".controller"itemSelector="[role=option]"activeClass="--active"entryFocus="first"- itemsKey=state.items+ itemsKey=items.value}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<button id={{item.id}} role="option">{{item.id}}</button>{{/each}}</div></template>);- state.mode = "roving-tabindex";+ mode.value = "roving-tabindex";await settled();- state.items = [{ id: "a" }, { id: "b" }];+ items.value = [{ id: "a" }, { id: "b" }];await settled();assert@@ -202,10 +196,8 @@ module(});test("entryFocus none disarms a pending seed", async function (assert) {- const state = new (class {- @tracked entryFocus = "first";- @tracked items = [];- })();+ const entryFocus = tracked("first");+ const items = tracked([]);await render(<template>@@ -222,20 +214,20 @@ module(controllerElement=".controller"itemSelector="[role=option]"activeClass="--active"- entryFocus=state.entryFocus- itemsKey=state.items+ entryFocus=entryFocus.value+ itemsKey=items.value}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<button id={{item.id}} role="option">{{item.id}}</button>{{/each}}</div></template>);- state.entryFocus = "none";+ entryFocus.value = "none";await settled();- state.items = [{ id: "a" }];+ items.value = [{ id: "a" }];await settled();assert@@ -248,9 +240,7 @@ module(});test("active selector replacement releases every artifact from the old scope", async function (assert) {- const state = new (class {- @tracked selector = ".first-item";- })();+ const selector = tracked(".first-item");await render(<template>@@ -265,7 +255,7 @@ module({{dRovingFocusfocusStrategy="active-descendant"controllerElement=".controller"- itemSelector=state.selector+ itemSelector=selector.valueactiveClass="--active"entryFocus="first"}}@@ -280,7 +270,7 @@ module(const firstId = document.querySelector(".first-item").id;assert.true(Boolean(firstId), "the first scope receives a minted id");- state.selector = ".second-item";+ selector.value = ".second-item";await settled();assert@@ -313,10 +303,8 @@ module(const secondChanges = [];const firstCallback = (item) => firstChanges.push(item);const secondCallback = (item) => secondChanges.push(item);- const state = new (class {- @tracked callback = firstCallback;- @tracked items = [];- })();+ const callback = tracked(firstCallback);+ const items = tracked([]);await render(<template>@@ -334,11 +322,11 @@ module(itemSelector="[role=option]"activeClass="--active"entryFocus="first"- itemsKey=state.items- onActiveChange=state.callback+ itemsKey=items.value+ onActiveChange=callback.value}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<button id={{item.id}} role="option">{{item.id}}</button>{{/each}}</div>@@ -346,9 +334,9 @@ module();firstChanges.length = 0;- state.callback = secondCallback;+ callback.value = secondCallback;await settled();- state.items = [{ id: "a" }];+ items.value = [{ id: "a" }];await settled();assert.deepEqual(@@ -364,9 +352,7 @@ module(});test("strategy round trips leave only the current strategy artifacts", async function (assert) {- const state = new (class {- @tracked mode = "active-descendant";- })();+ const mode = tracked("active-descendant");await render(<template>@@ -379,7 +365,7 @@ module(id="lifecycle-list"role="listbox"{{dRovingFocus- focusStrategy=state.mode+ focusStrategy=mode.valuecontrollerElement=".controller"itemSelector="[role=option]"activeClass="--active"@@ -392,14 +378,14 @@ module(</template>);- state.mode = "roving-tabindex";+ mode.value = "roving-tabindex";await settled();assert.dom(".a").doesNotHaveClass("--active", "active state is released");assert.dom(".a").hasAttribute("tabindex", "0", "the roving strategy owns the item");- state.mode = "active-descendant";+ mode.value = "active-descendant";await settled();assert@@ -471,9 +457,7 @@ module(});test("tabStop toggles without moving the roving cursor", async function (assert) {- const state = new (class {- @tracked tabStop = true;- })();+ const tabStop = tracked(true);await render(<template>@@ -482,7 +466,7 @@ module({{dRovingFocusorientation="horizontal"itemSelector="[role=option]"- tabStop=state.tabStop+ tabStop=tabStop.value}}><button class="a" role="option">A</button>@@ -492,7 +476,7 @@ module();await focus(".b");- state.tabStop = false;+ tabStop.value = false;await settled();assert.dom(".b").isFocused("the cursor remains on the focused item");@@ -500,7 +484,7 @@ module(.dom("[role=option][tabindex='0']").doesNotExist("the group leaves the Tab sequence");- state.tabStop = true;+ tabStop.value = true;await settled();assert.dom(".b").isFocused("restoring the tab stop does not move focus");@@ -510,23 +494,20 @@ module(});test("restoring lost focus copes with the selector matching nothing", async function (assert) {- const state = new (class {- @tracked- rows = [- { id: "a", nav: true },- { id: "b", nav: true },- { id: "c", nav: true },- ];- @tracked key = 0;- })();+ const rows = tracked([+ { id: "a", nav: true },+ { id: "b", nav: true },+ { id: "c", nav: true },+ ]);+ const key = tracked(0);await render(<template><divrole="listbox"- {{dRovingFocus itemSelector="[data-nav]" itemsKey=state.key}}+ {{dRovingFocus itemSelector="[data-nav]" itemsKey=key.value}}>- {{#each state.rows key="id" as |row|}}+ {{#each rows.value key="id" as |row|}}<buttonclass="opt-{{row.id}}"data-nav={{if row.nav "true"}}@@ -538,11 +519,11 @@ module();await focus(".opt-a");- state.rows = [+ rows.value = [{ id: "b", nav: false },{ id: "c", nav: false },];- state.key++;+ key.value++;await settled();assert.strictEqual(diff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-test.gjsindex f7ca332b848..0db1d1369ce 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-roving-focus-test.gjs@@ -503,14 +503,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("active mode: a changing item set clears a stale highlight", async function (assert) {- class State {- @tracked items = ["a", "b", "c"];- @tracked key = 0;- }- const state = new State();+ const items = tracked(["a", "b", "c"]);+ const key = tracked(0);const refilter = () => {- state.items = ["x", "y"];- state.key++;+ items.value = ["x", "y"];+ key.value++;};await render(@@ -529,11 +526,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {entryFocus="none"controllerElement=".search"itemSelector="[role=option]"- itemsKey=state.key+ itemsKey=key.valueactiveClass="--active"}}>- {{#each state.items as |item|}}+ {{#each items.value as |item|}}<button class="opt-{{item}}" role="option">{{item}}</button>{{/each}}</div>@@ -602,9 +599,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {// presented with no cursor at all, and the reader's first arrow press is spent putting one on// row one instead of moving off it.test("active mode: a container that gains its items after install still seeds", async function (assert) {- const state = new (class {- @tracked items = [];- })();+ const items = tracked([]);await render(<template>@@ -620,7 +615,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {entryFocus="first"}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<buttonclass="opt"id={{item.id}}@@ -633,7 +628,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {assert.dom(".opt").doesNotExist("the container installs with no items");- state.items = [{ id: "a" }, { id: "b" }];+ items.value = [{ id: "a" }, { id: "b" }];await settled();assert@@ -656,9 +651,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {// present means `#reconcileActive` seeds and returns before ever arming it, so no// modifier code runs when the set later changes and the test proves nothing about the// one-shot guard.- const state = new (class {- @tracked items = [];- })();+ const items = tracked([]);await render(<template>@@ -674,7 +667,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {entryFocus="first"}}>- {{#each state.items key="id" as |item|}}+ {{#each items.value key="id" as |item|}}<buttonclass="opt"id={{item.id}}@@ -687,7 +680,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {await focus(".search");- state.items = [{ id: "a" }, { id: "b" }];+ items.value = [{ id: "a" }, { id: "b" }];await settled();assert.dom("#a")@@ -699,7 +692,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {await triggerKeyEvent(".search", "keydown", "ArrowDown");assert.dom("#b").hasClass("--active", "the reader moved the cursor to b");- state.items = [...state.items, { id: "c" }];+ items.value = [...items.value, { id: "c" }];await settled();assert@@ -809,9 +802,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {// `itemsKey` is what makes this test mean what its name says: without a reconcile after the// arrow key, nothing could possibly drag the cursor back and the assertion would only be// restating that ArrowDown moved it.- const state = new (class {- @tracked key = 1;- })();+ const key = tracked(1);await render(<template>@@ -824,7 +815,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {controllerElement=".search"itemSelector="[role=option]"activeClass="--active"- itemsKey=state.key+ itemsKey=key.valueentryFocus="selected-or-first"}}>@@ -843,7 +834,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {.dom(".c").hasClass("--active", "the user's arrow key moves off the selection");- state.key = 2;+ key.value = 2;await settled();assert@@ -855,10 +846,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("active mode: itemsKey preserves a survivor but resetKey re-seeds the first item", async function (assert) {- const state = new (class {- @tracked itemsKey = 0;- @tracked resetKey = 0;- })();+ const itemsKey = tracked(0);+ const resetKey = tracked(0);await render(<template>@@ -872,8 +861,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {itemSelector="[role=option]"activeClass="--active"entryFocus="first"- itemsKey=state.itemsKey- resetKey=state.resetKey+ itemsKey=itemsKey.value+ resetKey=resetKey.value}}><button class="a" role="option">A</button>@@ -887,7 +876,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {await triggerKeyEvent(".search", "keydown", "ArrowDown");assert.dom(".b").hasClass("--active", "the reader placed the cursor on b");- state.itemsKey++;+ itemsKey.value++;await settled();assert@@ -897,7 +886,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {"an ordinary item reconciliation keeps the surviving cursor");- state.resetKey++;+ resetKey.value++;await settled();assert@@ -915,9 +904,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("active mode: resetKey re-seeds a marked row under selected-or-first", async function (assert) {- const state = new (class {- @tracked resetKey = 0;- })();+ const resetKey = tracked(0);await render(<template>@@ -931,7 +918,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {itemSelector="[role=option]"activeClass="--active"entryFocus="selected-or-first"- resetKey=state.resetKey+ resetKey=resetKey.value}}><button aria-selected="false" class="a" role="option">A</button>@@ -947,7 +934,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {.dom(".c").hasClass("--active", "the reader moved past the selection");- state.resetKey++;+ resetKey.value++;await settled();assert@@ -965,14 +952,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("active mode: entryFocus=first re-seeds the first item when the set changes", async function (assert) {- class State {- @tracked items = ["a", "b", "c"];- @tracked key = 0;- }- const state = new State();+ const items = tracked(["a", "b", "c"]);+ const key = tracked(0);const refilter = () => {- state.items = ["x", "y"];- state.key++;+ items.value = ["x", "y"];+ key.value++;};await render(@@ -990,12 +974,12 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {focusStrategy="active-descendant"controllerElement=".search"itemSelector="[role=option]"- itemsKey=state.key+ itemsKey=key.valueactiveClass="--active"entryFocus="first"}}>- {{#each state.items key="@identity" as |item|}}+ {{#each items.value key="@identity" as |item|}}<button class="opt-{{item}}" role="option">{{item}}</button>{{/each}}</div>@@ -1544,13 +1528,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {}};- const state = new (class {- @tracked show = true;- })();+ const show = tracked(true);await render(<template>- {{#if state.show}}+ {{#if show.value}}<divrole="listbox"{{dRovingFocus@@ -1572,7 +1554,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {"the api is registered while mounted");- state.show = false;+ show.value = false;await settled();assert.true(revoked, "onRegisterApi(null) is called on teardown");@@ -2063,9 +2045,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {const second = [];const registerFirst = (value) => first.push(value);const registerSecond = (value) => second.push(value);- const state = new (class {- @tracked useFirst = true;- })();+ const useFirst = tracked(true);await render(<template>@@ -2073,7 +2053,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {role="listbox"{{dRovingFocusitemSelector="[role=option]"- onRegisterApi=(if state.useFirst registerFirst registerSecond)+ onRegisterApi=(if useFirst.value registerFirst registerSecond)}}><button class="a" role="option">A</button>@@ -2084,7 +2064,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {assert.strictEqual(first.length, 1, "the first callback is registered");assert.notStrictEqual(first[0], null, "with a live api");- state.useFirst = false;+ useFirst.value = false;await settled();assert.strictEqual(@@ -2117,19 +2097,17 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("focus mode: re-seeding prefers the item holding DOM focus over an authored tab stop", async function (assert) {- const state = new (class {- @tracked showEarlier = false;- @tracked itemsKey = 0;- })();+ const showEarlier = tracked(false);+ const itemsKey = tracked(0);await render(<template><divrole="listbox"- {{dRovingFocus itemSelector="[role=option]" itemsKey=state.itemsKey}}+ {{dRovingFocus itemSelector="[role=option]" itemsKey=itemsKey.value}}><button class="start" role="option">Start</button>- {{#if state.showEarlier}}+ {{#if showEarlier.value}}<buttonclass="authored"role="option"@@ -2143,8 +2121,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {);await focus(".middle");- state.showEarlier = true;- state.itemsKey++;+ showEarlier.value = true;+ itemsKey.value++;await settled();assert@@ -2169,10 +2147,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("focus mode: itemsKey preserves a survivor but resetKey re-picks the tab stop", async function (assert) {- const state = new (class {- @tracked itemsKey = 0;- @tracked resetKey = 0;- })();+ const itemsKey = tracked(0);+ const resetKey = tracked(0);await render(<template>@@ -2181,8 +2157,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {{{dRovingFocusitemSelector="[role=option]"entryFocus="first"- itemsKey=state.itemsKey- resetKey=state.resetKey+ itemsKey=itemsKey.value+ resetKey=resetKey.value}}><button class="a" role="option">A</button>@@ -2193,7 +2169,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {);await focus(".c");- state.itemsKey++;+ itemsKey.value++;await settled();assert@@ -2204,7 +2180,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {"an ordinary item reconciliation keeps the surviving tab stop");- state.resetKey++;+ resetKey.value++;await settled();assert@@ -2493,16 +2469,14 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("focus mode: an item disabled while it holds the tab stop does not keep it", async function (assert) {- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template><div role="listbox" {{dRovingFocus itemSelector="[role=option]"}}><button class="a" role="option">A</button><button- aria-disabled={{if state.disabled "true" "false"}}+ aria-disabled={{if disabled.value "true" "false"}}class="b"role="option">B</button>@@ -2515,7 +2489,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {await triggerKeyEvent(".a", "keydown", "ArrowRight");assert.dom(".b").hasAttribute("tabindex", "0", "b holds the tab stop");- state.disabled = true;+ disabled.value = true;await settled();await focus(".a");await triggerKeyEvent(".a", "keydown", "ArrowRight");@@ -2727,10 +2701,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("focus mode: restoreLostFocus=false leaves a removed cursor on the body", async function (assert) {- const state = new (class {- @tracked items = ["a", "b", "c"];- @tracked itemsKey = 0;- })();+ const items = tracked(["a", "b", "c"]);+ const itemsKey = tracked(0);await render(<template>@@ -2738,11 +2710,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {role="listbox"{{dRovingFocusitemSelector="[role=option]"- itemsKey=state.itemsKey+ itemsKey=itemsKey.valuerestoreLostFocus=false}}>- {{#each state.items key="@identity" as |item|}}+ {{#each items.value key="@identity" as |item|}}<button class="opt-{{item}}" role="option">{{item}}</button>{{/each}}</div>@@ -2750,8 +2722,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {);await focus(".opt-b");- state.items = state.items.filter((item) => item !== "b");- state.itemsKey++;+ items.value = items.value.filter((item) => item !== "b");+ itemsKey.value++;await settled();assert.strictEqual(@@ -2762,11 +2734,9 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("focus mode: a removal declined by the opt-out is forgotten, not deferred", async function (assert) {- const state = new (class {- @tracked items = ["a", "b", "c"];- @tracked itemsKey = 0;- @tracked restore = false;- })();+ const items = tracked(["a", "b", "c"]);+ const itemsKey = tracked(0);+ const restore = tracked(false);await render(<template>@@ -2774,11 +2744,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {role="listbox"{{dRovingFocusitemSelector="[role=option]"- itemsKey=state.itemsKey- restoreLostFocus=state.restore+ itemsKey=itemsKey.value+ restoreLostFocus=restore.value}}>- {{#each state.items key="@identity" as |item|}}+ {{#each items.value key="@identity" as |item|}}<button class="opt-{{item}}" role="option">{{item}}</button>{{/each}}</div>@@ -2786,12 +2756,12 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {);await focus(".opt-b");- state.items = state.items.filter((item) => item !== "b");- state.itemsKey++;+ items.value = items.value.filter((item) => item !== "b");+ itemsKey.value++;await settled();- state.restore = true;- state.itemsKey++;+ restore.value = true;+ itemsKey.value++;await settled();assert.strictEqual(@@ -2881,19 +2851,16 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("focus mode: replacing the whole item set does not move focus", async function (assert) {- class State {- @tracked items = ["a", "b", "c"];- @tracked key = 0;- }- const state = new State();+ const items = tracked(["a", "b", "c"]);+ const key = tracked(0);await render(<template><divrole="listbox"- {{dRovingFocus itemSelector="[role=option]" itemsKey=state.key}}+ {{dRovingFocus itemSelector="[role=option]" itemsKey=key.value}}>- {{#each state.items key="@identity" as |item|}}+ {{#each items.value key="@identity" as |item|}}<button class="opt-{{item}}" role="option">{{item}}</button>{{/each}}</div>@@ -2901,8 +2868,8 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {);await focus(".opt-b");- state.items = ["x", "y", "z"];- state.key++;+ items.value = ["x", "y", "z"];+ key.value++;await settled();// Every previous item is gone, so this is a new question rather than a deletion. Seeding@@ -3062,9 +3029,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("active mode: a changed activeClass is removed from the row that had it", async function (assert) {- const state = new (class {- @tracked cls = "--active";- })();+ const cls = tracked("--active");await render(<template>@@ -3076,7 +3041,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {focusStrategy="active-descendant"controllerElement=".search"itemSelector="[role=option]"- activeClass=state.cls+ activeClass=cls.valueentryFocus="first"}}>@@ -3088,7 +3053,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {assert.dom(".a").hasClass("--active", "seeded with the first class");- state.cls = "--highlight";+ cls.value = "--highlight";await settled();assert.dom(".a").hasClass("--highlight", "the new class is applied");@@ -3098,9 +3063,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("switching focusStrategy leaves no state from the previous mode", async function (assert) {- const state = new (class {- @tracked mode = "active-descendant";- })();+ const mode = tracked("active-descendant");await render(<template>@@ -3108,7 +3071,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {<divrole="listbox"{{dRovingFocus- focusStrategy=state.mode+ focusStrategy=mode.valuecontrollerElement=".search"itemSelector="[role=option]"activeClass="--active"@@ -3123,7 +3086,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {assert.dom(".a").hasClass("--active", "active mode seeded a highlight");- state.mode = "roving-tabindex";+ mode.value = "roving-tabindex";await settled();assert@@ -3452,9 +3415,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {test("Enter does not activate a row that has become disabled under the cursor", async function (assert) {const activated = [];const onActivate = (item) => activated.push(item.className);- const state = new (class {- @tracked disabled = false;- })();+ const disabled = tracked(false);await render(<template>@@ -3467,7 +3428,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {}}><button- aria-disabled={{if state.disabled "true" "false"}}+ aria-disabled={{if disabled.value "true" "false"}}class="a"role="option">A</button>@@ -3479,7 +3440,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {await focus(".a");// `aria-disabled` does not remove focusability, so the row keeps DOM focus and stays the// cursor's position even though it is no longer a legal target.- state.disabled = true;+ disabled.value = true;await settled();await triggerKeyEvent(".a", "keydown", "Enter");@@ -3919,13 +3880,11 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {});test("changing itemSelector releases the items it no longer matches", async function (assert) {- const state = new (class {- @tracked selector = ".one";- })();+ const selector = tracked(".one");await render(<template>- <div role="listbox" {{dRovingFocus itemSelector=state.selector}}>+ <div role="listbox" {{dRovingFocus itemSelector=selector.value}}><button class="one a" role="option">A</button><button class="two b" role="option">B</button></div>@@ -3934,7 +3893,7 @@ module("Integration | ui-kit | Modifier | dRovingFocus", function (hooks) {assert.dom(".a").hasAttribute("tabindex", "0", "the first set is seeded");- state.selector = ".two";+ selector.value = ".two";await settled();assertdiff --git a/frontend/discourse/tests/integration/ui-kit/modifiers/d-scroll-edges-test.gjs b/frontend/discourse/tests/integration/ui-kit/modifiers/d-scroll-edges-test.gjsindex 7735ef3043c..f98040aa58b 100644--- a/frontend/discourse/tests/integration/ui-kit/modifiers/d-scroll-edges-test.gjs+++ b/frontend/discourse/tests/integration/ui-kit/modifiers/d-scroll-edges-test.gjs@@ -145,18 +145,14 @@ module("Integration | ui-kit | Modifier | dScrollEdges", function (hooks) {});test("follows an axis change", async function (assert) {- class AxisState {- @tracked axis = "horizontal";- }-- const state = new AxisState();+ const axis = tracked("horizontal");await render(<template><divclass="axis-changing-strip"style="width: 100px; height: 100px; overflow: auto"- {{dScrollEdges axis=state.axis}}+ {{dScrollEdges axis=axis.value}}><div style="width: 300px; height: 300px"></div></div>@@ -172,7 +168,7 @@ module("Integration | ui-kit | Modifier | dScrollEdges", function (hooks) {"the initial axis is horizontal");- state.axis = "vertical";+ axis.value = "vertical";await settled();await nextFrame();diff --git a/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs b/plugins/chat/test/javascripts/components/chat-header-icon-test.gjsindex ec21446b9b6..5a2bb36cadd 100644--- a/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs@@ -44,15 +44,11 @@ module("Component | ChatHeaderIcon", function (hooks) {});test("mobile", async function (assert) {- const testState = new (class {- @tracked isActive = false;- })();+ const isActive = tracked(false);forceMobile();- await render(- <template><Icon @isActive={{testState.isActive}} /></template>- );+ await render(<template><Icon @isActive={{isActive.value}} /></template>);assert.dom(".icon.btn-flat")@@ -63,7 +59,7 @@ module("Component | ChatHeaderIcon", function (hooks) {.dom(".d-icon-d-chat").exists("chat icon is rendered if chat is inactive");- testState.isActive = true;+ isActive.value = true;await settled();assert.dom(".d-icon-d-chat")diff --git a/plugins/chat/test/javascripts/components/chat-pinned-message-bar-test.gjs b/plugins/chat/test/javascripts/components/chat-pinned-message-bar-test.gjsindex 76e47bdddae..c7236357739 100644--- a/plugins/chat/test/javascripts/components/chat-pinned-message-bar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-pinned-message-bar-test.gjs@@ -351,16 +351,14 @@ module("Component | ChatPinnedMessageBar", function (hooks) {pinResponse(this.channel, 3));// message ids: 202 (excerpt 0, newest) / 201 (excerpt 1) / 200 (excerpt 2)- const view = new (class {- @tracked bottomId = null;- })();+ const bottomId = tracked(null);await render(<template><ChatPinnedMessageBar@channel={{this.channel}}@onJumpToMessage={{this.noop}}- @viewportBottomMessageId={{view.bottomId}}+ @viewportBottomMessageId={{bottomId.value}}/></template>);@@ -369,13 +367,13 @@ module("Component | ChatPinnedMessageBar", function (hooks) {.dom(".chat-pinned-bar__excerpt").hasText("Pinned excerpt 0", "defaults to the newest pin");- view.bottomId = 201;+ bottomId.value = 201;await settled();assert.dom(".chat-pinned-bar__excerpt").hasText("Pinned excerpt 1", "follows the pin governing the view");- view.bottomId = 100; // above every pin+ bottomId.value = 100; // above every pinawait settled();assert.dom(".chat-pinned-bar__excerpt")diff --git a/plugins/discourse-ai/test/javascripts/integration/components/ai-helper-custom-prompt-test.gjs b/plugins/discourse-ai/test/javascripts/integration/components/ai-helper-custom-prompt-test.gjsindex cd17868c4d4..e4e92cf4979 100644--- a/plugins/discourse-ai/test/javascripts/integration/components/ai-helper-custom-prompt-test.gjs+++ b/plugins/discourse-ai/test/javascripts/integration/components/ai-helper-custom-prompt-test.gjs@@ -4,19 +4,14 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import AiHelperCustomPrompt from "discourse/plugins/discourse-ai/discourse/components/ai-helper-custom-prompt";-class TestState {- @tracked value = "test";-}-module("Integration | Component | AiHelperCustomPrompt", function (hooks) {setupRenderingTest(hooks);async function renderPrompt(submit, initialValue = "test") {- const state = new TestState();- state.value = initialValue;+ const promptValue = tracked(initialValue);await render(<template>- <AiHelperCustomPrompt @submit={{submit}} @value={{state.value}} />+ <AiHelperCustomPrompt @submit={{submit}} @value={{promptValue.value}} /></template>);}diff --git a/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjs b/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjsindex 2404e36c78f..fcefcfc4898 100644--- a/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjs+++ b/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjs@@ -116,13 +116,9 @@ module("Integration | Component | DataExplorerChart", function (hooks) {});test("re-rendering before the chart library loads creates a single chart", async function (assert) {- class State {- @tracked labels = ["a", "b"];- }-- const state = new State();+ const labels = tracked(["a", "b"]);const datasets = [{ label: "count", values: [1, 2] }];- const relabel = () => (state.labels = ["c", "d"]);+ const relabel = () => (labels.value = ["c", "d"]);const Chart = await loadChartJS();await render(@@ -130,7 +126,7 @@ module("Integration | Component | DataExplorerChart", function (hooks) {<DataExplorerChart@chartType="bar"@datasets={{datasets}}- @labels={{state.labels}}+ @labels={{labels.value}}@stacked={{false}}/><AfterRender @run={{relabel}} />@@ -153,20 +149,16 @@ module("Integration | Component | DataExplorerChart", function (hooks) {});test("does not build a chart when destroyed before the chart library loads", async function (assert) {- class State {- @tracked shown = true;- }-- const state = new State();+ const shown = tracked(true);const datasets = [{ label: "count", values: [1, 2] }];const labels = ["a", "b"];- const hide = () => (state.shown = false);+ const hide = () => (shown.value = false);const Chart = await loadChartJS();const before = Object.keys(Chart.instances).length;await render(<template>- {{#if state.shown}}+ {{#if shown.value}}<DataExplorerChart@chartType="bar"@datasets={{datasets}}diff --git a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjs b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjsindex 7b1eafd5b37..8b4540b0842 100644--- a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjs+++ b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjs@@ -29,18 +29,11 @@ module("payment-options", function (hooks) {},];- class State {- @tracked selectedPlan;- }-- const testState = new State();+ const selectedPlan = tracked(undefined);await render(<template>- <PaymentOptions- @plans={{plans}}- @selectedPlan={{testState.selectedPlan}}- />+ <PaymentOptions @plans={{plans}} @selectedPlan={{selectedPlan.value}} /></template>);diff --git a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjs b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjsindex 60675d9885e..aff50ec591f 100644--- a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjs+++ b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjs@@ -42,15 +42,11 @@ module("payment-plan", function (hooks) {amountDollars: "3.99",};- class State {- @tracked selectedPlan;- }-- const testState = new State();+ const selectedPlan = tracked(undefined);await render(<template>- <PaymentPlan @plan={{plan}} @selectedPlan={{testState.selectedPlan}} />+ <PaymentPlan @plan={{plan}} @selectedPlan={{selectedPlan.value}} /></template>);diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/canvas/sticky-note-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/canvas/sticky-note-test.gjsindex 97f4a12e2aa..33744f619cd 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/canvas/sticky-note-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/canvas/sticky-note-test.gjs@@ -564,18 +564,16 @@ module(const translates = [];// The note the user grabbed is replaced on every move, the way the canvas// replaces it, so a stale read of the previous object would show up here.- const state = new (class {- @tracked note = noteFixture();- })();+ const note = tracked(noteFixture());const onMove = (position) => {- state.note = { ...state.note, position: { ...position } };+ note.value = { ...note.value, position: { ...position } };};const onTranslateSelected = (dx, dy) => translates.push([dx, dy]);await render(<template><StickyNote- @note={{state.note}}+ @note={{note.value}}@onMove={{onMove}}@onTranslateSelected={{onTranslateSelected}}@zoom={{1}}diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/category-control-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/category-control-test.gjsindex 4e557e2a2ed..2a122689431 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/category-control-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/category-control-test.gjs@@ -6,18 +6,6 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";import CategoryControl from "discourse/plugins/discourse-workflows/admin/components/workflows/configurators/category-control";-class TestField {- @tracked value;-- constructor(value) {- this.value = value;- }-- set(newValue) {- this.value = newValue;- }-}-function regularCategories() {return Category.list().filter((category) => !category.isUncategorizedCategory@@ -30,7 +18,7 @@ module(setupRenderingTest(hooks);test("stores one category id string by default", async function (assert) {- this.field = new TestField("");+ this.field = tracked("");await render(<template>@@ -50,7 +38,7 @@ module(});test("stores an array of category ids when configured as multiple", async function (assert) {- this.field = new TestField([]);+ this.field = tracked([]);this.schema = { type: "array", ui: { multiple: true } };await render(@@ -78,7 +66,7 @@ module(test("hydrates selected categories from stored ids", async function (assert) {const category = regularCategories()[0];- this.field = new TestField([category.id]);+ this.field = tracked([category.id]);this.schema = { type: "array", ui: { multiple: true } };await render(@@ -103,7 +91,7 @@ module(test("ignores non-numeric stored entries when hydrating", async function (assert) {const category = regularCategories()[0];- this.field = new TestField(["=$json.category_ids", category.id]);+ this.field = tracked(["=$json.category_ids", category.id]);this.schema = { type: "array", ui: { multiple: true } };await render(diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/expression-wrapper-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/expression-wrapper-test.gjsindex 55c294051c9..842e346b53e 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/expression-wrapper-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/expression-wrapper-test.gjs@@ -16,18 +16,6 @@ function variableTransfer(variable) {};}-class TestField {- @tracked value;-- constructor(value) {- this.value = value;- }-- set(newValue) {- this.value = newValue;- }-}-module("Integration | Component | Workflows | ExpressionWrapper",function (hooks) {@@ -124,7 +112,7 @@ module(});test("appends a variable when dropping on the mode control", async function (assert) {- this.field = new TestField("Existing prompt");+ this.field = tracked("Existing prompt");this.schema = { type: "string" };await render(@@ -156,7 +144,7 @@ module(});test("preserves populated single-line text controls", async function (assert) {- this.field = new TestField("Existing title");+ this.field = tracked("Existing title");this.schema = { type: "string" };await render(@@ -188,7 +176,7 @@ module(});test("keeps replacement behavior for string-valued non-text controls", async function (assert) {- this.field = new TestField("first");+ this.field = tracked("first");this.schema = { type: "string" };await render(@@ -220,7 +208,7 @@ module(});test("converts fixed arrays to whole expressions", async function (assert) {- this.field = new TestField(["sam", "alice"]);+ this.field = tracked(["sam", "alice"]);this.schema = { type: "array" };await render(@@ -247,7 +235,7 @@ module(});test("converts comma-separated dynamic values to fixed arrays", async function (assert) {- this.field = new TestField("=sam,alice");+ this.field = tracked("=sam,alice");this.schema = { type: "array" };await render(@@ -274,7 +262,7 @@ module(});test("converts dynamic array literals to fixed arrays", async function (assert) {- this.field = new TestField('={{ ["sam","alice"] }}');+ this.field = tracked('={{ ["sam","alice"] }}');this.schema = { type: "array" };await render(diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/group-select-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/group-select-test.gjsindex b3c41df9e35..669a080a6ed 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/group-select-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/group-select-test.gjs@@ -5,23 +5,11 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import selectKit from "discourse/tests/helpers/select-kit-helper";import GroupSelect from "discourse/plugins/discourse-workflows/admin/components/workflows/configurators/group-select";-class TestField {- @tracked value;-- constructor(value) {- this.value = value;- }-- set(newValue) {- this.value = newValue;- }-}-module("Integration | Component | Workflows | GroupSelect", function (hooks) {setupRenderingTest(hooks);test("stores selected group names when configured as multiple", async function (assert) {- this.field = new TestField([]);+ this.field = tracked([]);this.schema = {type_options: {load_options_method: "groups",diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/topic-control-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/topic-control-test.gjsindex 92003f3ec4c..c547471a850 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/topic-control-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/topic-control-test.gjs@@ -11,18 +11,6 @@ const TOPICS = [{ id: 34, title: "Cube leaderboard", fancy_title: "Cube leaderboard" },];-class TestField {- @tracked value;-- constructor(value) {- this.value = value;- }-- set(newValue) {- this.value = newValue;- }-}-function searchResponse(term) {const topics = TOPICS.filter((topic) =>@@ -42,7 +30,7 @@ function searchResponse(term) {}async function renderControl(context, value) {- context.field = new TestField(value);+ context.field = tracked(value);await render(<template>diff --git a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/user-control-test.gjs b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/user-control-test.gjsindex 5f4498a530d..e62684f8699 100644--- a/plugins/discourse-workflows/test/javascripts/integration/components/workflows/user-control-test.gjs+++ b/plugins/discourse-workflows/test/javascripts/integration/components/workflows/user-control-test.gjs@@ -6,18 +6,6 @@ import pretender, { response } from "discourse/tests/helpers/create-pretender";import selectKit from "discourse/tests/helpers/select-kit-helper";import UserControl from "discourse/plugins/discourse-workflows/admin/components/workflows/configurators/user-control";-class TestField {- @tracked value;-- constructor(value) {- this.value = value;- }-- set(newValue) {- this.value = newValue;- }-}-module("Integration | Component | Workflows | UserControl", function (hooks) {setupRenderingTest(hooks);@@ -33,7 +21,7 @@ module("Integration | Component | Workflows | UserControl", function (hooks) {});test("stores one username by default", async function (assert) {- this.field = new TestField("");+ this.field = tracked("");await render(<template>@@ -50,7 +38,7 @@ module("Integration | Component | Workflows | UserControl", function (hooks) {});test("stores all selected usernames when configured as multiple", async function (assert) {- this.field = new TestField([]);+ this.field = tracked([]);this.schema = { ui: { multiple: true } };await render(diff --git a/plugins/styleguide/test/javascripts/integration/components/styleguide-groups-test.gjs b/plugins/styleguide/test/javascripts/integration/components/styleguide-groups-test.gjsindex 2de4f94b3d1..f0d9e58695a 100644--- a/plugins/styleguide/test/javascripts/integration/components/styleguide-groups-test.gjs+++ b/plugins/styleguide/test/javascripts/integration/components/styleguide-groups-test.gjs@@ -284,14 +284,12 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {// failure. The `scrollTop()` in the same handler is deliberately NOT claimed here: it// early-returns under `isTesting()`, so no test can observe it.test("swapping the active group swaps the rendered body", async function (assert) {- const state = new (class {- @tracked active = "start";- })();+ const active = tracked("start");await render(<template><StyleguideGroups- @active={{state.active}}+ @active={{active.value}}@groups={{GROUPS}}@section={{SECTION}}as |Group|@@ -304,7 +302,7 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {assert.dom("[data-test-styleguide-group='start']").exists();- state.active = "data";+ active.value = "data";await settled();assert.dom("[data-test-styleguide-group='data']").exists();@@ -323,14 +321,12 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {// mid-sentence, and a message-only assertion would not notice.a11y.announce = (message, type) => announced.push([message, type]);- const state = new (class {- @tracked active = "start";- })();+ const active = tracked("start");await render(<template><StyleguideGroups- @active={{state.active}}+ @active={{active.value}}@groups={{GROUPS}}@section={{SECTION}}as |Group|@@ -343,7 +339,7 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {assert.deepEqual(announced, [], "nothing is announced on first render");- state.active = "data";+ active.value = "data";await settled();assert.deepEqual(@@ -357,14 +353,12 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {// group, that node unmounts with the group, focus falls to <body>, and only then is it ours// to recover.test("restores focus when the outgoing group took it down with it", async function (assert) {- const state = new (class {- @tracked active = "start";- })();+ const active = tracked("start");await render(<template><StyleguideGroups- @active={{state.active}}+ @active={{active.value}}@groups={{GROUPS}}@section={{SECTION}}as |Group|@@ -381,7 +375,7 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {await focus("#inside");assert.dom("#inside").isFocused("precondition: focus is inside the group");- state.active = "data";+ active.value = "data";await settled();assert.dom("[data-test-styleguide-group='data']").isFocused();@@ -390,14 +384,12 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {// The other half of the guard. Focus that SURVIVES the swap is not ours to move — taking it// would yank the reader out of the subnav they are still using.test("leaves surviving focus alone", async function (assert) {- const state = new (class {- @tracked active = "start";- })();+ const active = tracked("start");await render(<template><StyleguideGroups- @active={{state.active}}+ @active={{active.value}}@groups={{GROUPS}}@section={{SECTION}}as |Group|@@ -410,7 +402,7 @@ module("Integration | Component | <StyleguideGroups />", function (hooks) {await focus("[data-test-styleguide-subnav-link='data']");- state.active = "data";+ active.value = "data";await settled();assertdiff --git a/plugins/styleguide/test/javascripts/integration/components/styleguide-section-test.gjs b/plugins/styleguide/test/javascripts/integration/components/styleguide-section-test.gjsindex 00bfccdcfe9..7f140c47824 100644--- a/plugins/styleguide/test/javascripts/integration/components/styleguide-section-test.gjs+++ b/plugins/styleguide/test/javascripts/integration/components/styleguide-section-test.gjs@@ -5,24 +5,20 @@ import sinon from "sinon";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import StyleguideSection from "discourse/plugins/styleguide/discourse/components/styleguide-section";-class State {- @tracked section = { id: "colors", category: "atoms" };-}-module("Integration | Component | StyleguideSection", function (hooks) {setupRenderingTest(hooks);test("scrolls to the top whenever another section is shown", async function (assert) {const scrollTo = sinon.stub(window, "scrollTo");- const state = new State();+ const section = tracked({ id: "colors", category: "atoms" });await render(- <template><StyleguideSection @section={{state.section}} /></template>+ <template><StyleguideSection @section={{section.value}} /></template>);assert.strictEqual(scrollTo.callCount, 1, "scrolls when first shown");- state.section = { id: "icons", category: "atoms" };+ section.value = { id: "icons", category: "atoms" };await settled();assert.strictEqual(scrollTo.callCount, 2, "scrolls on a section change");