0
Fork 0
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:
Rish 2020-07-07 13:24:00 +05:30 committed by Rishabh Garg
parent 182663bdf8
commit f8b2092f6c
3 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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);
}, },

View file

@ -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 () {