mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
Why this change? The previous test setup did not actually act as a regression test because the test will still pass even when the fix is removed. This commit uses a rendering test instead to ensure that Ember is tracking the property change.
25 lines
744 B
Plaintext
25 lines
744 B
Plaintext
import { render, settled } from "@ember/test-helpers";
|
|
import { setupRenderingTest } from "ember-qunit";
|
|
import { module, test } from "qunit";
|
|
import { ExtraNavItem } from "discourse/models/nav-item";
|
|
|
|
module("Unit | Model | extra-nav-item", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("displayName updates when count property changes", async function (assert) {
|
|
const extraNavItem = ExtraNavItem.create({
|
|
name: "something",
|
|
});
|
|
|
|
await render(<template><p>{{extraNavItem.displayName}}</p></template>);
|
|
|
|
assert.dom("p").hasText("[en.filters.something.title count=0]");
|
|
|
|
extraNavItem.count = 2;
|
|
|
|
await settled();
|
|
|
|
assert.dom("p").hasText("[en.filters.something.title_with_count count=2]");
|
|
});
|
|
});
|