Update to support rivets 0.9.
Showing
3 changed files
with
15 additions
and
12 deletions
... | @@ -11,8 +11,7 @@ | ... | @@ -11,8 +11,7 @@ |
11 | "ignore": [ | 11 | "ignore": [ |
12 | "**/.*", | 12 | "**/.*", |
13 | "node_modules", | 13 | "node_modules", |
14 | "src/lib", | 14 | "src/lib" |
15 | "test" | ||
16 | ], | 15 | ], |
17 | "dependencies": { | 16 | "dependencies": { |
18 | "backbone-seen": "git@gitlab.brainfood.com:brainfood/backbone-seen.git", | 17 | "backbone-seen": "git@gitlab.brainfood.com:brainfood/backbone-seen.git", | ... | ... |
... | @@ -24,6 +24,7 @@ require = (function() { | ... | @@ -24,6 +24,7 @@ require = (function() { |
24 | 'backbone-validation': '../lib/backbone-validation/dist/backbone-validation-amd', | 24 | 'backbone-validation': '../lib/backbone-validation/dist/backbone-validation-amd', |
25 | backbone: '../lib/backbone/backbone', | 25 | backbone: '../lib/backbone/backbone', |
26 | underscore: '../lib/underscore/underscore', | 26 | underscore: '../lib/underscore/underscore', |
27 | sightglass: '../lib/sightglass/index', | ||
27 | rivets: '../lib/rivets/dist/rivets', | 28 | rivets: '../lib/rivets/dist/rivets', |
28 | bootstrap: '../lib/bootstrap/dist/js/bootstrap', | 29 | bootstrap: '../lib/bootstrap/dist/js/bootstrap', |
29 | jquery: '../lib/jquery/dist/jquery', | 30 | jquery: '../lib/jquery/dist/jquery', | ... | ... |
... | @@ -62,6 +62,14 @@ define(function(require) { | ... | @@ -62,6 +62,14 @@ define(function(require) { |
62 | afterEach(function() { | 62 | afterEach(function() { |
63 | view.unbind(); | 63 | view.unbind(); |
64 | }); | 64 | }); |
65 | function triggerEvents($e, val) { | ||
66 | $e.triggerHandler('focus'); | ||
67 | $e.val(val); | ||
68 | $e.triggerHandler('input'); | ||
69 | $e.triggerHandler('change'); | ||
70 | $e.triggerHandler('blur'); | ||
71 | jasmine.Clock.tick(1); | ||
72 | } | ||
65 | 73 | ||
66 | 74 | ||
67 | it('existing-no-render', function() { | 75 | it('existing-no-render', function() { |
... | @@ -83,13 +91,11 @@ define(function(require) { | ... | @@ -83,13 +91,11 @@ define(function(require) { |
83 | expect($1.val()).toEqual('CONSTANT'); | 91 | expect($1.val()).toEqual('CONSTANT'); |
84 | 92 | ||
85 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); | 93 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); |
86 | $1.focus().val('one').change().blur(); | 94 | triggerEvents($1, 'one'); |
87 | jasmine.Clock.tick(1); | ||
88 | expect(test.get('constant')).toEqual('one'); | 95 | expect(test.get('constant')).toEqual('one'); |
89 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); | 96 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); |
90 | 97 | ||
91 | $1.focus().val('').change().blur(); | 98 | triggerEvents($1, ''); |
92 | jasmine.Clock.tick(1); | ||
93 | expect(test.get('constant')).toEqual(''); | 99 | expect(test.get('constant')).toEqual(''); |
94 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); | 100 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); |
95 | jasmine.Clock.tick(1); | 101 | jasmine.Clock.tick(1); |
... | @@ -116,13 +122,11 @@ define(function(require) { | ... | @@ -116,13 +122,11 @@ define(function(require) { |
116 | expect($1.val()).toEqual('CONSTANT'); | 122 | expect($1.val()).toEqual('CONSTANT'); |
117 | 123 | ||
118 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); | 124 | expect(render.counts).toEqual({focus : 0, blur : 0, validatedError : 0, validatedClean : 0}); |
119 | $1.focus().val('one').change().blur(); | 125 | triggerEvents($1, 'one'); |
120 | jasmine.Clock.tick(1); | ||
121 | expect(test.get('constant')).toEqual('one'); | 126 | expect(test.get('constant')).toEqual('one'); |
122 | expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 1}); | 127 | expect(render.counts).toEqual({focus : 1, blur : 1, validatedError : 0, validatedClean : 1}); |
123 | 128 | ||
124 | $1.focus().val('').change().blur(); | 129 | triggerEvents($1, ''); |
125 | jasmine.Clock.tick(1); | ||
126 | expect(test.get('constant')).toEqual(''); | 130 | expect(test.get('constant')).toEqual(''); |
127 | expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 1}); | 131 | expect(render.counts).toEqual({focus : 2, blur : 2, validatedError : 1, validatedClean : 1}); |
128 | jasmine.Clock.tick(1); | 132 | jasmine.Clock.tick(1); |
... | @@ -138,8 +142,7 @@ define(function(require) { | ... | @@ -138,8 +142,7 @@ define(function(require) { |
138 | expect(view).toBeTruthy(); | 142 | expect(view).toBeTruthy(); |
139 | expect($1.val()).toEqual(''); | 143 | expect($1.val()).toEqual(''); |
140 | 144 | ||
141 | $1.focus().val('one').change().blur(); | 145 | triggerEvents($1, 'one'); |
142 | jasmine.Clock.tick(1); | ||
143 | }); | 146 | }); |
144 | }); | 147 | }); |
145 | }); | 148 | }); | ... | ... |
-
Please register or sign in to post a comment