diff options
Diffstat (limited to 'spec/frontend/ide/components')
5 files changed, 34 insertions, 51 deletions
diff --git a/spec/frontend/ide/components/ide_sidebar_nav_spec.js b/spec/frontend/ide/components/ide_sidebar_nav_spec.js index 4ee24f63f76..d89891bdd41 100644 --- a/spec/frontend/ide/components/ide_sidebar_nav_spec.js +++ b/spec/frontend/ide/components/ide_sidebar_nav_spec.js @@ -45,7 +45,6 @@ describe('ide/components/ide_sidebar_nav', () => { title: button.attributes('title'), ariaLabel: button.attributes('aria-label'), classes: button.classes(), - qaSelector: button.attributes('data-qa-selector'), icon: button.findComponent(GlIcon).props('name'), tooltip: getBinding(button.element, 'tooltip').value, }; @@ -75,7 +74,6 @@ describe('ide/components/ide_sidebar_nav', () => { title: tab.title, ariaLabel: tab.title, classes: ['ide-sidebar-link', ...classes, ...(classesObj[index] || [])], - qaSelector: `${tab.title.toLowerCase()}_tab_button`, icon: tab.icon, tooltip: { container: 'body', diff --git a/spec/frontend/ide/components/ide_status_bar_spec.js b/spec/frontend/ide/components/ide_status_bar_spec.js index fe392a64013..eb51faaaa16 100644 --- a/spec/frontend/ide/components/ide_status_bar_spec.js +++ b/spec/frontend/ide/components/ide_status_bar_spec.js @@ -1,4 +1,4 @@ -import _ from 'lodash'; +import { clone } from 'lodash'; import { TEST_HOST } from 'helpers/test_constants'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import IdeStatusBar from '~/ide/components/ide_status_bar.vue'; @@ -28,7 +28,7 @@ describe('IdeStatusBar component', () => { currentProjectId: TEST_PROJECT_ID, projects: { ...store.state.projects, - [TEST_PROJECT_ID]: _.clone(projectData), + [TEST_PROJECT_ID]: clone(projectData), }, ...state, }); @@ -100,7 +100,7 @@ describe('IdeStatusBar component', () => { currentMergeRequestId: TEST_MERGE_REQUEST_ID, projects: { [TEST_PROJECT_ID]: { - ..._.clone(projectData), + ...clone(projectData), mergeRequests: { [TEST_MERGE_REQUEST_ID]: { web_url: TEST_MERGE_REQUEST_URL, diff --git a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js index 56e62829971..174e62550d5 100644 --- a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js +++ b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import Vue, { nextTick } from 'vue'; +import Vue from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; import IdeSidebarNav from '~/ide/components/ide_sidebar_nav.vue'; @@ -37,31 +37,26 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { }); describe('with a tab', () => { - let fakeView; - let extensionTabs; - - beforeEach(() => { - const FakeComponent = Vue.component(fakeComponentName, { - render: () => null, - }); - - fakeView = { - name: fakeComponentName, - keepAlive: true, - component: FakeComponent, - }; - - extensionTabs = [ - { - show: true, - title: fakeComponentName, - views: [fakeView], - icon: 'text-description', - buttonClasses: ['button-class-1', 'button-class-2'], - }, - ]; + const FakeComponent = Vue.component(fakeComponentName, { + render: () => null, }); + const fakeView = { + name: fakeComponentName, + keepAlive: true, + component: FakeComponent, + }; + + const extensionTabs = [ + { + show: true, + title: fakeComponentName, + views: [fakeView], + icon: 'text-description', + buttonClasses: ['button-class-1', 'button-class-2'], + }, + ]; + describe.each` side ${'left'} @@ -79,10 +74,6 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { expect(findSidebarNav().props('side')).toBe(side); }); - it('nothing is dispatched', () => { - expect(store.dispatch).not.toHaveBeenCalled(); - }); - it('when sidebar emits open, dispatch open', () => { const view = 'lorem-view'; @@ -98,6 +89,13 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { }); }); + describe('when side bar is rendered initially', () => { + it('nothing is dispatched', () => { + createComponent({ extensionTabs }); + expect(store.dispatch).not.toHaveBeenCalled(); + }); + }); + describe.each` isOpen ${true} @@ -125,25 +123,15 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { }); describe('with initOpenView that does not exist', () => { - beforeEach(async () => { - createComponent({ extensionTabs, initOpenView: 'does-not-exist' }); - - await nextTick(); - }); - it('nothing is dispatched', () => { + createComponent({ extensionTabs, initOpenView: 'does-not-exist' }); expect(store.dispatch).not.toHaveBeenCalled(); }); }); describe('with initOpenView that does exist', () => { - beforeEach(async () => { - createComponent({ extensionTabs, initOpenView: fakeView.name }); - - await nextTick(); - }); - it('dispatches open with view on create', () => { + createComponent({ extensionTabs, initOpenView: fakeView.name }); expect(store.dispatch).toHaveBeenCalledWith('rightPane/open', fakeView); }); }); diff --git a/spec/frontend/ide/components/pipelines/list_spec.js b/spec/frontend/ide/components/pipelines/list_spec.js index 9c11ae9334b..9d8b3b1d32a 100644 --- a/spec/frontend/ide/components/pipelines/list_spec.js +++ b/spec/frontend/ide/components/pipelines/list_spec.js @@ -8,7 +8,7 @@ import JobsList from '~/ide/components/jobs/list.vue'; import List from '~/ide/components/pipelines/list.vue'; import EmptyState from '~/ide/components/pipelines/empty_state.vue'; import IDEServices from '~/ide/services'; -import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import CiIcon from '~/vue_shared/components/ci_icon/ci_icon.vue'; Vue.use(Vuex); diff --git a/spec/frontend/ide/components/repo_commit_section_spec.js b/spec/frontend/ide/components/repo_commit_section_spec.js index ead609421b7..3dd9ae1285d 100644 --- a/spec/frontend/ide/components/repo_commit_section_spec.js +++ b/spec/frontend/ide/components/repo_commit_section_spec.js @@ -71,11 +71,8 @@ describe('RepoCommitSection', () => { createComponent(); }); - it('renders no changes text', () => { - expect(wrapper.findComponent(EmptyState).text().trim()).toContain('No changes'); - expect(wrapper.findComponent(EmptyState).find('img').attributes('src')).toBe( - TEST_NO_CHANGES_SVG, - ); + it('renders empty state component', () => { + expect(wrapper.findComponent(EmptyState).exists()).toBe(true); }); }); |