[iOS] Add tests to ensure CSS :active and :hover are applied when processing touch...
[WebKit-https.git] / LayoutTests / platform / iphone-simulator / fast / events / ontouchstart-active-selector.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../../resources/js-test-pre.js"></script>
5
6 <style>
7     #touchMe {
8         background-color: blue;
9         width: 200px;
10         height: 200px;
11         top: 0;
12         left: 0;
13     }
14     #touchMe:active {
15         background-color: yellow;
16     }
17 </style>
18 </head>
19 <body>
20 <div id="touchMe" ontouchstart=""></div>
21 <script>
22
23 description("This tests the :active selector on touchable elements");
24
25 if (!window.eventSender)
26     debug("This test will FAIL outside of DRT, but you can test it manually by touching the blue square below. If it turns yellow when touched, the test is a PASS.");
27
28 touchMe = document.getElementById("touchMe");
29
30 shouldBe("getComputedStyle(touchMe).backgroundColor", "'rgb(0, 0, 255)'");
31
32 if (window.eventSender) {
33     eventSender.clearTouchPoints();
34     eventSender.addTouchPoint(touchMe.offsetLeft + 10, touchMe.offsetTop + 10);
35     eventSender.touchStart();
36 }
37
38 shouldBe("getComputedStyle(touchMe).backgroundColor", "'rgb(255, 255, 0)'");
39
40 if (window.eventSender) {
41     eventSender.clearTouchPoints();
42     eventSender.touchEnd();
43 }
44
45 shouldBe("getComputedStyle(touchMe).backgroundColor", "'rgb(0, 0, 255)'");
46
47 </script>    
48 <script src="../../../../resources/js-test-post.js"></script>
49 </body>
50 </html>