diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-08 15:08:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-08 15:08:01 +0000 |
commit | a7df1d8717d39424ced032d9fe063f08f97e19d6 (patch) | |
tree | f887841557b509e950475176baa4d405bfd411f4 /spec/frontend | |
parent | e3e300557f5def9bf2271735c8a620e6820dfada (diff) | |
download | gitlab-ce-a7df1d8717d39424ced032d9fe063f08f97e19d6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
18 files changed, 25 insertions, 90 deletions
diff --git a/spec/frontend/breakpoints_spec.js b/spec/frontend/breakpoints_spec.js deleted file mode 100644 index c9014ddd3e2..00000000000 --- a/spec/frontend/breakpoints_spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import bp, { breakpoints } from '~/breakpoints'; - -describe('breakpoints', () => { - Object.keys(breakpoints).forEach(key => { - const size = breakpoints[key]; - - it(`returns ${key} when larger than ${size}`, () => { - jest.spyOn(bp, 'windowWidth').mockReturnValue(size + 10); - - expect(bp.getBreakpointSize()).toBe(key); - }); - }); - - describe('isDesktop', () => { - it('returns true when screen size is medium', () => { - jest.spyOn(bp, 'windowWidth').mockReturnValue(breakpoints.md + 10); - - expect(bp.isDesktop()).toBe(true); - }); - - it('returns false when screen size is small', () => { - jest.spyOn(bp, 'windowWidth').mockReturnValue(breakpoints.sm + 10); - - expect(bp.isDesktop()).toBe(false); - }); - }); -}); diff --git a/spec/frontend/notes/components/diff_discussion_header_spec.js b/spec/frontend/notes/components/diff_discussion_header_spec.js index be912777d64..e461ea9d9d3 100644 --- a/spec/frontend/notes/components/diff_discussion_header_spec.js +++ b/spec/frontend/notes/components/diff_discussion_header_spec.js @@ -1,4 +1,4 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import createStore from '~/notes/stores'; import diffDiscussionHeader from '~/notes/components/diff_discussion_header.vue'; @@ -18,11 +18,9 @@ describe('diff_discussion_header component', () => { window.mrTabs = {}; store = createStore(); - const localVue = createLocalVue(); wrapper = mount(diffDiscussionHeader, { store, propsData: { discussion: discussionMock }, - localVue, sync: false, }); }); diff --git a/spec/frontend/notes/components/discussion_actions_spec.js b/spec/frontend/notes/components/discussion_actions_spec.js index 6198f8b3c1d..1aea6b97172 100644 --- a/spec/frontend/notes/components/discussion_actions_spec.js +++ b/spec/frontend/notes/components/discussion_actions_spec.js @@ -1,4 +1,4 @@ -import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; +import { shallowMount, mount } from '@vue/test-utils'; import { discussionMock } from '../../notes/mock_data'; import DiscussionActions from '~/notes/components/discussion_actions.vue'; import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue'; @@ -22,12 +22,10 @@ const createUnallowedNote = () => describe('DiscussionActions', () => { let wrapper; const createComponentFactory = (shallow = true) => props => { - const localVue = createLocalVue(); const store = createStore(); const mountFn = shallow ? shallowMount : mount; wrapper = mountFn(DiscussionActions, { - localVue, store, propsData: { discussion: discussionMock, diff --git a/spec/frontend/notes/components/discussion_notes_spec.js b/spec/frontend/notes/components/discussion_notes_spec.js index d259e79de84..a937aa171f3 100644 --- a/spec/frontend/notes/components/discussion_notes_spec.js +++ b/spec/frontend/notes/components/discussion_notes_spec.js @@ -1,4 +1,4 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import '~/behaviors/markdown/render_gfm'; import { SYSTEM_NOTE } from '~/notes/constants'; import DiscussionNotes from '~/notes/components/discussion_notes.vue'; @@ -9,8 +9,6 @@ import SystemNote from '~/vue_shared/components/notes/system_note.vue'; import createStore from '~/notes/stores'; import { noteableDataMock, discussionMock, notesDataMock } from '../../notes/mock_data'; -const localVue = createLocalVue(); - describe('DiscussionNotes', () => { let wrapper; @@ -20,7 +18,6 @@ describe('DiscussionNotes', () => { store.dispatch('setNotesData', notesDataMock); wrapper = shallowMount(DiscussionNotes, { - localVue, store, propsData: { discussion: discussionMock, diff --git a/spec/frontend/notes/components/discussion_reply_placeholder_spec.js b/spec/frontend/notes/components/discussion_reply_placeholder_spec.js index f7fe758c390..a881e44a007 100644 --- a/spec/frontend/notes/components/discussion_reply_placeholder_spec.js +++ b/spec/frontend/notes/components/discussion_reply_placeholder_spec.js @@ -1,7 +1,6 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue'; -const localVue = createLocalVue(); const buttonText = 'Test Button Text'; describe('ReplyPlaceholder', () => { @@ -11,7 +10,6 @@ describe('ReplyPlaceholder', () => { beforeEach(() => { wrapper = shallowMount(ReplyPlaceholder, { - localVue, propsData: { buttonText, }, diff --git a/spec/frontend/notes/components/discussion_resolve_button_spec.js b/spec/frontend/notes/components/discussion_resolve_button_spec.js index 33a29992320..c64e299efc3 100644 --- a/spec/frontend/notes/components/discussion_resolve_button_spec.js +++ b/spec/frontend/notes/components/discussion_resolve_button_spec.js @@ -1,16 +1,13 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import resolveDiscussionButton from '~/notes/components/discussion_resolve_button.vue'; const buttonTitle = 'Resolve discussion'; describe('resolveDiscussionButton', () => { let wrapper; - let localVue; const factory = options => { - localVue = createLocalVue(); wrapper = shallowMount(resolveDiscussionButton, { - localVue, ...options, }); }; @@ -69,7 +66,7 @@ describe('resolveDiscussionButton', () => { const button = wrapper.find({ ref: 'isResolvingIcon' }); - localVue.nextTick(() => { + wrapper.vm.$nextTick(() => { expect(button.exists()).toEqual(false); }); }); diff --git a/spec/frontend/notes/components/note_app_spec.js b/spec/frontend/notes/components/note_app_spec.js index b313c1186fd..b7e7d7d1d72 100644 --- a/spec/frontend/notes/components/note_app_spec.js +++ b/spec/frontend/notes/components/note_app_spec.js @@ -1,7 +1,7 @@ import $ from 'helpers/jquery'; import AxiosMockAdapter from 'axios-mock-adapter'; import Vue from 'vue'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import { setTestTimeout } from 'helpers/timeout'; import axios from '~/lib/utils/axios_utils'; import NotesApp from '~/notes/components/notes_app.vue'; @@ -48,7 +48,6 @@ describe('note_app', () => { notesData: mockData.notesDataMock, userData: mockData.userDataMock, }; - const localVue = createLocalVue(); return mount( { @@ -63,7 +62,6 @@ describe('note_app', () => { attachToDocument: true, propsData, store, - localVue, sync: false, }, ); diff --git a/spec/frontend/notes/components/note_edited_text_spec.js b/spec/frontend/notes/components/note_edited_text_spec.js index e8d5a24e86a..8d05e8a3c31 100644 --- a/spec/frontend/notes/components/note_edited_text_spec.js +++ b/spec/frontend/notes/components/note_edited_text_spec.js @@ -1,7 +1,6 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import NoteEditedText from '~/notes/components/note_edited_text.vue'; -const localVue = createLocalVue(); const propsData = { actionText: 'Edited', className: 'foo-bar', @@ -21,7 +20,6 @@ describe('NoteEditedText', () => { beforeEach(() => { wrapper = shallowMount(NoteEditedText, { - localVue, propsData, sync: false, attachToDocument: true, diff --git a/spec/frontend/snippets/components/app_spec.js b/spec/frontend/snippets/components/app_spec.js index f2800f9e6af..903290716cc 100644 --- a/spec/frontend/snippets/components/app_spec.js +++ b/spec/frontend/snippets/components/app_spec.js @@ -2,11 +2,10 @@ import SnippetApp from '~/snippets/components/app.vue'; import SnippetHeader from '~/snippets/components/snippet_header.vue'; import { GlLoadingIcon } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; describe('Snippet view app', () => { let wrapper; - const localVue = createLocalVue(); const defaultProps = { snippetGid: 'gid://gitlab/PersonalSnippet/42', }; @@ -23,7 +22,6 @@ describe('Snippet view app', () => { wrapper = shallowMount(SnippetApp, { sync: false, mocks: { $apollo }, - localVue, propsData: { ...props, }, diff --git a/spec/frontend/snippets/components/snippet_header_spec.js b/spec/frontend/snippets/components/snippet_header_spec.js index 8847a3a6938..fce1628aab0 100644 --- a/spec/frontend/snippets/components/snippet_header_spec.js +++ b/spec/frontend/snippets/components/snippet_header_spec.js @@ -2,11 +2,10 @@ import SnippetHeader from '~/snippets/components/snippet_header.vue'; import DeleteSnippetMutation from '~/snippets/mutations/deleteSnippet.mutation.graphql'; import { ApolloMutation } from 'vue-apollo'; import { GlButton, GlModal } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; describe('Snippet header component', () => { let wrapper; - const localVue = createLocalVue(); const snippet = { snippet: { id: 'gid://gitlab/PersonalSnippet/50', @@ -64,7 +63,6 @@ describe('Snippet header component', () => { wrapper = shallowMount(SnippetHeader, { sync: false, mocks: { $apollo }, - localVue, propsData: { ...defaultProps, }, diff --git a/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js b/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js index f979d173eff..adada264865 100644 --- a/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js +++ b/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js @@ -29,7 +29,7 @@ describe('Merge Requests Artifacts list app', () => { }); const createComponent = () => { - wrapper = mount(localVue.extend(ArtifactsListApp), { + wrapper = mount(ArtifactsListApp, { propsData: { endpoint: TEST_HOST, }, diff --git a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js index 8c805faf574..ab701775a7c 100644 --- a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js +++ b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js @@ -1,23 +1,21 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import { GlLink } from '@gitlab/ui'; import ArtifactsList from '~/vue_merge_request_widget/components/artifacts_list.vue'; import { artifactsList } from './mock_data'; describe('Artifacts List', () => { let wrapper; - const localVue = createLocalVue(); const data = { artifacts: artifactsList, }; const mountComponent = props => { - wrapper = shallowMount(localVue.extend(ArtifactsList), { + wrapper = shallowMount(ArtifactsList, { propsData: { ...props, }, sync: false, - localVue, }); }; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_container_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_container_spec.js index 16c8c939a6f..60f970e0018 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_container_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_container_spec.js @@ -1,4 +1,4 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import MrWidgetContainer from '~/vue_merge_request_widget/components/mr_widget_container.vue'; const BODY_HTML = '<div class="test-body">Hello World</div>'; @@ -8,10 +8,7 @@ describe('MrWidgetContainer', () => { let wrapper; const factory = (options = {}) => { - const localVue = createLocalVue(); - - wrapper = shallowMount(localVue.extend(MrWidgetContainer), { - localVue, + wrapper = shallowMount(MrWidgetContainer, { ...options, }); }; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js index f7c2376eebf..662b1160b0c 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js @@ -1,4 +1,4 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import MrWidgetIcon from '~/vue_merge_request_widget/components/mr_widget_icon.vue'; import Icon from '~/vue_shared/components/icon.vue'; @@ -8,14 +8,11 @@ describe('MrWidgetIcon', () => { let wrapper; beforeEach(() => { - const localVue = createLocalVue(); - - wrapper = shallowMount(localVue.extend(MrWidgetIcon), { + wrapper = shallowMount(MrWidgetIcon, { propsData: { name: TEST_ICON, }, sync: false, - localVue, }); }); diff --git a/spec/frontend/vue_mr_widget/components/states/commit_edit_spec.js b/spec/frontend/vue_mr_widget/components/states/commit_edit_spec.js index 6483fec4121..9ee497036c7 100644 --- a/spec/frontend/vue_mr_widget/components/states/commit_edit_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/commit_edit_spec.js @@ -1,7 +1,6 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import CommitEdit from '~/vue_merge_request_widget/components/states/commit_edit.vue'; -const localVue = createLocalVue(); const testCommitMessage = 'Test commit message'; const testLabel = 'Test label'; const testInputId = 'test-input-id'; @@ -10,8 +9,7 @@ describe('Commits edit component', () => { let wrapper; const createComponent = (slots = {}) => { - wrapper = shallowMount(localVue.extend(CommitEdit), { - localVue, + wrapper = shallowMount(CommitEdit, { sync: false, propsData: { value: testCommitMessage, diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js index d1310515856..1096d5b3fa7 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js @@ -1,8 +1,7 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import { GlDropdownItem } from '@gitlab/ui'; import CommitMessageDropdown from '~/vue_merge_request_widget/components/states/commit_message_dropdown.vue'; -const localVue = createLocalVue(); const commits = [ { title: 'Commit 1', @@ -25,8 +24,7 @@ describe('Commits message dropdown component', () => { let wrapper; const createComponent = () => { - wrapper = shallowMount(localVue.extend(CommitMessageDropdown), { - localVue, + wrapper = shallowMount(CommitMessageDropdown, { sync: false, propsData: { commits, diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js index 3176a288d49..bc646d6dcd5 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js @@ -1,15 +1,12 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_header.vue'; import Icon from '~/vue_shared/components/icon.vue'; -const localVue = createLocalVue(); - describe('Commits header component', () => { let wrapper; const createComponent = props => { - wrapper = shallowMount(localVue.extend(CommitsHeader), { - localVue, + wrapper = shallowMount(CommitsHeader, { sync: false, propsData: { isSquashEnabled: false, diff --git a/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js b/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js index 6e3c6f64c68..b48c97341b2 100644 --- a/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js +++ b/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js @@ -1,4 +1,4 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import DeploymentViewButton from '~/vue_merge_request_widget/components/deployment/deployment_view_button.vue'; import ReviewAppLink from '~/vue_merge_request_widget/components/review_app_link.vue'; import deploymentMockData from './deployment_mock_data'; @@ -7,10 +7,7 @@ describe('Deployment View App button', () => { let wrapper; const factory = (options = {}) => { - const localVue = createLocalVue(); - - wrapper = mount(localVue.extend(DeploymentViewButton), { - localVue, + wrapper = mount(DeploymentViewButton, { ...options, }); }; |