DEV: Set `ExtraNavItem` count property to be a tracked property (#25806)
Why this change?
This regressed in b797434376
where
the count property in `ExtraNavItem` needs to be tracked as plugins can
be updating the count property directly.
This commit is contained in:
parent
31e44cfa82
commit
5dba5c4208
|
@ -325,9 +325,9 @@ export default class NavItem extends EmberObject {
|
|||
}
|
||||
}
|
||||
|
||||
class ExtraNavItem extends NavItem {
|
||||
export class ExtraNavItem extends NavItem {
|
||||
@tracked href;
|
||||
count = 0;
|
||||
@tracked count = 0;
|
||||
customFilter = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import { setupTest } from "ember-qunit";
|
||||
import { module, test } from "qunit";
|
||||
import { ExtraNavItem } from "discourse/models/nav-item";
|
||||
|
||||
module("Unit | Model | extra-nav-item", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test("displayName updates when count property changes", function (assert) {
|
||||
const extraNavItem = ExtraNavItem.create({
|
||||
name: "something",
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
extraNavItem.displayName,
|
||||
"[en.filters.something.title count=0]"
|
||||
);
|
||||
|
||||
extraNavItem.count = 2;
|
||||
|
||||
assert.strictEqual(
|
||||
extraNavItem.displayName,
|
||||
"[en.filters.something.title_with_count count=2]"
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue