| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <!-- |
| Touch tests that involve the ontouchstart, ontouchmove, ontouchend or ontouchcancel callbacks |
| should be written in an asynchronous fashion so they can be run on mobile platforms like Android. |
| This template will generate an asynchronous style test by using the js-test-post-function script. |
| You will need to invoke isSuccessfullyParsed() in your test script when the test completes. |
| --> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| var target = document.createElement('input'); |
| target.setAttribute('type', 'text'); |
| target.id = "target"; |
| target.setAttribute('style', "position: absolute; top: 0; left: 0; font-size: 24px;"); |
| |
| document.body.insertBefore(target, document.getElementById('console')); |
| |
| function touchStartHandler() |
| { |
| shouldBeEqualToString('event.type', 'touchstart'); |
| shouldBeEqualToString('event.touches[0].target.id', target.id); |
| shouldBeEqualToString('event.touches[0].target.nodeName', 'INPUT'); |
| |
| successfullyParsed = true; |
| isSuccessfullyParsed(); |
| } |
| |
| target.addEventListener("touchstart", touchStartHandler, false); |
| |
| description("Tests that input elements can receive touch events."); |
| |
| if (window.eventSender) { |
| eventSender.clearTouchPoints(); |
| eventSender.addTouchPoint(10, 10); |
| eventSender.touchStart(); |
| eventSender.touchEnd(); |
| } else |
| debug('This test requires DRT.'); |
| |
| document.body.removeChild(target); |
| |
| var successfullyParsed = true; |
| </script> |
| </body> |
| </html> |