Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-08-21 16:18:27 +0300
committerPaul Slaughter <pslaughter@gitlab.com>2018-08-21 16:20:37 +0300
commit97572d4223092a75fd9dbd1c72c947d933c6d520 (patch)
tree963f7b2308fb2ce0ac5dc0e1b39284cea41ebd63 /spec/javascripts/helpers
parentd2590b154228ed49dd4a949c889fb6234343ec94 (diff)
Create 'mountComponentWithRender' for testing with slots
Diffstat (limited to 'spec/javascripts/helpers')
-rw-r--r--spec/javascripts/helpers/vue_mount_component_helper.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/javascripts/helpers/vue_mount_component_helper.js b/spec/javascripts/helpers/vue_mount_component_helper.js
index 1057f0aca3e..6848c95d95d 100644
--- a/spec/javascripts/helpers/vue_mount_component_helper.js
+++ b/spec/javascripts/helpers/vue_mount_component_helper.js
@@ -1,3 +1,5 @@
+import Vue from 'vue';
+
const mountComponent = (Component, props = {}, el = null) =>
new Component({
propsData: props,
@@ -25,4 +27,12 @@ export const mountComponentWithSlots = (Component, { props, slots }) => {
return component.$mount();
};
+/**
+ * Mount a component with the given render method.
+ *
+ * This helps with inserting slots that need to be compiled.
+ */
+export const mountComponentWithRender = (render, el = null) =>
+ mountComponent(Vue.extend({ render }), {}, el);
+
export default mountComponent;