File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ exports.$broadcast = function (event) {
134134 */
135135
136136exports . $dispatch = function ( ) {
137+ this . $emit . apply ( this , arguments )
137138 var parent = this . $parent
138139 while ( parent ) {
139140 parent . $emit . apply ( parent , arguments )
Original file line number Diff line number Diff line change @@ -134,10 +134,11 @@ describe('Events API', function () {
134134 it ( '$dispatch' , function ( ) {
135135 var child = vm . $addChild ( )
136136 var child2 = child . $addChild ( )
137+ child2 . $on ( 'test' , spy )
137138 child . $on ( 'test' , spy )
138139 vm . $on ( 'test' , spy )
139140 child2 . $dispatch ( 'test' )
140- expect ( spy . calls . count ( ) ) . toBe ( 1 ) // should not propagate by default
141+ expect ( spy . calls . count ( ) ) . toBe ( 2 ) // should trigger on self, but not propagate to root
141142 } )
142143
143144 it ( '$dispatch with propagation' , function ( ) {
You can’t perform that action at this time.
0 commit comments