Skip to content

Commit

Permalink
Merge pull request #939 from harvester/mergify/bp/release-harvester-v…
Browse files Browse the repository at this point in the history
…1.2/pr-927

Resource Quota up-and-down input doesn't update the value on the requ… (backport #927)
  • Loading branch information
bk201 committed Jan 25, 2024
2 parents 241ca0b + ccd3278 commit 0ab6c2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ export default (
}
},
/**
* Emit on input change
*/
onChange(event: Event): void {
this.$emit('change', event);
},
/**
* Emit on input with delay. Note: Arrow function is avoided due context
* binding.
Expand Down Expand Up @@ -299,6 +306,7 @@ export default (
@input="onInput($event.target.value)"
@focus="onFocus"
@blur="onBlur"
@change="onChange"
>
</slot>

Expand Down
1 change: 1 addition & 0 deletions shell/components/form/UnitInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export default {
:required="required"
:placeholder="placeholder"
:hide-arrows="hideArrows"
@change="update($event.target.value)"
@blur="update($event.target.value)"
>
<template #suffix>
Expand Down
4 changes: 2 additions & 2 deletions shell/components/form/__tests__/UnitInput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ describe('component: UnitInput', () => {
expect(wrapper.isVisible()).toBe(true);
});

it('should emit input event on value change', async() => {
it.each(['blur', 'change'])('should emit input event when "%p" is fired', async(event) => {
const wrapper = mount(UnitInput, { propsData: { value: 1, delay: 0 } });
const input = wrapper.find('input');

await input.setValue(2);
await input.setValue(4);
input.trigger('blur');
input.trigger(event);

expect(wrapper.emitted('input')).toHaveLength(1);
});
Expand Down

0 comments on commit 0ab6c2e

Please sign in to comment.