@@ -2,19 +2,15 @@ import { compileToFunctions } from 'vue-template-compiler'
2
2
import mount from '~src/mount'
3
3
import Component from '~resources/components/component.vue'
4
4
import ComponentWithSlots from '~resources/components/component-with-slots.vue'
5
+ import FunctionalComponentWithSlots from '~resources/components/functional-component-with-slots.vue'
5
6
6
7
describe ( 'mount.slots' , ( ) => {
7
8
it ( 'mounts component with default slot if passed component in slot object' , ( ) => {
8
- const wrapper = mount ( ComponentWithSlots , { slots : { default : [ Component ] } } )
9
- expect ( wrapper . contains ( Component ) ) . to . equal ( true )
10
- } )
11
-
12
- it ( 'mounts component with default slot if passed object with template prop in slot object' , ( ) => {
13
- const wrapper = mount ( ComponentWithSlots , { slots : { default : [ Component ] } } )
9
+ const wrapper = mount ( ComponentWithSlots , { slots : { default : Component } } )
14
10
expect ( wrapper . contains ( Component ) ) . to . equal ( true )
15
11
} )
16
12
17
- it ( 'mounts component with default slot if passed component in slot object' , ( ) => {
13
+ it ( 'mounts component with default slot if passed component in array in slot object' , ( ) => {
18
14
const wrapper = mount ( ComponentWithSlots , { slots : { default : [ Component ] } } )
19
15
expect ( wrapper . contains ( Component ) ) . to . equal ( true )
20
16
} )
@@ -86,4 +82,25 @@ describe('mount.slots', () => {
86
82
expect ( wrapper . findAll ( Component ) . length ) . to . equal ( 1 )
87
83
expect ( Array . isArray ( wrapper . vm . $slots . header ) ) . to . equal ( true )
88
84
} )
85
+
86
+ it . only ( 'mounts functional component with default slot if passed component in slot object' , ( ) => {
87
+ const wrapper = mount ( FunctionalComponentWithSlots , { slots : { default : [ Component ] } } )
88
+ expect ( wrapper . contains ( Component ) ) . to . equal ( true )
89
+ } )
90
+
91
+ it . only ( 'mounts component with default slot if passed component in slot object' , ( ) => {
92
+ const wrapper = mount ( FunctionalComponentWithSlots , { slots : { default : [ Component ] } } )
93
+ expect ( wrapper . contains ( Component ) ) . to . equal ( true )
94
+ } )
95
+
96
+ it . only ( 'mounts component with default slot if passed object with template prop in slot object' , ( ) => {
97
+ const compiled = compileToFunctions ( '<div id="div" />' )
98
+ const wrapper = mount ( FunctionalComponentWithSlots , { slots : { default : [ compiled ] } } )
99
+ expect ( wrapper . contains ( '#div' ) ) . to . equal ( true )
100
+ } )
101
+
102
+ it . only ( 'mounts component with default slot if passed string in slot object' , ( ) => {
103
+ const wrapper = mount ( FunctionalComponentWithSlots , { slots : { default : '<span />' } } )
104
+ expect ( wrapper . contains ( 'span' ) ) . to . equal ( true )
105
+ } )
89
106
} )
0 commit comments