Skip to content

Commit 01736fc

Browse files
vvlisnvinhuang
andauthored
Fix percent rollout inputs (#17558)
* Fix percent rollout inputs * Address rollout input test feedback --------- Co-authored-by: vinhuang <vinhuang@starbucks.com>
1 parent 36d08e4 commit 01736fc

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

shell/edit/workload/Upgrading.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ export default {
133133
} = this;
134134
let { maxSurge, maxUnavailable } = this;
135135
136-
if (this.surgeUnits === '%' && !maxSurge.includes('%')) {
136+
if (this.surgeUnits === '%' && !`${ maxSurge }`.includes('%')) {
137137
maxSurge = `${ maxSurge }%`;
138138
}
139-
if (this.unavailableUnits === '%' && !maxUnavailable.includes('%')) {
139+
if (this.unavailableUnits === '%' && !`${ maxUnavailable }`.includes('%')) {
140140
maxUnavailable = `${ maxUnavailable }%`;
141141
}
142142
@@ -204,7 +204,7 @@ export default {
204204
if (units === 'Pods') {
205205
this[target] = parseInt(value);
206206
} else {
207-
this[target] = `${ value }%`;
207+
this[target] = value;
208208
}
209209
if (target === 'maxSurge') {
210210
this.surgeUnits = units;

shell/edit/workload/__tests__/Upgrading.test.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,17 @@ describe('component: Upgrading', () => {
2525
expect(wrapper.props('value')?.[key]).toBe(newValue);
2626
});
2727

28-
// TODO: #6179: Integrate test with component fix, as the scope is not to check the value of the input
29-
// eslint-disable-next-line jest/no-disabled-tests
30-
it.skip.each([
31-
['surge', 'maxSurge', '%'],
32-
['unavailable', 'maxUnavailable', '%'],
33-
])('should set typed value in %p into %p and unit', (field, key, unit) => {
28+
it.each([
29+
['maxSurge', '%'],
30+
['maxUnavailable', '%'],
31+
])('should set typed value in %p with %p unit', (key, unit) => {
3432
const wrapper = mount(Upgrading);
35-
const input = wrapper.find(`[data-testid="input-policy-${ field }"]`).find('input');
3633
const newValue = 123;
3734
const expectation = `${ newValue }${ unit }`;
3835

39-
input.setValue(newValue);
40-
input.trigger('blur');
36+
wrapper.vm.updateWithUnits({ selected: unit, text: newValue }, key);
4137

38+
expect(wrapper.vm[key]).toBe(newValue);
4239
expect(wrapper.props('value')?.strategy.rollingUpdate[key]).toBe(expectation);
4340
});
4441

0 commit comments

Comments
 (0)