diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/color_select_dropdown/color_select_root_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/color_select_dropdown/color_select_root_spec.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/spec/frontend/vue_shared/components/color_select_dropdown/color_select_root_spec.js b/spec/frontend/vue_shared/components/color_select_dropdown/color_select_root_spec.js index 93b59800c27..441e21ee905 100644 --- a/spec/frontend/vue_shared/components/color_select_dropdown/color_select_root_spec.js +++ b/spec/frontend/vue_shared/components/color_select_dropdown/color_select_root_spec.js @@ -84,15 +84,15 @@ describe('LabelsSelectRoot', () => { }); describe('if the variant is `sidebar`', () => { - beforeEach(() => { + it('renders SidebarEditableItem component', () => { createComponent(); - }); - it('renders SidebarEditableItem component', () => { expect(findSidebarEditableItem().exists()).toBe(true); }); it('renders correct props for the SidebarEditableItem component', () => { + createComponent(); + expect(findSidebarEditableItem().props()).toMatchObject({ title: wrapper.vm.$options.i18n.widgetTitle, canEdit: defaultProps.allowEdit, @@ -135,7 +135,7 @@ describe('LabelsSelectRoot', () => { it('handles DropdownContents setColor', () => { findDropdownContents().vm.$emit('setColor', color); - expect(wrapper.emitted('updateSelectedColor')).toEqual([[color]]); + expect(wrapper.emitted('updateSelectedColor')).toEqual([[{ color }]]); }); }); @@ -157,20 +157,24 @@ describe('LabelsSelectRoot', () => { createComponent({ propsData: { iid: undefined } }); findDropdownContents().vm.$emit('setColor', color); - expect(wrapper.emitted('updateSelectedColor')).toEqual([[color]]); + expect(wrapper.emitted('updateSelectedColor')).toEqual([[{ color }]]); }); describe('when updating color for epic', () => { - beforeEach(() => { + const setup = () => { createComponent(); findDropdownContents().vm.$emit('setColor', color); - }); + }; it('sets the loading state', () => { + setup(); + expect(findSidebarEditableItem().props('loading')).toBe(true); }); it('updates color correctly after successful mutation', async () => { + setup(); + await waitForPromises(); expect(findDropdownValue().props('selectedColor').color).toEqual( updateColorMutationResponse.data.updateIssuableColor.issuable.color, |