c3359bc1 by Adam Heath

Update to support rivets 0.9.

1 parent dc86d552
......@@ -11,8 +11,7 @@
"ignore": [
"**/.*",
"node_modules",
"src/lib",
"test"
"src/lib"
],
"dependencies": {
"backbone-seen": "git@gitlab.brainfood.com:brainfood/backbone-seen.git",
......
......@@ -24,6 +24,7 @@ require = (function() {
'backbone-validation': '../lib/backbone-validation/dist/backbone-validation-amd',
backbone: '../lib/backbone/backbone',
underscore: '../lib/underscore/underscore',
sightglass: '../lib/sightglass/index',
rivets: '../lib/rivets/dist/rivets',
bootstrap: '../lib/bootstrap/dist/js/bootstrap',
jquery: '../lib/jquery/dist/jquery',
......
......@@ -62,6 +62,14 @@ define(function(require) {
afterEach(function() {
view.unbind();
});
function triggerEvents($e, val) {
$e.triggerHandler('focus');
$e.val(val);
$e.triggerHandler('input');
$e.triggerHandler('change');
$e.triggerHandler('blur');
jasmine.Clock.tick(1);
}
it('existing-no-render', function() {
......@@ -83,13 +91,11 @@ define(function(require) {
expect($1.val()).toEqual('CONSTANT');
expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0});
$1.focus().val('one').change().blur();
jasmine.Clock.tick(1);
triggerEvents($1, 'one');
expect(test.get('constant')).toEqual('one');
expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0});
$1.focus().val('').change().blur();
jasmine.Clock.tick(1);
triggerEvents($1, '');
expect(test.get('constant')).toEqual('');
expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0});
jasmine.Clock.tick(1);
......@@ -116,13 +122,11 @@ define(function(require) {
expect($1.val()).toEqual('CONSTANT');
expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0});
$1.focus().val('one').change().blur();
jasmine.Clock.tick(1);
triggerEvents($1, 'one');
expect(test.get('constant')).toEqual('one');
expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 1});
$1.focus().val('').change().blur();
jasmine.Clock.tick(1);
triggerEvents($1, '');
expect(test.get('constant')).toEqual('');
expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 1});
jasmine.Clock.tick(1);
......@@ -138,8 +142,7 @@ define(function(require) {
expect(view).toBeTruthy();
expect($1.val()).toEqual('');
$1.focus().val('one').change().blur();
jasmine.Clock.tick(1);
triggerEvents($1, 'one');
});
});
});
......