@@ -3,7 +3,8 @@ import ComponentWithInject from '~resources/components/component-with-inject.vue
33import { injectSupported } from '~resources/utils'
44import {
55 describeWithMountingMethods ,
6- itDoNotRunIf
6+ itDoNotRunIf ,
7+ itSkipIf
78} from '~resources/utils'
89
910describeWithMountingMethods ( 'options.provide' , ( mountingMethod ) => {
@@ -57,16 +58,20 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
5758 expect ( wrapper . vm . setInBeforeCreate ) . to . equal ( 'created' )
5859 } )
5960
60- itDoNotRunIf ( ! injectSupported ( ) , 'injects the provide from the config' , ( ) => {
61- config . provide [ 'fromMount' ] = 'globalConfig'
61+ itSkipIf ( mountingMethod . name === 'renderToString' ,
62+ 'injects the provide from the config' , ( ) => {
63+ if ( ! injectSupported ( ) ) {
64+ return
65+ }
66+ config . provide [ 'fromMount' ] = 'globalConfig'
6267
63- const wrapper = mountingMethod ( ComponentWithInject )
64- const HTML = mountingMethod . name === 'renderToString'
65- ? wrapper
66- : wrapper . html ( )
68+ const wrapper = mountingMethod ( ComponentWithInject )
69+ const HTML = mountingMethod . name === 'renderToString'
70+ ? wrapper
71+ : wrapper . html ( )
6772
68- expect ( HTML ) . to . contain ( 'globalConfig' )
69- } )
73+ expect ( HTML ) . to . contain ( 'globalConfig' )
74+ } )
7075
7176 itDoNotRunIf ( ! injectSupported ( ) , 'prioritize mounting options over config' , ( ) => {
7277 config . provide [ 'fromMount' ] = 'globalConfig'
@@ -81,13 +86,14 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
8186 expect ( HTML ) . to . contain ( '_' )
8287 } )
8388
84- itDoNotRunIf ( ! injectSupported ( ) , 'config with function throws' , ( ) => {
85- config . provide = ( ) => { }
89+ itSkipIf ( mountingMethod . name === 'renderToString' ,
90+ 'config with function throws' , ( ) => {
91+ config . provide = ( ) => { }
8692
87- expect ( ( ) => {
88- mountingMethod ( ComponentWithInject , {
89- provide : { fromMount : '_' }
90- } )
91- } ) . to . throw ( )
92- } )
93+ expect ( ( ) => {
94+ mountingMethod ( ComponentWithInject , {
95+ provide : { fromMount : '_' }
96+ } )
97+ } ) . to . throw ( )
98+ } )
9399} )
0 commit comments