Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <style> | |
| 5 #red { | |
| 6 background-color: red; | |
| 7 position: absolute; | |
| 8 left: 50px; | |
| 9 top: 50px; | |
| 10 height: 100px; | |
| 11 width: 100px; | |
| 12 } | |
| 13 #red:hover::after { | |
| 14 content: " Hovered."; | |
| 15 } | |
| 16 | |
| 17 #blue { | |
| 18 background-color: blue; | |
| 19 position: absolute; | |
| 20 left: 50px; | |
| 21 top: 50px; | |
| 22 height: 100px; | |
| 23 width: 100px; | |
| 24 } | |
| 25 #blue:hover::after { | |
| 26 content: " Hovered."; | |
| 27 } | |
| 28 | |
| 29 </style> | |
| 30 <script src="../js/resources/js-test-pre.js"></script> | |
| 31 </head> | |
| 32 <body onload="runtest()" style="margin:0"> | |
| 33 | |
| 34 <script type="text/javascript"> | |
| 35 var redDiv; | |
| 36 var hoveredText = " Hovered."; | |
| 37 function runtest() | |
| 38 { | |
| 39 if (!window.testRunner || !window.eventSender) | |
| 40 return; | |
| 41 | |
| 42 if (!window.internals || !window.internals.setIsCursorVisible) { | |
| 43 debug("window.internals.setIsCursorVisible is required to run this test. "); | |
| 44 return; | |
| 45 } | |
| 46 | |
| 47 testRunner.waitUntilDone(); | |
| 48 | |
| 49 redDiv = document.getElementById('red'); | |
| 50 | |
| 51 document.addEventListener('keydown', function(e) { | |
| 52 redDiv.parentNode.removeChild(redDiv); | |
| 53 }); | |
| 54 | |
| 55 debug("Mouse is visible, moving it over the red div."); | |
| 56 internals.setIsCursorVisible(document, true); | |
| 57 eventSender.mouseMoveTo(175, 175); | |
| 58 shouldBeEqualToString(window.getComputedStyle(document.querySelector('#blue' ), ':after').content, hoveredText); | |
|
Rick Byers
2013/06/03 23:00:17
Pass expression strings as the first arg to ensure
tdanderson
2013/06/04 22:17:41
Done.
| |
| 59 shouldBeEqualToString(window.getComputedStyle(document.querySelector('#red') , ':after').content, hoveredText); | |
| 60 | |
| 61 debug("Setting mouse cursor to be invisible."); | |
| 62 internals.setIsCursorVisible(document, false); | |
| 63 shouldBeEqualToString(window.getComputedStyle(document.querySelector('#blue' ), ':after').content, hoveredText); | |
| 64 shouldBeEqualToString(window.getComputedStyle(document.querySelector('#red') , ':after').content, hoveredText); | |
| 65 | |
| 66 debug("Deleting red div."); | |
| 67 eventSender.keyDown("a"); | |
| 68 window.setTimeout(testAfterDelete, 0); | |
|
ojan
2013/06/03 23:55:02
I don't think you need a setTimeout here. You're j
tdanderson
2013/06/04 22:17:41
I originally tried this but it didn't work. When I
ojan
2013/06/04 23:29:07
Oh right. I wasn't thinking through this clearly.
| |
| 69 } | |
| 70 | |
| 71 function testAfterDelete() | |
| 72 { | |
| 73 shouldBeEqualToString(window.getComputedStyle(document.querySelector('#blue' ), ':after').content, hoveredText); | |
| 74 testRunner.notifyDone(); | |
| 75 } | |
| 76 </script> | |
| 77 | |
| 78 <div id="blue">Blue. | |
| 79 <div id="red">Red.</div> | |
| 80 </div> | |
| 81 | |
| 82 <p>Test for <a href="http://crbug.com/240722">http://crbug.com/240722</a>. If th e mouse cursor is not visible, existing hover effects on a parent should be pres erved if the child is the currently hovered element and is removed from the DOM. </p> | |
| 83 | |
| 84 <div id="console"></div> | |
| 85 </body> | |
| 86 </html> | |
| OLD | NEW |