File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
import EventHandler from '../dom/event-handler'
2
2
import { execute , typeCheckConfig } from './index'
3
3
4
+ const NAME = 'swipe'
4
5
const EVENT_KEY = '.bs.swipe'
5
6
const EVENT_TOUCHSTART = `touchstart${ EVENT_KEY } `
6
7
const EVENT_TOUCHMOVE = `touchmove${ EVENT_KEY } `
@@ -11,7 +12,6 @@ const POINTER_TYPE_TOUCH = 'touch'
11
12
const POINTER_TYPE_PEN = 'pen'
12
13
const CLASS_NAME_POINTER_EVENT = 'pointer-event'
13
14
const SWIPE_THRESHOLD = 40
14
- const NAME = 'swipe'
15
15
16
16
const Default = {
17
17
leftCallback : null ,
Original file line number Diff line number Diff line change @@ -151,6 +151,25 @@ describe('Swipe', () => {
151
151
} )
152
152
153
153
describe ( 'Functionality on PointerEvents' , ( ) => {
154
+ it ( 'should not allow pinch with touch events' , ( ) => {
155
+ Simulator . setType ( 'touch' )
156
+ clearPointerEvents ( )
157
+ deleteDocumentElementOntouchstart ( )
158
+
159
+ const swipe = new Swipe ( swipeEl )
160
+ spyOn ( swipe , '_handleSwipe' )
161
+
162
+ mockSwipeGesture ( swipeEl , {
163
+ pos : [ 300 , 10 ] ,
164
+ deltaX : - 300 ,
165
+ deltaY : 0 ,
166
+ touches : 2
167
+ } )
168
+
169
+ restorePointerEvents ( )
170
+ expect ( swipe . _handleSwipe ) . not . toHaveBeenCalled ( )
171
+ } )
172
+
154
173
it ( 'should allow swipeRight and call "rightCallback" with pointer events' , done => {
155
174
if ( ! supportPointerEvent ) {
156
175
expect ( ) . nothing ( )
You can’t perform that action at this time.
0 commit comments