66 describeWithMountingMethods ,
77 vueVersion ,
88 itSkipIf ,
9- itDoNotRunIf
9+ itDoNotRunIf ,
10+ isRunningPhantomJS
1011} from '~resources/utils'
1112
1213describeWithMountingMethods ( 'options.slots' , ( mountingMethod ) => {
@@ -53,7 +54,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
5354 } )
5455
5556 itDoNotRunIf (
56- process . env . TEST_ENV === 'node' ,
57+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
5758 'mounts component with default slot if passed string in slot object' , ( ) => {
5859 const wrapper = mountingMethod ( ComponentWithSlots , { slots : { default : '<span />' } } )
5960 if ( mountingMethod . name === 'renderToString' ) {
@@ -64,7 +65,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
6465 } )
6566
6667 itDoNotRunIf (
67- process . env . TEST_ENV === 'node' || vueVersion < 2.3 ,
68+ process . env . TEST_ENV === 'node' || vueVersion < 2.3 || isRunningPhantomJS ,
6869 'works correctly with class component' , ( ) => {
6970 const wrapper = mountingMethod ( ComponentAsAClass , { slots : { default : '<span />' } } )
7071 if ( mountingMethod . name === 'renderToString' ) {
@@ -91,26 +92,28 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
9192 expect ( fn ) . to . throw ( ) . with . property ( 'message' , message )
9293 } )
9394
94- it ( 'mounts component with default slot if passed string in slot object' , ( ) => {
95- if ( mountingMethod . name === 'renderToString' ) {
96- return
97- }
98- const wrapper1 = mountingMethod ( ComponentWithSlots , { slots : { default : 'foo<span>123</span>{{ foo }}' } } )
99- expect ( wrapper1 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>foo<span>123</span>bar</main>' )
100- const wrapper2 = mountingMethod ( ComponentWithSlots , { slots : { default : '<p>1</p>{{ foo }}2' } } )
101- expect ( wrapper2 . find ( 'main' ) . html ( ) ) . to . equal ( '<main><p>1</p>bar2</main>' )
102- const wrapper3 = mountingMethod ( ComponentWithSlots , { slots : { default : '<p>1</p>{{ foo }}<p>2</p>' } } )
103- expect ( wrapper3 . find ( 'main' ) . html ( ) ) . to . equal ( '<main><p>1</p>bar<p>2</p></main>' )
104- const wrapper4 = mountingMethod ( ComponentWithSlots , { slots : { default : '123' } } )
105- expect ( wrapper4 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>123</main>' )
106- const wrapper5 = mountingMethod ( ComponentWithSlots , { slots : { default : '1{{ foo }}2' } } )
107- expect ( wrapper5 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>1bar2</main>' )
108- wrapper5 . trigger ( 'keydown' )
109- const wrapper6 = mountingMethod ( ComponentWithSlots , { slots : { default : '<p>1</p><p>2</p>' } } )
110- expect ( wrapper6 . find ( 'main' ) . html ( ) ) . to . equal ( '<main><p>1</p><p>2</p></main>' )
111- const wrapper7 = mountingMethod ( ComponentWithSlots , { slots : { default : '1<p>2</p>3' } } )
112- expect ( wrapper7 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>1<p>2</p>3</main>' )
113- } )
95+ itDoNotRunIf (
96+ isRunningPhantomJS ,
97+ 'mounts component with default slot if passed string in slot object' , ( ) => {
98+ if ( mountingMethod . name === 'renderToString' ) {
99+ return
100+ }
101+ const wrapper1 = mountingMethod ( ComponentWithSlots , { slots : { default : 'foo<span>123</span>{{ foo }}' } } )
102+ expect ( wrapper1 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>foo<span>123</span>bar</main>' )
103+ const wrapper2 = mountingMethod ( ComponentWithSlots , { slots : { default : '<p>1</p>{{ foo }}2' } } )
104+ expect ( wrapper2 . find ( 'main' ) . html ( ) ) . to . equal ( '<main><p>1</p>bar2</main>' )
105+ const wrapper3 = mountingMethod ( ComponentWithSlots , { slots : { default : '<p>1</p>{{ foo }}<p>2</p>' } } )
106+ expect ( wrapper3 . find ( 'main' ) . html ( ) ) . to . equal ( '<main><p>1</p>bar<p>2</p></main>' )
107+ const wrapper4 = mountingMethod ( ComponentWithSlots , { slots : { default : '123' } } )
108+ expect ( wrapper4 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>123</main>' )
109+ const wrapper5 = mountingMethod ( ComponentWithSlots , { slots : { default : '1{{ foo }}2' } } )
110+ expect ( wrapper5 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>1bar2</main>' )
111+ wrapper5 . trigger ( 'keydown' )
112+ const wrapper6 = mountingMethod ( ComponentWithSlots , { slots : { default : '<p>1</p><p>2</p>' } } )
113+ expect ( wrapper6 . find ( 'main' ) . html ( ) ) . to . equal ( '<main><p>1</p><p>2</p></main>' )
114+ const wrapper7 = mountingMethod ( ComponentWithSlots , { slots : { default : '1<p>2</p>3' } } )
115+ expect ( wrapper7 . find ( 'main' ) . html ( ) ) . to . equal ( '<main>1<p>2</p>3</main>' )
116+ } )
114117
115118 itSkipIf ( mountingMethod . name === 'renderToString' ,
116119 'throws error if passed string in default slot object and vue-template-compiler is undefined' , ( ) => {
@@ -130,7 +133,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
130133 } )
131134
132135 itDoNotRunIf (
133- process . env . TEST_ENV === 'node' ,
136+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
134137 'mounts component with default slot if passed string in slot array object' , ( ) => {
135138 const wrapper = mountingMethod ( ComponentWithSlots , { slots : { default : [ '<span />' ] } } )
136139 if ( mountingMethod . name === 'renderToString' ) {
@@ -141,7 +144,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
141144 } )
142145
143146 itDoNotRunIf (
144- process . env . TEST_ENV === 'node' ,
147+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
145148 'mounts component with default slot if passed string in slot text array object' , ( ) => {
146149 const wrapper = mountingMethod ( ComponentWithSlots , { slots : { default : [ '{{ foo }}<span>1</span>' , 'bar' ] } } )
147150 if ( mountingMethod . name === 'renderToString' ) {
@@ -241,7 +244,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
241244 }
242245 } )
243246
244- itDoNotRunIf ( process . env . TEST_ENV === 'node' ,
247+ itDoNotRunIf ( process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
245248 'mounts component with default slot if passed string in slot object' , ( ) => {
246249 const TestComponent = {
247250 name : 'component-with-slots' ,
@@ -257,7 +260,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
257260 } )
258261
259262 itDoNotRunIf (
260- process . env . TEST_ENV === 'node' ,
263+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
261264 'mounts component with named slot if passed string in slot object' , ( ) => {
262265 const TestComponent = {
263266 functional : true ,
@@ -272,7 +275,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
272275 } )
273276
274277 itDoNotRunIf (
275- process . env . TEST_ENV === 'node' ,
278+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
276279 'mounts component with named slot if passed string in slot object in array' , ( ) => {
277280 const TestComponent = {
278281 functional : true ,
@@ -287,7 +290,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
287290 } )
288291
289292 itDoNotRunIf (
290- process . env . TEST_ENV === 'node' ,
293+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
291294 'mounts component with named slot if passed string in slot object in array' , ( ) => {
292295 const TestComponent = {
293296 functional : true ,
@@ -302,7 +305,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
302305 } )
303306
304307 itDoNotRunIf (
305- process . env . TEST_ENV === 'node' ,
308+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
306309 'mounts component with named slot if passed string in slot object in array' , ( ) => {
307310 const TestComponent = {
308311 functional : true ,
@@ -382,8 +385,9 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
382385 require . cache [ require . resolve ( 'vue-template-compiler' ) ] . exports . compileToFunctions = compilerSave
383386 } )
384387
385- itDoNotRunIf ( mountingMethod . name === 'renderToString' ,
386- 'afd' , ( ) => {
388+ itDoNotRunIf (
389+ mountingMethod . name === 'renderToString' || isRunningPhantomJS ,
390+ 'does not error when triggering a click in a slot' , ( ) => {
387391 const Parent = {
388392 name : 'Parent' ,
389393 template : `
0 commit comments