mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
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
This commit is contained in:
committed by
Pete Bacon Darwin
parent
bed08c9c66
commit
507d8021b1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user