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 { ...@@ -219,7 +219,7 @@ export default {
class="gl-px-3" class="gl-px-3"
> >
<gl-dropdown-item <gl-dropdown-item
v-for="time in $options.HOURS_IN_DAY" v-for="(_, time) in $options.HOURS_IN_DAY"
:key="time" :key="time"
:is-checked="form.startsAt.time === time" :is-checked="form.startsAt.time === time"
is-check-item is-check-item
...@@ -278,7 +278,7 @@ export default { ...@@ -278,7 +278,7 @@ export default {
class="gl-px-3" class="gl-px-3"
> >
<gl-dropdown-item <gl-dropdown-item
v-for="time in $options.HOURS_IN_DAY" v-for="(_, time) in $options.HOURS_IN_DAY"
:key="time" :key="time"
:is-checked="form.endsAt.time === time" :is-checked="form.endsAt.time === time"
is-check-item is-check-item
......
...@@ -112,11 +112,12 @@ describe('AddEditRotationForm', () => { ...@@ -112,11 +112,12 @@ describe('AddEditRotationForm', () => {
}); });
it('should emit an event with selected value on time selection', async () => { 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(); await wrapper.vm.$nextTick();
const emittedEvent = wrapper.emitted('update-rotation-form'); const emittedEvent = wrapper.emitted('update-rotation-form');
expect(emittedEvent).toHaveLength(1); 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 () => { it('should add a checkmark to a selected start time', async () => {
...@@ -133,11 +134,7 @@ describe('AddEditRotationForm', () => { ...@@ -133,11 +134,7 @@ describe('AddEditRotationForm', () => {
}, },
}); });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findStartsOnTimeOptions().at(time).props('isChecked')).toBe(true);
findStartsOnTimeOptions()
.at(time - 1)
.props('isChecked'),
).toBe(true);
}); });
}); });
...@@ -160,7 +157,7 @@ describe('AddEditRotationForm', () => { ...@@ -160,7 +157,7 @@ describe('AddEditRotationForm', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const emittedEvent = wrapper.emitted('update-rotation-form'); const emittedEvent = wrapper.emitted('update-rotation-form');
expect(emittedEvent).toHaveLength(1); 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 () => { it('should add a checkmark to a selected end time', async () => {
...@@ -181,11 +178,7 @@ describe('AddEditRotationForm', () => { ...@@ -181,11 +178,7 @@ describe('AddEditRotationForm', () => {
}, },
}); });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findEndsOnTimeOptions().at(time).props('isChecked')).toBe(true);
findEndsOnTimeOptions()
.at(time - 1)
.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