mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 Fixed nav item not saving updated value on keyboard save
no issue - Fixes nav item values not saving on keyboard save shortcut - Nav items value was only being updated in settings on focus out from text field. - In case of keyboard save, focus out didn't happen so old value got saved and re-populated - Change fixes to update setting value while typing
This commit is contained in:
parent
182663bdf8
commit
f8b2092f6c
3 changed files with 3 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
||||||
@shouldFocus={{this.navItem.last}}
|
@shouldFocus={{this.navItem.last}}
|
||||||
@placeholder="Label"
|
@placeholder="Label"
|
||||||
@value={{readonly this.label}}
|
@value={{readonly this.label}}
|
||||||
@input={{action (mut this.label) value="target.value"}}
|
@input={{action "updateLabel" value="target.value"}}
|
||||||
@keyPress={{action "clearLabelErrors"}}
|
@keyPress={{action "clearLabelErrors"}}
|
||||||
@focus-out={{action "updateLabel" this.label}} data-test-input="label" />
|
@focus-out={{action "updateLabel" this.label}} data-test-input="label" />
|
||||||
<GhErrorMessage
|
<GhErrorMessage
|
||||||
|
|
|
@ -39,6 +39,7 @@ export default Component.extend(ValidationState, {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLabel(value) {
|
updateLabel(value) {
|
||||||
|
this.set('label', value);
|
||||||
return this.updateLabel(value, this.navItem);
|
return this.updateLabel(value, this.navItem);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ describe('Integration: Component: gh-navitem', function () {
|
||||||
await render(hbs`{{gh-navitem navItem=navItem baseUrl=baseUrl updateLabel=(action update)}}`);
|
await render(hbs`{{gh-navitem navItem=navItem baseUrl=baseUrl updateLabel=(action update)}}`);
|
||||||
await triggerEvent('.gh-blognav-label input', 'blur');
|
await triggerEvent('.gh-blognav-label input', 'blur');
|
||||||
|
|
||||||
expect(updateActionCallCount).to.equal(1);
|
expect(updateActionCallCount).to.equal(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('displays inline errors', async function () {
|
it('displays inline errors', async function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue