File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -90,5 +90,39 @@ if (_.inBrowser) {
9090 } )
9191 } )
9292
93+ it ( 'should be able to switch handlers if not a method' , function ( done ) {
94+ var a = 0
95+ var b = 0
96+ var vm = new Vue ( {
97+ el : el ,
98+ data : {
99+ handle : function ( ) {
100+ a ++
101+ }
102+ } ,
103+ template : '<div v-component="test" v-events="test:handle"></div>' ,
104+ components : {
105+ test : {
106+ compiled : function ( ) {
107+ this . $emit ( 'test' )
108+ }
109+ }
110+ }
111+ } )
112+ _ . nextTick ( function ( ) {
113+ expect ( a ) . toBe ( 1 )
114+ expect ( b ) . toBe ( 0 )
115+ vm . handle = function ( ) {
116+ b ++
117+ }
118+ _ . nextTick ( function ( ) {
119+ vm . _children [ 0 ] . $emit ( 'test' )
120+ expect ( a ) . toBe ( 1 )
121+ expect ( b ) . toBe ( 1 )
122+ done ( )
123+ } )
124+ } )
125+ } )
126+
93127 } )
94128}
You can’t perform that action at this time.
0 commit comments