0e7055a1 by Adam Heath

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.
1 parent ed27a033
......@@ -62,6 +62,7 @@ define(function(require) {
$(el).on('focus.rivets-error-binder', holder.focus).on('blur.rivets-error-binder', holder.blur);
rivetsBinderCall(this, this.args[0], 'bind', arguments);
render(el, 'bind');
render(el, 'validated', false);
},
unbind: function(el) {
var holder = this.validationHolder;
......
......@@ -120,14 +120,14 @@ define(function(require) {
test.set('constant', 'CONSTANT');
expect($1.val()).toEqual('CONSTANT');
expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0});
expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 1});
triggerEvents($1, 'one');
expect(test.get('constant')).toEqual('one');
expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 1});
expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 2});
triggerEvents($1, '');
expect(test.get('constant')).toEqual('');
expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 1});
expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 2});
jasmine.Clock.tick(1);
expect(render.lastErrorList).toEqual(jasmine.any(String));
});
......