4bdadeda59c703a0d5c46bd9152bcab8594d1305
[WebKit-https.git] / LayoutTests / fast / events / touch / ios / content-observation / transition-on-touch-start-and-remove.html
1 <html>
2 <head>
3 <title>This tests the case when touchEnd triggers a transition and the element is removed.</title>
4 <script src="../../../../../resources/basic-gestures.js"></script>
5 <style>
6 #tapthis {
7     width: 400px;
8     height: 400px;
9     border: 1px solid green;
10 }
11
12 #becomesVisible {
13         position: absolute;
14         top: 100px;
15         left: -1000px;
16         width: 100px;
17         height: 100px;
18         background-color: green;
19         transition: left 100ms ease-in-out 0ms;
20 }
21 </style>
22 <script>
23 async function test() {
24     if (!window.testRunner || !testRunner.runUIScript)
25         return;
26     if (window.internals)
27         internals.settings.setContentChangeObserverEnabled(true);
28
29     testRunner.waitUntilDone();
30     testRunner.dumpAsText();
31
32     let rect = tapthis.getBoundingClientRect();
33     let x = rect.left + rect.width / 2;
34     let y = rect.top + rect.height / 2;
35
36     await tapAtPoint(x, y);
37 }
38 </script>
39 </head>
40 <body onload="test()">
41 <div id=tapthis>PASS if 'clicked' text is shown below.</div>
42 <div id=becomesVisible></div>
43 <pre id=result></pre>
44 <script>
45 tapthis.addEventListener("touchstart", function( event ) {
46     becomesVisible.remove();
47 }, false);
48
49 becomesVisible.addEventListener("click", function( event ) {   
50     result.innerHTML = "clicked hidden";
51 }, false);
52
53 tapthis.addEventListener("click", function( event ) {   
54     result.innerHTML = "clicked";
55     if (window.testRunner)
56         testRunner.notifyDone();
57 }, false);
58 </script>
59 </body>
60 </html>