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) {
134
134
*/
135
135
136
136
exports . $dispatch = function ( ) {
137
+ this . $emit . apply ( this , arguments )
137
138
var parent = this . $parent
138
139
while ( parent ) {
139
140
parent . $emit . apply ( parent , arguments )
Original file line number Diff line number Diff line change @@ -134,10 +134,11 @@ describe('Events API', function () {
134
134
it ( '$dispatch' , function ( ) {
135
135
var child = vm . $addChild ( )
136
136
var child2 = child . $addChild ( )
137
+ child2 . $on ( 'test' , spy )
137
138
child . $on ( 'test' , spy )
138
139
vm . $on ( 'test' , spy )
139
140
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
141
142
} )
142
143
143
144
it ( '$dispatch with propagation' , function ( ) {
You can’t perform that action at this time.
0 commit comments