forked from hammerjs/touchemulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for stopping and restarting
- Loading branch information
1 parent
ca8b3a1
commit 0ec6e7b
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8"> | ||
<title></title> | ||
|
||
<script src="../../touch-emulator.js"></script> | ||
<script> TouchEmulator.start(); </script> | ||
</head> | ||
<body> | ||
|
||
<div id="hitarea" style="background: silver; height: 400px;"> | ||
Check the console. No mouse events should be fired, only touch events. Click events are allowed. | ||
</div> | ||
|
||
<script> | ||
|
||
function log(ev) { | ||
console.log(ev.type, ev); | ||
} | ||
|
||
var hitarea = document.getElementById('hitarea'); | ||
|
||
var events = ['touchstart','touchmove','touchend','touchcancel', | ||
'mousedown','mouseenter','mouseleave','mousemove', | ||
'mouseout','mouseover','mouseup','mousewheel', | ||
'click']; | ||
|
||
for(var i=0; i<events.length; i++) { | ||
hitarea.addEventListener(events[i], log, false); | ||
} | ||
|
||
TouchEmulator.stop(); | ||
TouchEmulator.start(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8"> | ||
<title></title> | ||
|
||
<script src="../../touch-emulator.js"></script> | ||
<script> TouchEmulator.start(); </script> | ||
</head> | ||
<body> | ||
|
||
<div id="hitarea" style="background: silver; height: 400px;"> | ||
Check the console. No touch events should be fired, only mouse events. Click events are allowed, too. | ||
</div> | ||
|
||
<script> | ||
|
||
function log(ev) { | ||
console.log(ev.type, ev); | ||
} | ||
|
||
var hitarea = document.getElementById('hitarea'); | ||
|
||
var events = ['touchstart','touchmove','touchend','touchcancel', | ||
'mousedown','mouseenter','mouseleave','mousemove', | ||
'mouseout','mouseover','mouseup','mousewheel', | ||
'click']; | ||
|
||
for(var i=0; i<events.length; i++) { | ||
hitarea.addEventListener(events[i], log, false); | ||
} | ||
|
||
TouchEmulator.stop(); | ||
</script> | ||
</body> | ||
</html> |