browser/devtools/markupview/test/browser_markupview_highlight_hover_01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 2 /* Any copyright is dedicated to the Public Domain.
michael@0 3 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 // Test that when first hovering over a node and immediately after selecting it
michael@0 8 // by clicking on it leaves the highlighter visible for as long as the mouse is
michael@0 9 // over the node
michael@0 10
michael@0 11 let test = asyncTest(function*() {
michael@0 12 let {inspector} = yield addTab("data:text/html,<p>It's going to be legen....</p>").then(openInspector);
michael@0 13 let p = getNode("p");
michael@0 14
michael@0 15 info("hovering over the <p> line in the markup-view");
michael@0 16 yield hoverContainer(p, inspector);
michael@0 17 ok(isHighlighterVisible(), "the highlighter is still visible");
michael@0 18
michael@0 19 info("selecting the <p> line by clicking in the markup-view");
michael@0 20 yield clickContainer(p, inspector);
michael@0 21
michael@0 22 p.textContent = "wait for it ....";
michael@0 23 info("wait and see if the highlighter stays visible even after the node was selected");
michael@0 24 yield waitForTheBrieflyShowBoxModelTimeout();
michael@0 25
michael@0 26 let updated = inspector.once("inspector-updated");
michael@0 27 p.textContent = "dary!!!!";
michael@0 28 ok(isHighlighterVisible(), "the highlighter is still visible");
michael@0 29 yield updated;
michael@0 30 });
michael@0 31
michael@0 32 function waitForTheBrieflyShowBoxModelTimeout() {
michael@0 33 let deferred = promise.defer();
michael@0 34 // Note that the current timeout is 1 sec and is neither configurable nor
michael@0 35 // exported anywhere we can access, so hard-coding the timeout
michael@0 36 content.setTimeout(deferred.resolve, 1500);
michael@0 37 return deferred.promise;
michael@0 38 }

mercurial