Skip to content

Commit

Permalink
Add tests for stopping and restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
hashchange committed Mar 3, 2017
1 parent ca8b3a1 commit 0ec6e7b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/manual/events-restarted.html
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>
36 changes: 36 additions & 0 deletions tests/manual/events-stopped.html
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>

0 comments on commit 0ec6e7b

Please sign in to comment.