(withOriginalEvent)
| 186 | |
| 187 | describe('touchStart', function() { |
| 188 | function testTouchStart(withOriginalEvent) { |
| 189 | beforeEach(function() { |
| 190 | var event = new jQuery.Event('touchstart'); |
| 191 | |
| 192 | if (withOriginalEvent) { |
| 193 | event.originalEvent = new jQuery.Event('touchstart'); |
| 194 | } |
| 195 | scope.grid.api.core.scrollToIfNecessary = jasmine.createSpy('scrollToIfNecessary').and.returnValue({then: angular.noop}); |
| 196 | recompile(); |
| 197 | element.trigger(event); |
| 198 | $timeout.flush(); |
| 199 | scope.$apply(); |
| 200 | }); |
| 201 | afterEach(function() { |
| 202 | scope.grid.api.core.scrollToIfNecessary.calls.reset(); |
| 203 | }); |
| 204 | it('should trigger scrolling if necessary', function(done) { |
| 205 | setTimeout(function() { |
| 206 | expect(scope.grid.api.core.scrollToIfNecessary).toHaveBeenCalled(); |
| 207 | done(); |
| 208 | }, 1); |
| 209 | }); |
| 210 | describe('touchEnd', function() { |
| 211 | beforeEach(function() { |
| 212 | var touchStartEvent = new jQuery.Event('touchstart'), |
| 213 | touchEndEvent = new jQuery.Event('touchend'); |
| 214 | |
| 215 | spyOn($timeout, 'cancel').and.callThrough(); |
| 216 | element.trigger(touchStartEvent); |
| 217 | element.trigger(touchEndEvent); |
| 218 | }); |
| 219 | afterEach(function() { |
| 220 | $timeout.cancel.calls.reset(); |
| 221 | }); |
| 222 | it('should cancel any touchstart timeout', function() { |
| 223 | expect($timeout.cancel).toHaveBeenCalled(); |
| 224 | }); |
| 225 | }); |
| 226 | } |
| 227 | describe('when original event is defined', function() { |
| 228 | testTouchStart(true); |
| 229 | }); |
no test coverage detected