File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
test/unit/specs/directives/public Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ Directive.prototype._bind = function () {
109109 if ( this . bind ) {
110110 this . bind ( )
111111 }
112+ this . _bound = true
112113
113114 if ( this . literal ) {
114115 this . update && this . update ( descriptor . raw )
@@ -156,7 +157,6 @@ Directive.prototype._bind = function () {
156157 this . update ( watcher . value )
157158 }
158159 }
159- this . _bound = true
160160}
161161
162162/**
Original file line number Diff line number Diff line change @@ -53,13 +53,13 @@ export default {
5353 self . focused = false
5454 // do not sync value after fragment removal (#2017)
5555 if ( ! self . _frag || self . _frag . inserted ) {
56- self . listener ( )
56+ self . rawListener ( )
5757 }
5858 } )
5959 }
6060
6161 // Now attach the main listener
62- this . listener = function ( ) {
62+ this . listener = this . rawListener = function ( ) {
6363 if ( composing || ! self . _bound ) {
6464 return
6565 }
Original file line number Diff line number Diff line change @@ -709,8 +709,19 @@ describe('v-model', function () {
709709 } , 30 )
710710 setTimeout ( function ( ) {
711711 expect ( spy . calls . count ( ) ) . toBe ( 1 )
712+ expect ( spy ) . toHaveBeenCalledWith ( 'd' , 'a' )
712713 expect ( vm . test ) . toBe ( 'd' )
713- done ( )
714+ } , 150 )
715+ setTimeout ( function ( ) {
716+ el . firstChild . value = 'e'
717+ // blur should trigger change instantly without debounce
718+ trigger ( el . firstChild , 'blur' )
719+ _ . nextTick ( function ( ) {
720+ expect ( spy . calls . count ( ) ) . toBe ( 2 )
721+ expect ( spy ) . toHaveBeenCalledWith ( 'e' , 'd' )
722+ expect ( vm . test ) . toBe ( 'e' )
723+ done ( )
724+ } )
714725 } , 200 )
715726 } )
716727
You can’t perform that action at this time.
0 commit comments