summaryrefslogtreecommitdiff
path: root/spec/frontend/__helpers__/vue_mount_component_helper.js
blob: 615ff69a01cdf20208b51916544193f09d2712f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Vue from 'vue';

/**
 * Deprecated. Please do not use.
 * Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
 */
const mountComponent = (Component, props = {}, el = null) =>
  new Component({
    propsData: props,
  }).$mount(el);

/**
 * Deprecated. Please do not use.
 * Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
 */
export const createComponentWithStore = (Component, store, propsData = {}) =>
  new Component({
    store,
    propsData,
  });

/**
 * Deprecated. Please do not use.
 * Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
 */
export const mountComponentWithStore = (Component, { el, props, store }) =>
  new Component({
    store,
    propsData: props || {},
  }).$mount(el);

/**
 * Deprecated. Please do not use.
 * Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
 */
export const mountComponentWithSlots = (Component, { props, slots }) => {
  const component = new Component({
    propsData: props || {},
  });

  component.$slots = slots;

  return component.$mount();
};

/**
 * Mount a component with the given render method.
 *
 * -----------------------------
 * Deprecated. Please do not use.
 * Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
 * -----------------------------
 *
 * This helps with inserting slots that need to be compiled.
 */
export const mountComponentWithRender = (render, el = null) =>
  mountComponent(Vue.extend({ render }), {}, el);

/**
 * Deprecated. Please do not use.
 * Please see https://gitlab.com/groups/gitlab-org/-/epics/2445
 */
export default mountComponent;