6
6
describeWithMountingMethods ,
7
7
vueVersion ,
8
8
itSkipIf ,
9
- itDoNotRunIf
9
+ itDoNotRunIf ,
10
+ isRunningPhantomJS
10
11
} from '~resources/utils'
11
12
12
13
describeWithMountingMethods ( 'options.slots' , ( mountingMethod ) => {
@@ -53,7 +54,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
53
54
} )
54
55
55
56
itDoNotRunIf (
56
- process . env . TEST_ENV === 'node' ,
57
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
57
58
'mounts component with default slot if passed string in slot object' , ( ) => {
58
59
const wrapper = mountingMethod ( ComponentWithSlots , { slots : { default : '<span />' } } )
59
60
if ( mountingMethod . name === 'renderToString' ) {
@@ -64,7 +65,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
64
65
} )
65
66
66
67
itDoNotRunIf (
67
- process . env . TEST_ENV === 'node' || vueVersion < 2.3 ,
68
+ process . env . TEST_ENV === 'node' || vueVersion < 2.3 || isRunningPhantomJS ,
68
69
'works correctly with class component' , ( ) => {
69
70
const wrapper = mountingMethod ( ComponentAsAClass , { slots : { default : '<span />' } } )
70
71
if ( mountingMethod . name === 'renderToString' ) {
@@ -91,26 +92,28 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
91
92
expect ( fn ) . to . throw ( ) . with . property ( 'message' , message )
92
93
} )
93
94
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
+ } )
114
117
115
118
itSkipIf ( mountingMethod . name === 'renderToString' ,
116
119
'throws error if passed string in default slot object and vue-template-compiler is undefined' , ( ) => {
@@ -130,7 +133,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
130
133
} )
131
134
132
135
itDoNotRunIf (
133
- process . env . TEST_ENV === 'node' ,
136
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
134
137
'mounts component with default slot if passed string in slot array object' , ( ) => {
135
138
const wrapper = mountingMethod ( ComponentWithSlots , { slots : { default : [ '<span />' ] } } )
136
139
if ( mountingMethod . name === 'renderToString' ) {
@@ -141,7 +144,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
141
144
} )
142
145
143
146
itDoNotRunIf (
144
- process . env . TEST_ENV === 'node' ,
147
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
145
148
'mounts component with default slot if passed string in slot text array object' , ( ) => {
146
149
const wrapper = mountingMethod ( ComponentWithSlots , { slots : { default : [ '{{ foo }}<span>1</span>' , 'bar' ] } } )
147
150
if ( mountingMethod . name === 'renderToString' ) {
@@ -241,7 +244,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
241
244
}
242
245
} )
243
246
244
- itDoNotRunIf ( process . env . TEST_ENV === 'node' ,
247
+ itDoNotRunIf ( process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
245
248
'mounts component with default slot if passed string in slot object' , ( ) => {
246
249
const TestComponent = {
247
250
name : 'component-with-slots' ,
@@ -257,7 +260,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
257
260
} )
258
261
259
262
itDoNotRunIf (
260
- process . env . TEST_ENV === 'node' ,
263
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
261
264
'mounts component with named slot if passed string in slot object' , ( ) => {
262
265
const TestComponent = {
263
266
functional : true ,
@@ -272,7 +275,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
272
275
} )
273
276
274
277
itDoNotRunIf (
275
- process . env . TEST_ENV === 'node' ,
278
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
276
279
'mounts component with named slot if passed string in slot object in array' , ( ) => {
277
280
const TestComponent = {
278
281
functional : true ,
@@ -287,7 +290,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
287
290
} )
288
291
289
292
itDoNotRunIf (
290
- process . env . TEST_ENV === 'node' ,
293
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
291
294
'mounts component with named slot if passed string in slot object in array' , ( ) => {
292
295
const TestComponent = {
293
296
functional : true ,
@@ -302,7 +305,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
302
305
} )
303
306
304
307
itDoNotRunIf (
305
- process . env . TEST_ENV === 'node' ,
308
+ process . env . TEST_ENV === 'node' || isRunningPhantomJS ,
306
309
'mounts component with named slot if passed string in slot object in array' , ( ) => {
307
310
const TestComponent = {
308
311
functional : true ,
@@ -382,8 +385,9 @@ describeWithMountingMethods('options.slots', (mountingMethod) => {
382
385
require . cache [ require . resolve ( 'vue-template-compiler' ) ] . exports . compileToFunctions = compilerSave
383
386
} )
384
387
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' , ( ) => {
387
391
const Parent = {
388
392
name : 'Parent' ,
389
393
template : `
0 commit comments