@@ -6,12 +6,13 @@ import ComponentWithoutName from '../components/ComponentWithoutName.vue'
6
6
import ComponentWithSlots from '../components/ComponentWithSlots.vue'
7
7
8
8
describe ( 'mounting options: stubs' , ( ) => {
9
+ let configStubsSave = config . global . stubs
9
10
beforeEach ( ( ) => {
10
- config . global . stubs = { }
11
+ config . global . stubs = configStubsSave
11
12
} )
12
13
13
14
afterEach ( ( ) => {
14
- config . global . stubs = { }
15
+ config . global . stubs = configStubsSave
15
16
} )
16
17
17
18
it ( 'handles Array syntax' , ( ) => {
@@ -308,6 +309,59 @@ describe('mounting options: stubs', () => {
308
309
expect ( wrapper . html ( ) ) . toBe ( '<foo-bar-stub></foo-bar-stub>' )
309
310
} )
310
311
312
+ it ( 'stubs transition by default' , ( ) => {
313
+ const Comp = {
314
+ template : `<transition><div id="content" /></transition>`
315
+ }
316
+ const wrapper = mount ( Comp )
317
+
318
+ expect ( wrapper . html ( ) ) . toBe (
319
+ '<transition-stub><div id="content"></div></transition-stub>'
320
+ )
321
+ } )
322
+
323
+ it ( 'opts out of stubbing transition by default' , ( ) => {
324
+ const Comp = {
325
+ template : `<transition><div id="content" /></transition>`
326
+ }
327
+ const wrapper = mount ( Comp , {
328
+ global : {
329
+ stubs : {
330
+ transition : false
331
+ }
332
+ }
333
+ } )
334
+
335
+ // Vue removes <transition> at run-time and does it's magic, so <transition> should not
336
+ // appear in the html when it isn't stubbed.
337
+ expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
338
+ } )
339
+
340
+ it ( 'opts out of stubbing transition-group by default' , ( ) => {
341
+ const Comp = {
342
+ template : `<transition-group><div key="content" id="content" /></transition-group>`
343
+ }
344
+ const wrapper = mount ( Comp , {
345
+ global : {
346
+ stubs : {
347
+ 'transition-group' : false
348
+ }
349
+ }
350
+ } )
351
+
352
+ // Vue removes <transition-group> at run-time and does it's magic, so <transition-group> should not
353
+ // appear in the html when it isn't stubbed.
354
+ expect ( wrapper . html ( ) ) . toBe ( '<div id="content"></div>' )
355
+ } )
356
+
357
+ it ( 'stubs transition-group by default' , ( ) => {
358
+ const Comp = {
359
+ template : `<transition-group><div key="a" id="content" /></transition-group>`
360
+ }
361
+ const wrapper = mount ( Comp )
362
+ expect ( wrapper . find ( '#content' ) . exists ( ) ) . toBe ( true )
363
+ } )
364
+
311
365
describe ( 'stub slots' , ( ) => {
312
366
const Component = {
313
367
name : 'Parent' ,
0 commit comments