1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/markupview/test/browser_markupview_highlight_hover_01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +// Test that when first hovering over a node and immediately after selecting it 1.11 +// by clicking on it leaves the highlighter visible for as long as the mouse is 1.12 +// over the node 1.13 + 1.14 +let test = asyncTest(function*() { 1.15 + let {inspector} = yield addTab("data:text/html,<p>It's going to be legen....</p>").then(openInspector); 1.16 + let p = getNode("p"); 1.17 + 1.18 + info("hovering over the <p> line in the markup-view"); 1.19 + yield hoverContainer(p, inspector); 1.20 + ok(isHighlighterVisible(), "the highlighter is still visible"); 1.21 + 1.22 + info("selecting the <p> line by clicking in the markup-view"); 1.23 + yield clickContainer(p, inspector); 1.24 + 1.25 + p.textContent = "wait for it ...."; 1.26 + info("wait and see if the highlighter stays visible even after the node was selected"); 1.27 + yield waitForTheBrieflyShowBoxModelTimeout(); 1.28 + 1.29 + let updated = inspector.once("inspector-updated"); 1.30 + p.textContent = "dary!!!!"; 1.31 + ok(isHighlighterVisible(), "the highlighter is still visible"); 1.32 + yield updated; 1.33 +}); 1.34 + 1.35 +function waitForTheBrieflyShowBoxModelTimeout() { 1.36 + let deferred = promise.defer(); 1.37 + // Note that the current timeout is 1 sec and is neither configurable nor 1.38 + // exported anywhere we can access, so hard-coding the timeout 1.39 + content.setTimeout(deferred.resolve, 1500); 1.40 + return deferred.promise; 1.41 +}