@@ -18,6 +18,7 @@ require('rxjs/add/operator/startWith')
18
18
require ( 'rxjs/add/operator/scan' )
19
19
require ( 'rxjs/add/operator/pluck' )
20
20
require ( 'rxjs/add/operator/merge' )
21
+ require ( 'rxjs/add/operator/filter' )
21
22
22
23
const miniRx = {
23
24
Observable,
@@ -147,8 +148,8 @@ test('v-stream directive (with .native modify)', done => {
147
148
template : `
148
149
<div>
149
150
<span class="count">{{ count }}</span>
150
- <my-button v-stream:click.native="clickNative$">+</my-button>
151
- <my-button v-stream:click="click$">-</my-button>
151
+ <my-button id="btn-native" v-stream:click.native="clickNative$">+</my-button>
152
+ <my-button id="btn" v-stream:click="click$">-</my-button>
152
153
</div>
153
154
` ,
154
155
components : {
@@ -159,16 +160,20 @@ test('v-stream directive (with .native modify)', done => {
159
160
domStreams : [ 'clickNative$' , 'click$' ] ,
160
161
subscriptions ( ) {
161
162
return {
162
- count : this . click$ . map ( ( ) => - 1 )
163
- . merge ( this . clickNative$ . map ( ( ) => 1 ) )
163
+ count : this . clickNative$
164
+ . filter ( e => e . event . target && e . event . target . id === 'btn-native' )
165
+ . map ( ( ) => 1 )
166
+ . merge ( this . click$ . map ( ( ) => - 1 ) )
167
+ . merge ( )
164
168
. startWith ( 0 )
165
169
. scan ( ( total , change ) => total + change )
166
170
}
167
171
}
168
172
} ) . $mount ( )
169
173
170
174
expect ( vm . $el . querySelector ( 'span' ) . textContent ) . toBe ( '0' )
171
- click ( vm . $el . querySelector ( 'button' ) )
175
+ click ( vm . $el . querySelector ( '#btn-native' ) )
176
+ click ( vm . $el . querySelector ( '#btn' ) )
172
177
nextTick ( ( ) => {
173
178
expect ( vm . $el . querySelector ( 'span' ) . textContent ) . toBe ( '1' )
174
179
done ( )
0 commit comments