Commit abec81f9 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska Committed by David O'Regan

Update value in rotation time controls

parent e367975a
......@@ -219,7 +219,7 @@ export default {
class="gl-px-3"
>
<gl-dropdown-item
v-for="time in $options.HOURS_IN_DAY"
v-for="(_, time) in $options.HOURS_IN_DAY"
:key="time"
:is-checked="form.startsAt.time === time"
is-check-item
......@@ -278,7 +278,7 @@ export default {
class="gl-px-3"
>
<gl-dropdown-item
v-for="time in $options.HOURS_IN_DAY"
v-for="(_, time) in $options.HOURS_IN_DAY"
:key="time"
:is-checked="form.endsAt.time === time"
is-check-item
......
......@@ -112,11 +112,12 @@ describe('AddEditRotationForm', () => {
});
it('should emit an event with selected value on time selection', async () => {
findStartsOnTimeOptions().at(3).vm.$emit('click');
const option = 3;
findStartsOnTimeOptions().at(option).vm.$emit('click');
await wrapper.vm.$nextTick();
const emittedEvent = wrapper.emitted('update-rotation-form');
expect(emittedEvent).toHaveLength(1);
expect(emittedEvent[0][0]).toEqual({ type: 'startsAt.time', value: 4 });
expect(emittedEvent[0][0]).toEqual({ type: 'startsAt.time', value: option });
});
it('should add a checkmark to a selected start time', async () => {
......@@ -133,11 +134,7 @@ describe('AddEditRotationForm', () => {
},
});
await wrapper.vm.$nextTick();
expect(
findStartsOnTimeOptions()
.at(time - 1)
.props('isChecked'),
).toBe(true);
expect(findStartsOnTimeOptions().at(time).props('isChecked')).toBe(true);
});
});
......@@ -160,7 +157,7 @@ describe('AddEditRotationForm', () => {
await wrapper.vm.$nextTick();
const emittedEvent = wrapper.emitted('update-rotation-form');
expect(emittedEvent).toHaveLength(1);
expect(emittedEvent[0][0]).toEqual({ type: 'endsAt.time', value: option + 1 });
expect(emittedEvent[0][0]).toEqual({ type: 'endsAt.time', value: option });
});
it('should add a checkmark to a selected end time', async () => {
......@@ -181,11 +178,7 @@ describe('AddEditRotationForm', () => {
},
});
await wrapper.vm.$nextTick();
expect(
findEndsOnTimeOptions()
.at(time - 1)
.props('isChecked'),
).toBe(true);
expect(findEndsOnTimeOptions().at(time).props('isChecked')).toBe(true);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment