Chromium Code Reviews| Index: LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html |
| diff --git a/LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html b/LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c8e5520ed7907d0c9ad42d14082ba37973585c2d |
| --- /dev/null |
| +++ b/LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html |
| @@ -0,0 +1,86 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<style> |
| +#red { |
| + background-color: red; |
| + position: absolute; |
| + left: 50px; |
| + top: 50px; |
| + height: 100px; |
| + width: 100px; |
| +} |
| +#red:hover::after { |
| + content: " Hovered."; |
| +} |
| + |
| +#blue { |
| + background-color: blue; |
| + position: absolute; |
| + left: 50px; |
| + top: 50px; |
| + height: 100px; |
| + width: 100px; |
| +} |
| +#blue:hover::after { |
| + content: " Hovered."; |
| +} |
| + |
| +</style> |
| +<script src="../js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body onload="runtest()" style="margin:0"> |
| + |
| +<script type="text/javascript"> |
| +var redDiv; |
| +var hoveredText = " Hovered."; |
| +function runtest() |
| +{ |
| + if (!window.testRunner || !window.eventSender) |
| + return; |
| + |
| + if (!window.internals || !window.internals.setIsCursorVisible) { |
| + debug("window.internals.setIsCursorVisible is required to run this test."); |
| + return; |
| + } |
| + |
| + testRunner.waitUntilDone(); |
| + |
| + redDiv = document.getElementById('red'); |
| + |
| + document.addEventListener('keydown', function(e) { |
| + redDiv.parentNode.removeChild(redDiv); |
| + }); |
| + |
| + debug("Mouse is visible, moving it over the red div."); |
| + internals.setIsCursorVisible(document, true); |
| + eventSender.mouseMoveTo(175, 175); |
| + 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.
|
| + shouldBeEqualToString(window.getComputedStyle(document.querySelector('#red'), ':after').content, hoveredText); |
| + |
| + debug("Setting mouse cursor to be invisible."); |
| + internals.setIsCursorVisible(document, false); |
| + shouldBeEqualToString(window.getComputedStyle(document.querySelector('#blue'), ':after').content, hoveredText); |
| + shouldBeEqualToString(window.getComputedStyle(document.querySelector('#red'), ':after').content, hoveredText); |
| + |
| + debug("Deleting red div."); |
| + eventSender.keyDown("a"); |
| + 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.
|
| +} |
| + |
| +function testAfterDelete() |
| +{ |
| + shouldBeEqualToString(window.getComputedStyle(document.querySelector('#blue'), ':after').content, hoveredText); |
| + testRunner.notifyDone(); |
| +} |
| +</script> |
| + |
| +<div id="blue">Blue. |
| + <div id="red">Red.</div> |
| +</div> |
| + |
| +<p>Test for <a href="http://crbug.com/240722">http://crbug.com/240722</a>. If the mouse cursor is not visible, existing hover effects on a parent should be preserved if the child is the currently hovered element and is removed from the DOM.</p> |
| + |
| +<div id="console"></div> |
| +</body> |
| +</html> |