summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-08-21 08:18:27 -0500
committerPaul Slaughter <pslaughter@gitlab.com>2018-08-21 08:20:37 -0500
commit97572d4223092a75fd9dbd1c72c947d933c6d520 (patch)
tree963f7b2308fb2ce0ac5dc0e1b39284cea41ebd63
parentd2590b154228ed49dd4a949c889fb6234343ec94 (diff)
downloadgitlab-ce-97572d4223092a75fd9dbd1c72c947d933c6d520.tar.gz
Create 'mountComponentWithRender' for testing with slots
-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;