@@ -19,7 +19,7 @@ describe('mounting options: plugins', () => {
19
19
}
20
20
mount ( Component , {
21
21
global : {
22
- plugins : [ { plugin : Plugin } ]
22
+ plugins : [ Plugin ]
23
23
}
24
24
} )
25
25
@@ -30,8 +30,8 @@ describe('mounting options: plugins', () => {
30
30
const installed = jest . fn ( )
31
31
32
32
class Plugin {
33
- static install ( _app : App , options : { option1 : boolean } ) {
34
- installed ( options )
33
+ static install ( _app : App , ... options ) {
34
+ installed ( ... options )
35
35
}
36
36
}
37
37
@@ -41,12 +41,46 @@ describe('mounting options: plugins', () => {
41
41
}
42
42
}
43
43
const options = { option1 : true }
44
+ const testString = 'hello'
44
45
mount ( Component , {
45
46
global : {
46
- plugins : [ { plugin : Plugin , options } ]
47
+ plugins : [ [ Plugin , options , testString ] ]
47
48
}
48
49
} )
49
50
50
- expect ( installed ) . toHaveBeenCalledWith ( options )
51
+ expect ( installed ) . toHaveBeenCalledWith ( options , testString )
51
52
} )
52
53
} )
54
+
55
+ test ( 'installs plugins with and without options' , ( ) => {
56
+ const installed = jest . fn ( )
57
+ class Plugin {
58
+ static install ( ) {
59
+ installed ( )
60
+ }
61
+ }
62
+
63
+ const installedWithOptions = jest . fn ( )
64
+ class PluginWithOptions {
65
+ static install ( _app : App , ...args ) {
66
+ installedWithOptions ( ...args )
67
+ }
68
+ }
69
+
70
+ const Component = {
71
+ render ( ) {
72
+ return h ( 'div' )
73
+ }
74
+ }
75
+ mount ( Component , {
76
+ global : {
77
+ plugins : [ Plugin , [ PluginWithOptions , 'argument 1' , 'another argument' ] ]
78
+ }
79
+ } )
80
+
81
+ expect ( installed ) . toHaveBeenCalled ( )
82
+ expect ( installedWithOptions ) . toHaveBeenCalledWith (
83
+ 'argument 1' ,
84
+ 'another argument'
85
+ )
86
+ } )
0 commit comments