@@ -22,6 +22,53 @@ describe('Options functional', () => {
22
22
} ) . then ( done )
23
23
} )
24
24
25
+ it ( 'should expose all props when not declared' , done => {
26
+ const vm = new Vue ( {
27
+ data : { test : 'foo' } ,
28
+ template : '<div><wrap :msg="test" kebab-msg="bar"></wrap></div>' ,
29
+ components : {
30
+ wrap : {
31
+ functional : true ,
32
+ render ( h , { props } ) {
33
+ return h ( 'div' , `${ props . msg } ${ props . kebabMsg } ` )
34
+ }
35
+ }
36
+ }
37
+ } ) . $mount ( )
38
+ expect ( vm . $el . innerHTML ) . toBe ( '<div>foo bar</div>' )
39
+ vm . test = 'qux'
40
+ waitForUpdate ( ( ) => {
41
+ expect ( vm . $el . innerHTML ) . toBe ( '<div>qux bar</div>' )
42
+ } ) . then ( done )
43
+ } )
44
+
45
+ it ( 'should expose data.on as listeners' , ( ) => {
46
+ const foo = jasmine . createSpy ( 'foo' )
47
+ const bar = jasmine . createSpy ( 'bar' )
48
+ const vm = new Vue ( {
49
+ template : '<div><wrap @click="foo" @test="bar"/></div>' ,
50
+ methods : { foo, bar } ,
51
+ components : {
52
+ wrap : {
53
+ functional : true ,
54
+ render ( h , { listeners } ) {
55
+ return h ( 'div' , {
56
+ on : {
57
+ click : [ listeners . click , ( ) => listeners . test ( 'bar' ) ]
58
+ }
59
+ } )
60
+ }
61
+ }
62
+ }
63
+ } ) . $mount ( )
64
+
65
+ triggerEvent ( vm . $el . children [ 0 ] , 'click' )
66
+ expect ( foo ) . toHaveBeenCalled ( )
67
+ expect ( foo . calls . argsFor ( 0 ) [ 0 ] . type ) . toBe ( 'click' ) // should have click event
68
+ triggerEvent ( vm . $el . children [ 0 ] , 'mousedown' )
69
+ expect ( bar ) . toHaveBeenCalledWith ( 'bar' )
70
+ } )
71
+
25
72
it ( 'should support returning more than one root node' , ( ) => {
26
73
const vm = new Vue ( {
27
74
template : `<div><test></test></div>` ,
0 commit comments