aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngTouch/directive/ngSwipeSpec.js
diff options
context:
space:
mode:
authorAdam Kent2013-10-08 14:49:56 +1100
committerPete Bacon Darwin2013-10-08 12:55:16 +0100
commit507d8021b1c91cc0cefc0418e61b04597ad1030b (patch)
treefb58a88337d65c7d28f3883bcf5f86fd77aa1dfb /test/ngTouch/directive/ngSwipeSpec.js
parentbed08c9c6661d6da5ed6337f194402ea02a8d14c (diff)
downloadangular.js-507d8021b1c91cc0cefc0418e61b04597ad1030b.tar.bz2
fix(ngTouch): add $event to ng-swipe
Existing documentation implies that an Event object should be available as `$event` on swipe directives, which previously was only working for `ng-click`. Closes #4071 Closes #4321
Diffstat (limited to 'test/ngTouch/directive/ngSwipeSpec.js')
-rw-r--r--test/ngTouch/directive/ngSwipeSpec.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ngTouch/directive/ngSwipeSpec.js b/test/ngTouch/directive/ngSwipeSpec.js
index a7869a36..2aa1a8fe 100644
--- a/test/ngTouch/directive/ngSwipeSpec.js
+++ b/test/ngTouch/directive/ngSwipeSpec.js
@@ -66,6 +66,23 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent,
expect($rootScope.swiped).toBe(true);
}));
+ it('should pass event object', inject(function($rootScope, $compile) {
+ element = $compile('<div ng-swipe-left="event = $event"></div>')($rootScope);
+ $rootScope.$digest();
+
+ browserTrigger(element, startEvent, {
+ keys : [],
+ x : 100,
+ y : 20
+ });
+ browserTrigger(element, endEvent,{
+ keys: [],
+ x: 20,
+ y: 20
+ });
+ expect($rootScope.event).toBeDefined();
+ }));
+
it('should not swipe if you move too far vertically', inject(function($rootScope, $compile, $rootElement) {
element = $compile('<div ng-swipe-left="swiped = true"></div>')($rootScope);
$rootElement.append(element);