From b085478c4c2bed74fdc6eb2c33bfc62e791baf03 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 1 Jan 2020 06:09:01 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../repository/components/breadcrumbs_spec.js | 8 ++- .../repository/components/last_commit_spec.js | 4 +- .../repository/components/preview/index_spec.js | 8 ++- .../repository/components/table/index_spec.js | 8 +-- .../repository/components/table/row_spec.js | 62 ++++++++++++++-------- 5 files changed, 60 insertions(+), 30 deletions(-) (limited to 'spec/frontend/repository') diff --git a/spec/frontend/repository/components/breadcrumbs_spec.js b/spec/frontend/repository/components/breadcrumbs_spec.js index 707eae34793..bc2abb3db1a 100644 --- a/spec/frontend/repository/components/breadcrumbs_spec.js +++ b/spec/frontend/repository/components/breadcrumbs_spec.js @@ -49,7 +49,9 @@ describe('Repository breadcrumbs component', () => { vm.setData({ userPermissions: { forkProject: false, createMergeRequestIn: false } }); - expect(vm.find(GlDropdown).exists()).toBe(false); + return vm.vm.$nextTick(() => { + expect(vm.find(GlDropdown).exists()).toBe(false); + }); }); it('renders add to tree dropdown when permissions are true', () => { @@ -57,6 +59,8 @@ describe('Repository breadcrumbs component', () => { vm.setData({ userPermissions: { forkProject: true, createMergeRequestIn: true } }); - expect(vm.find(GlDropdown).exists()).toBe(true); + return vm.vm.$nextTick(() => { + expect(vm.find(GlDropdown).exists()).toBe(true); + }); }); }); diff --git a/spec/frontend/repository/components/last_commit_spec.js b/spec/frontend/repository/components/last_commit_spec.js index e07ad4cf46b..c00cdeee05b 100644 --- a/spec/frontend/repository/components/last_commit_spec.js +++ b/spec/frontend/repository/components/last_commit_spec.js @@ -58,7 +58,9 @@ describe('Repository last commit component', () => { `('$label when loading icon $loading is true', ({ loading }) => { factory(createCommitData(), loading); - expect(vm.find(GlLoadingIcon).exists()).toBe(loading); + return vm.vm.$nextTick(() => { + expect(vm.find(GlLoadingIcon).exists()).toBe(loading); + }); }); it('renders commit widget', () => { diff --git a/spec/frontend/repository/components/preview/index_spec.js b/spec/frontend/repository/components/preview/index_spec.js index 0112e6310f4..7587ca4186c 100644 --- a/spec/frontend/repository/components/preview/index_spec.js +++ b/spec/frontend/repository/components/preview/index_spec.js @@ -33,7 +33,9 @@ describe('Repository file preview component', () => { vm.setData({ readme: { html: '
test
' } }); - expect(vm.element).toMatchSnapshot(); + return vm.vm.$nextTick(() => { + expect(vm.element).toMatchSnapshot(); + }); }); it('renders loading icon', () => { @@ -44,6 +46,8 @@ describe('Repository file preview component', () => { vm.setData({ loading: 1 }); - expect(vm.find(GlLoadingIcon).exists()).toBe(true); + return vm.vm.$nextTick(() => { + expect(vm.find(GlLoadingIcon).exists()).toBe(true); + }); }); }); diff --git a/spec/frontend/repository/components/table/index_spec.js b/spec/frontend/repository/components/table/index_spec.js index 41450becabb..9db90839b29 100644 --- a/spec/frontend/repository/components/table/index_spec.js +++ b/spec/frontend/repository/components/table/index_spec.js @@ -53,9 +53,11 @@ describe('Repository table component', () => { vm.setData({ ref }); - expect(vm.find('.table').attributes('aria-label')).toEqual( - `Files, directories, and submodules in the path ${path} for commit reference ${ref}`, - ); + return vm.vm.$nextTick(() => { + expect(vm.find('.table').attributes('aria-label')).toEqual( + `Files, directories, and submodules in the path ${path} for commit reference ${ref}`, + ); + }); }); it('shows loading icon', () => { diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js index 92d1fe5c4b0..067bad0dab6 100644 --- a/spec/frontend/repository/components/table/row_spec.js +++ b/spec/frontend/repository/components/table/row_spec.js @@ -46,7 +46,9 @@ describe('Repository table row component', () => { currentPath: '/', }); - expect(vm.element).toMatchSnapshot(); + return vm.vm.$nextTick().then(() => { + expect(vm.element).toMatchSnapshot(); + }); }); it.each` @@ -63,7 +65,9 @@ describe('Repository table row component', () => { currentPath: '/', }); - expect(vm.find(component).exists()).toBe(true); + return vm.vm.$nextTick().then(() => { + expect(vm.find(component).exists()).toBe(true); + }); }); it.each` @@ -80,13 +84,15 @@ describe('Repository table row component', () => { currentPath: '/', }); - vm.trigger('click'); + return vm.vm.$nextTick().then(() => { + vm.trigger('click'); - if (pushes) { - expect($router.push).toHaveBeenCalledWith({ path: '/tree/master/test' }); - } else { - expect($router.push).not.toHaveBeenCalled(); - } + if (pushes) { + expect($router.push).toHaveBeenCalledWith({ path: '/tree/master/test' }); + } else { + expect($router.push).not.toHaveBeenCalled(); + } + }); }); it.each` @@ -103,15 +109,17 @@ describe('Repository table row component', () => { currentPath: '/', }); - vm.trigger('click'); + return vm.vm.$nextTick().then(() => { + vm.trigger('click'); - if (pushes) { - expect(visitUrl).not.toHaveBeenCalled(); - } else { - const [url, external] = visitUrl.mock.calls[0]; - expect(url).toBe('https://test.com'); - expect(external).toBeFalsy(); - } + if (pushes) { + expect(visitUrl).not.toHaveBeenCalled(); + } else { + const [url, external] = visitUrl.mock.calls[0]; + expect(url).toBe('https://test.com'); + expect(external).toBeFalsy(); + } + }); }); it('renders commit ID for submodule', () => { @@ -123,7 +131,9 @@ describe('Repository table row component', () => { currentPath: '/', }); - expect(vm.find('.commit-sha').text()).toContain('1'); + return vm.vm.$nextTick().then(() => { + expect(vm.find('.commit-sha').text()).toContain('1'); + }); }); it('renders link with href', () => { @@ -136,7 +146,9 @@ describe('Repository table row component', () => { currentPath: '/', }); - expect(vm.find('a').attributes('href')).toEqual('https://test.com'); + return vm.vm.$nextTick().then(() => { + expect(vm.find('a').attributes('href')).toEqual('https://test.com'); + }); }); it('renders LFS badge', () => { @@ -149,7 +161,9 @@ describe('Repository table row component', () => { lfsOid: '1', }); - expect(vm.find(GlBadge).exists()).toBe(true); + return vm.vm.$nextTick().then(() => { + expect(vm.find(GlBadge).exists()).toBe(true); + }); }); it('renders commit and web links with href for submodule', () => { @@ -163,8 +177,10 @@ describe('Repository table row component', () => { currentPath: '/', }); - expect(vm.find('a').attributes('href')).toEqual('https://test.com'); - expect(vm.find(GlLink).attributes('href')).toEqual('https://test.com/commit'); + return vm.vm.$nextTick().then(() => { + expect(vm.find('a').attributes('href')).toEqual('https://test.com'); + expect(vm.find(GlLink).attributes('href')).toEqual('https://test.com/commit'); + }); }); it('renders lock icon', () => { @@ -178,6 +194,8 @@ describe('Repository table row component', () => { vm.setData({ commit: { lockLabel: 'Locked by Root', committedDate: '2019-01-01' } }); - expect(vm.find(Icon).exists()).toBe(true); + return vm.vm.$nextTick().then(() => { + expect(vm.find(Icon).exists()).toBe(true); + }); }); }); -- cgit v1.2.3