Commit 3a31cedb authored by Arun Kumar Mohan's avatar Arun Kumar Mohan

Migrate from Vue event hub to Mitt

parent 935b1b6d
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
/* eslint-disable no-new, class-methods-use-this */
import $ from 'jquery';
import Vue from 'vue';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import Cookies from 'js-cookie';
import createEventHub from '~/helpers/event_hub_factory';
import axios from './lib/utils/axios_utils';
import flash from './flash';
import BlobForkSuggestion from './blob/blob_fork_suggestion';
......@@ -93,7 +93,7 @@ export default class MergeRequestTabs {
this.pipelinesLoaded = false;
this.commitsLoaded = false;
this.fixedLayoutPref = null;
this.eventHub = new Vue();
this.eventHub = createEventHub();
this.setUrl = setUrl !== undefined ? setUrl : true;
this.setCurrentAction = this.setCurrentAction.bind(this);
......
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
// see recaptcha_tags in app/views/shared/_recaptcha_form.html.haml
export const callbackName = 'recaptchaDialogCallback';
export const eventHub = new Vue();
export const eventHub = createEventHub();
const throwDuplicateCallbackError = () => {
throw new Error(`${callbackName} is already defined!`);
......
---
title: Migrate from Vue event hub to Mitt
merge_request: 31666
author: Arun Kumar Mohan
type: changed
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
const accordionEventBus = new Vue();
export default accordionEventBus;
export default createEventHub();
// TODO: Replace with mitt implementation for Vue3 once it has been verified
// (https://gitlab.com/gitlab-org/gitlab/-/issues/215672)
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
export default new Vue();
export default createEventHub();
import Vue from 'vue';
import accordionEventBus from 'ee/vue_shared/components/accordion/accordion_event_bus';
describe('Accordion event bus', () => {
it('default exports a vue instance', () => {
expect(accordionEventBus instanceof Vue).toBe(true);
});
});
import Vue from 'vue';
import vulnerabilitiesEventBus from 'ee/vulnerabilities/components/vulnerabilities_event_bus';
describe('Vulnerabilities event bus', () => {
it('default exports a vue instance', () => {
expect(vulnerabilitiesEventBus instanceof Vue).toBe(true);
});
});
import Vue from 'vue';
import createEventHub from '~/helpers/event_hub_factory';
import Vuex from 'vuex';
import { createLocalVue, mount } from '@vue/test-utils';
......@@ -132,7 +132,7 @@ describe('DiscussionFilter component', () => {
});
describe('Merge request tabs', () => {
eventHub = new Vue();
eventHub = createEventHub();
beforeEach(() => {
window.mrTabs = {
......
......@@ -3,6 +3,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import * as utils from '~/lib/utils/common_utils';
import discussionNavigation from '~/notes/mixins/discussion_navigation';
import eventHub from '~/notes/event_hub';
import createEventHub from '~/helpers/event_hub_factory';
import notesModule from '~/notes/stores/modules';
import { setHTMLFixture } from 'helpers/fixtures';
......@@ -67,8 +68,7 @@ describe('Discussion navigation mixin', () => {
describe('cycle through discussions', () => {
beforeEach(() => {
// eslint-disable-next-line new-cap
window.mrTabs = { eventHub: new localVue(), tabShown: jest.fn() };
window.mrTabs = { eventHub: createEventHub(), tabShown: jest.fn() };
});
describe.each`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment