During bind, render an empty error list, to clear out any existing
settings. This means that render('validated') is called at start-of-day now.
Showing
2 changed files
with
4 additions
and
3 deletions
... | @@ -62,6 +62,7 @@ define(function(require) { | ... | @@ -62,6 +62,7 @@ define(function(require) { |
62 | $(el).on('focus.rivets-error-binder', holder.focus).on('blur.rivets-error-binder', holder.blur); | 62 | $(el).on('focus.rivets-error-binder', holder.focus).on('blur.rivets-error-binder', holder.blur); |
63 | rivetsBinderCall(this, this.args[0], 'bind', arguments); | 63 | rivetsBinderCall(this, this.args[0], 'bind', arguments); |
64 | render(el, 'bind'); | 64 | render(el, 'bind'); |
65 | render(el, 'validated', false); | ||
65 | }, | 66 | }, |
66 | unbind: function(el) { | 67 | unbind: function(el) { |
67 | var holder = this.validationHolder; | 68 | var holder = this.validationHolder; | ... | ... |
... | @@ -120,14 +120,14 @@ define(function(require) { | ... | @@ -120,14 +120,14 @@ define(function(require) { |
120 | test.set('constant', 'CONSTANT'); | 120 | test.set('constant', 'CONSTANT'); |
121 | expect($1.val()).toEqual('CONSTANT'); | 121 | expect($1.val()).toEqual('CONSTANT'); |
122 | 122 | ||
123 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); | 123 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 1}); |
124 | triggerEvents($1, 'one'); | 124 | triggerEvents($1, 'one'); |
125 | expect(test.get('constant')).toEqual('one'); | 125 | expect(test.get('constant')).toEqual('one'); |
126 | expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 1}); | 126 | expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 2}); |
127 | 127 | ||
128 | triggerEvents($1, ''); | 128 | triggerEvents($1, ''); |
129 | expect(test.get('constant')).toEqual(''); | 129 | expect(test.get('constant')).toEqual(''); |
130 | expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 1}); | 130 | expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 2}); |
131 | jasmine.Clock.tick(1); | 131 | jasmine.Clock.tick(1); |
132 | expect(render.lastErrorList).toEqual(jasmine.any(String)); | 132 | expect(render.lastErrorList).toEqual(jasmine.any(String)); |
133 | }); | 133 | }); | ... | ... |
-
Please register or sign in to post a comment