From d83c512077b9eb391ce1f59349fc7bacc3615e18 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 2 Jan 2020 15:07:40 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/frontend/vue_shared/components/commit_spec.js | 13 +++++++++---- .../components/dropdown/dropdown_search_input_spec.js | 4 +++- .../components/user_avatar/user_avatar_list_spec.js | 7 +++++-- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'spec/frontend/vue_shared') diff --git a/spec/frontend/vue_shared/components/commit_spec.js b/spec/frontend/vue_shared/components/commit_spec.js index 34f3a54fce2..3607d4a0fd3 100644 --- a/spec/frontend/vue_shared/components/commit_spec.js +++ b/spec/frontend/vue_shared/components/commit_spec.js @@ -7,6 +7,11 @@ describe('Commit component', () => { let props; let wrapper; + const findIcon = name => { + const icons = wrapper.findAll(Icon).filter(c => c.attributes('name') === name); + return icons.length ? icons.at(0) : icons; + }; + const findUserAvatar = () => wrapper.find(UserAvatarLink); const createComponent = propsData => { @@ -71,7 +76,7 @@ describe('Commit component', () => { }); it('should render a tag icon if it represents a tag', () => { - expect(wrapper.find('icon-stub[name="tag"]').exists()).toBe(true); + expect(findIcon('tag').exists()).toBe(true); }); it('should render a link to the ref url', () => { @@ -89,7 +94,7 @@ describe('Commit component', () => { }); it('should render icon for commit', () => { - expect(wrapper.find('icon-stub[name="commit"]').exists()).toBe(true); + expect(findIcon('commit').exists()).toBe(true); }); describe('Given commit title and author props', () => { @@ -162,7 +167,7 @@ describe('Commit component', () => { expect(refEl.attributes('title')).toBe(props.commitRef.name); - expect(wrapper.find('icon-stub[name="branch"]').exists()).toBe(true); + expect(findIcon('branch').exists()).toBe(true); }); }); @@ -195,7 +200,7 @@ describe('Commit component', () => { expect(refEl.attributes('title')).toBe(props.mergeRequestRef.title); - expect(wrapper.find('icon-stub[name="git-merge"]').exists()).toBe(true); + expect(findIcon('git-merge').exists()).toBe(true); }); }); diff --git a/spec/frontend/vue_shared/components/dropdown/dropdown_search_input_spec.js b/spec/frontend/vue_shared/components/dropdown/dropdown_search_input_spec.js index 0d0e4ae4349..ffdeb25439c 100644 --- a/spec/frontend/vue_shared/components/dropdown/dropdown_search_input_spec.js +++ b/spec/frontend/vue_shared/components/dropdown/dropdown_search_input_spec.js @@ -49,7 +49,9 @@ describe('DropdownSearchInputComponent', () => { wrapper.setProps({ focused: true }); - expect(inputEl.focus).toHaveBeenCalled(); + return wrapper.vm.$nextTick().then(() => { + expect(inputEl.focus).toHaveBeenCalled(); + }); }); }); }); diff --git a/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js b/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js index 9f0cdc651b6..491e672b0e4 100644 --- a/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js +++ b/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js @@ -147,9 +147,12 @@ describe('UserAvatarList', () => { it('with collapse clicked, it renders avatars up to breakpoint', () => { clickButton(); - const links = wrapper.findAll(UserAvatarLink); - expect(links.length).toEqual(TEST_BREAKPOINT); + return wrapper.vm.$nextTick(() => { + const links = wrapper.findAll(UserAvatarLink); + + expect(links.length).toEqual(TEST_BREAKPOINT); + }); }); }); }); -- cgit v1.2.3