| <!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 targetDiv = document.createElement("div"); |
| targetDiv.id = "targetDiv"; |
| targetDiv.setAttribute('style', "position: absolute; top: 0; left: 0; background-color: blue; font-size: 24px;"); |
| targetDiv.innerText = 'This is some text'; |
| |
| document.body.insertBefore(targetDiv, document.getElementById('console')); |
| |
| function touchStartHandler() |
| { |
| shouldBeEqualToString('event.type', 'touchstart'); |
| shouldBeEqualToString('event.touches[0].target.id', targetDiv.id); |
| shouldBeEqualToString('event.touches[0].target.nodeName', 'DIV'); |
| |
| successfullyParsed = true; |
| isSuccessfullyParsed(); |
| } |
| |
| targetDiv.addEventListener("touchstart", touchStartHandler, false); |
| |
| description("Tests that the event target for a touch on a text node is the parent element, not the text node."); |
| |
| if (window.eventSender) { |
| eventSender.clearTouchPoints(); |
| eventSender.addTouchPoint(10, 10); |
| eventSender.touchStart(); |
| eventSender.touchEnd(); |
| } else |
| debug('This test requires DRT.'); |
| |
| |
| var successfullyParsed = true; |
| </script> |
| </body> |
| </html> |