FIX: NavItem and Composer prop overriding was broken (#17092)

This commit is contained in:
Jarek Radosz 2022-06-14 21:16:33 +02:00 committed by GitHub
parent e0364cf228
commit 348b6e848f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 3 deletions

View File

@ -136,7 +136,7 @@ export default Controller.extend({
},
set disableSubmit(value) {
this.set("_disableSubmit", value);
return this.set("_disableSubmit", value);
},
@discourseComputed("showPreview")

View File

@ -27,7 +27,7 @@ const NavItem = EmberObject.extend({
},
set(value) {
this.set("_title", value);
return this.set("_title", value);
},
},
@ -56,7 +56,7 @@ const NavItem = EmberObject.extend({
},
set(value) {
this.set("_displayName", value);
return this.set("_displayName", value);
},
},

View File

@ -57,4 +57,29 @@ module("Unit | Model | nav-item", function (hooks) {
"it updates when a new message arrives"
);
});
test("displayName", function (assert) {
const navItem = createStore().createRecord("nav-item", {
name: "something",
});
assert.strictEqual(
navItem.displayName,
"[en.filters.something.title count=0]"
);
navItem.set("displayName", "Extra Item");
assert.strictEqual(navItem.displayName, "Extra Item");
});
test("title", function (assert) {
const navItem = createStore().createRecord("nav-item", {
name: "something",
});
assert.strictEqual(navItem.title, "[en.filters.something.help]");
navItem.set("title", "Extra Item");
assert.strictEqual(navItem.title, "Extra Item");
});
});