Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html

Issue 16285002: Do not invoke or clear hover effects on node deletion when cursor is invisible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for review Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698