File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ describe('config', () => {
12
12
mocks : undefined ,
13
13
provide : undefined
14
14
}
15
+
16
+ jest . clearAllMocks ( )
15
17
} )
16
18
17
19
describe ( 'components' , ( ) => {
@@ -105,4 +107,46 @@ describe('config', () => {
105
107
) . toEqual ( 'baz' )
106
108
} )
107
109
} )
110
+
111
+ describe ( 'mixins' , ( ) => {
112
+ const createdHook = jest . fn ( )
113
+ const mixin = {
114
+ created ( ) {
115
+ createdHook ( )
116
+ }
117
+ }
118
+ const Component = {
119
+ render ( ) {
120
+ return h ( 'div' )
121
+ }
122
+ }
123
+
124
+ it ( 'sets a mixin everywhere' , ( ) => {
125
+ config . global . mixins = [ mixin ]
126
+ mount ( Component )
127
+
128
+ // once on root, once in the mounted component
129
+ expect ( createdHook ) . toHaveBeenCalledTimes ( 2 )
130
+ } )
131
+
132
+ it ( 'concats with locally defined mixins' , ( ) => {
133
+ config . global . mixins = [ mixin ]
134
+ const localHook = jest . fn ( )
135
+ const localMixin = {
136
+ created ( ) {
137
+ localHook ( this . $options . name )
138
+ }
139
+ }
140
+
141
+ mount ( Component , {
142
+ global : {
143
+ mixins : [ localMixin ]
144
+ }
145
+ } )
146
+
147
+ // once on root, once in the mounted component
148
+ expect ( localHook ) . toHaveBeenCalledTimes ( 2 )
149
+ expect ( createdHook ) . toHaveBeenCalledTimes ( 2 )
150
+ } )
151
+ } )
108
152
} )
You can’t perform that action at this time.
0 commit comments