@@ -3,6 +3,7 @@ import { compileToFunctions } from 'vue-template-compiler'
33import mount from '~src/mount'
44import ComponentWithProps from '~resources/components/component-with-props.vue'
55import ComponentWithMixin from '~resources/components/component-with-mixin.vue'
6+ import createLocalVue from '~src/create-local-vue'
67
78describe ( 'mount' , ( ) => {
89 it ( 'returns new VueWrapper with mounted Vue instance if no options are passed' , ( ) => {
@@ -86,6 +87,48 @@ describe('mount', () => {
8687 expect ( wrapper . html ( ) ) . to . equal ( `<div>foo</div>` )
8788 } )
8889
90+ it ( 'deletes mounting options before passing options to component' , ( ) => {
91+ const wrapper = mount ( {
92+ template : `<div>foo</div>`
93+ } , {
94+ provide : {
95+ 'prop' : 'val'
96+ } ,
97+ custom : 'custom' ,
98+ attachToDocument : 'attachToDocument' ,
99+ mocks : {
100+ 'prop' : 'val'
101+ } ,
102+ slots : {
103+ 'prop' : 'val'
104+ } ,
105+ localVue : createLocalVue ( ) ,
106+ stubs : {
107+ 'prop' : 'val'
108+ } ,
109+ clone : 'clone' ,
110+ attrs : {
111+ 'prop' : 'val'
112+ } ,
113+ listeners : {
114+ 'prop' : 'val'
115+ }
116+ } )
117+ debugger
118+ // provide is always a function on an the $options object
119+ expect ( typeof wrapper . vm . $options . provide ) . to . equal ( 'function' )
120+ expect ( wrapper . vm . $options . custom ) . to . equal ( undefined )
121+ expect ( wrapper . vm . $options . attachToDocument ) . to . equal ( undefined )
122+ expect ( wrapper . vm . $options . mocks ) . to . equal ( undefined )
123+ expect ( wrapper . vm . $options . slots ) . to . equal ( undefined )
124+ expect ( wrapper . vm . $options . localVue ) . to . equal ( undefined )
125+ expect ( wrapper . vm . $options . stubs ) . to . equal ( undefined )
126+ expect ( wrapper . vm . $options . context ) . to . equal ( undefined )
127+ expect ( wrapper . vm . $options . clone ) . to . equal ( undefined )
128+ expect ( wrapper . vm . $options . attrs ) . to . equal ( undefined )
129+ expect ( wrapper . vm . $options . listeners ) . to . equal ( undefined )
130+ } )
131+
89132 it . skip ( 'throws an error when the component fails to mount' , ( ) => {
90133 const TestComponent = {
91134 template : '<div></div>' ,
0 commit comments