diff options
Diffstat (limited to 'spec/frontend')
7 files changed, 13 insertions, 84 deletions
diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js index b109c2a3ab1..e14f661a8bd 100644 --- a/spec/frontend/boards/components/board_content_spec.js +++ b/spec/frontend/boards/components/board_content_spec.js @@ -1,9 +1,8 @@ import { GlAlert } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import Vue, { nextTick } from 'vue'; +import Vue from 'vue'; import Draggable from 'vuedraggable'; import Vuex from 'vuex'; - import eventHub from '~/boards/eventhub'; import { stubComponent } from 'helpers/stub_component'; import waitForPromises from 'helpers/wait_for_promises'; @@ -77,29 +76,6 @@ describe('BoardContent', () => { }); }; - beforeAll(() => { - global.ResizeObserver = class MockResizeObserver { - constructor(callback) { - this.callback = callback; - - this.entries = []; - } - - observe(entry) { - this.entries.push(entry); - } - - disconnect() { - this.entries = []; - this.callback = null; - } - - trigger() { - this.callback(this.entries); - } - }; - }); - describe('default', () => { beforeEach(() => { createComponent(); @@ -118,34 +94,6 @@ describe('BoardContent', () => { expect(wrapper.findComponent(GlAlert).exists()).toBe(false); }); - it('on small screens, sets board container height to full height', async () => { - window.innerHeight = 1000; - window.innerWidth = 767; - jest.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue({ top: 100 }); - - wrapper.vm.resizeObserver.trigger(); - - await nextTick(); - - const style = wrapper.findComponent({ ref: 'list' }).attributes('style'); - - expect(style).toBe('height: 1000px;'); - }); - - it('on large screens, sets board container height fill area below filters', async () => { - window.innerHeight = 1000; - window.innerWidth = 768; - jest.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue({ top: 100 }); - - wrapper.vm.resizeObserver.trigger(); - - await nextTick(); - - const style = wrapper.findComponent({ ref: 'list' }).attributes('style'); - - expect(style).toBe('height: 900px;'); - }); - it('sets delay and delayOnTouchOnly attributes on board list', () => { const listEl = wrapper.findComponent({ ref: 'list' }); diff --git a/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js b/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js index 6fc6c0b6085..c3d33c88422 100644 --- a/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js +++ b/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js @@ -60,8 +60,6 @@ import { mockRegistrationToken, newRunnerPath, emptyPageInfo, - emptyStateSvgPath, - emptyStateFilteredSvgPath, } from '../mock_data'; const mockRunners = allRunnersData.data.runners.nodes; @@ -122,8 +120,6 @@ describe('AdminRunnersApp', () => { localMutations, onlineContactTimeoutSecs, staleTimeoutSecs, - emptyStateSvgPath, - emptyStateFilteredSvgPath, ...provide, }, ...options, @@ -448,9 +444,7 @@ describe('AdminRunnersApp', () => { expect(findRunnerListEmptyState().props()).toEqual({ newRunnerPath, isSearchFiltered: false, - filteredSvgPath: emptyStateFilteredSvgPath, registrationToken: mockRegistrationToken, - svgPath: emptyStateSvgPath, }); }); diff --git a/spec/frontend/ci/runner/components/runner_jobs_empty_state_spec.js b/spec/frontend/ci/runner/components/runner_jobs_empty_state_spec.js index e64308f49d1..59c9383cb31 100644 --- a/spec/frontend/ci/runner/components/runner_jobs_empty_state_spec.js +++ b/spec/frontend/ci/runner/components/runner_jobs_empty_state_spec.js @@ -1,3 +1,5 @@ +import EMPTY_STATE_SVG_URL from '@gitlab/svgs/dist/illustrations/pipelines_empty.svg?url'; + import { shallowMount } from '@vue/test-utils'; import { GlEmptyState } from '@gitlab/ui'; import RunnerJobsEmptyState from '~/ci/runner/components/runner_jobs_empty_state.vue'; @@ -12,11 +14,7 @@ describe('RunnerJobsEmptyStateComponent', () => { let wrapper; const mountComponent = () => { - wrapper = shallowMount(RunnerJobsEmptyState, { - provide: { - emptyStateImage: 'emptyStateImage', - }, - }); + wrapper = shallowMount(RunnerJobsEmptyState); }; const findEmptyState = () => wrapper.findComponent(GlEmptyState); @@ -29,7 +27,7 @@ describe('RunnerJobsEmptyStateComponent', () => { it('should show an empty state if it is empty', () => { const emptyState = findEmptyState(); - expect(emptyState.props('svgPath')).toBe('emptyStateImage'); + expect(emptyState.props('svgPath')).toBe(EMPTY_STATE_SVG_URL); expect(emptyState.props('title')).toBe(DEFAULT_PROPS.emptyTitle); expect(emptyState.text()).toContain(DEFAULT_PROPS.emptyDescription); }); diff --git a/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js b/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js index f4e93e83ce8..0de2759ea8a 100644 --- a/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js +++ b/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js @@ -1,15 +1,12 @@ +import EMPTY_STATE_SVG_URL from '@gitlab/svgs/dist/illustrations/pipelines_empty.svg?url'; +import FILTERED_SVG_URL from '@gitlab/svgs/dist/illustrations/magnifying-glass.svg?url'; import { GlEmptyState, GlLink, GlSprintf } from '@gitlab/ui'; import { s__ } from '~/locale'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import RunnerInstructionsModal from '~/vue_shared/components/runner_instructions/runner_instructions_modal.vue'; -import { - mockRegistrationToken, - newRunnerPath, - emptyStateSvgPath, - emptyStateFilteredSvgPath, -} from 'jest/ci/runner/mock_data'; +import { mockRegistrationToken, newRunnerPath } from 'jest/ci/runner/mock_data'; import RunnerListEmptyState from '~/ci/runner/components/runner_list_empty_state.vue'; @@ -23,8 +20,6 @@ describe('RunnerListEmptyState', () => { const createComponent = ({ props, mountFn = shallowMountExtended, ...options } = {}) => { wrapper = mountFn(RunnerListEmptyState, { propsData: { - svgPath: emptyStateSvgPath, - filteredSvgPath: emptyStateFilteredSvgPath, registrationToken: mockRegistrationToken, newRunnerPath, ...props, @@ -50,7 +45,7 @@ describe('RunnerListEmptyState', () => { }); it('renders an illustration', () => { - expect(findEmptyState().props('svgPath')).toBe(emptyStateSvgPath); + expect(findEmptyState().props('svgPath')).toBe(EMPTY_STATE_SVG_URL); }); it('displays "no results" text with instructions', () => { @@ -125,7 +120,7 @@ describe('RunnerListEmptyState', () => { }); it('renders an illustration', () => { - expect(findEmptyState().props('svgPath')).toBe(emptyStateSvgPath); + expect(findEmptyState().props('svgPath')).toBe(EMPTY_STATE_SVG_URL); }); it('displays "no results" text', () => { @@ -148,7 +143,7 @@ describe('RunnerListEmptyState', () => { }); it('renders a "filtered search" illustration', () => { - expect(findEmptyState().props('svgPath')).toBe(emptyStateFilteredSvgPath); + expect(findEmptyState().props('svgPath')).toBe(FILTERED_SVG_URL); }); it('displays "no filtered results" text', () => { diff --git a/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js b/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js index e750327294c..41be72b1645 100644 --- a/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js +++ b/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js @@ -61,8 +61,6 @@ import { mockRegistrationToken, newRunnerPath, emptyPageInfo, - emptyStateSvgPath, - emptyStateFilteredSvgPath, } from '../mock_data'; Vue.use(VueApollo); @@ -123,8 +121,6 @@ describe('GroupRunnersApp', () => { localMutations, onlineContactTimeoutSecs, staleTimeoutSecs, - emptyStateSvgPath, - emptyStateFilteredSvgPath, ...provide, }, ...options, @@ -424,8 +420,6 @@ describe('GroupRunnersApp', () => { isSearchFiltered: false, newRunnerPath, registrationToken: mockRegistrationToken, - svgPath: 'emptyStateSvgPath.svg', - filteredSvgPath: 'emptyStateFilteredSvgPath.svg', }); }); }); diff --git a/spec/frontend/ci/runner/mock_data.js b/spec/frontend/ci/runner/mock_data.js index d47a95f5c07..223a156795c 100644 --- a/spec/frontend/ci/runner/mock_data.js +++ b/spec/frontend/ci/runner/mock_data.js @@ -322,8 +322,6 @@ export const mockRegistrationToken = 'MOCK_REGISTRATION_TOKEN'; export const mockAuthenticationToken = 'MOCK_AUTHENTICATION_TOKEN'; export const newRunnerPath = '/runners/new'; -export const emptyStateSvgPath = 'emptyStateSvgPath.svg'; -export const emptyStateFilteredSvgPath = 'emptyStateFilteredSvgPath.svg'; export { allRunnersData, diff --git a/spec/frontend/content_editor/components/bubble_menus/bubble_menu_spec.js b/spec/frontend/content_editor/components/bubble_menus/bubble_menu_spec.js index 271e63abf21..97716ce848c 100644 --- a/spec/frontend/content_editor/components/bubble_menus/bubble_menu_spec.js +++ b/spec/frontend/content_editor/components/bubble_menus/bubble_menu_spec.js @@ -64,10 +64,12 @@ describe('content_editor/components/bubble_menus/bubble_menu', () => { tippyOptions: expect.objectContaining({ onHidden: expect.any(Function), onShow: expect.any(Function), + appendTo: expect.any(Function), ...tippyOptions, }), }); + expect(BubbleMenuPlugin.mock.calls[0][0].tippyOptions.appendTo()).toBe(document.body); expect(tiptapEditor.registerPlugin).toHaveBeenCalledWith(pluginInitializationResult); }); |