browser/devtools/inspector/test/browser_inspector_invalidate.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c5337a15ec31
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function test() {
5 let doc;
6 let div;
7 let inspector;
8
9 function createDocument() {
10 div = doc.createElement("div");
11 div.setAttribute("style", "width: 100px; height: 100px; background:yellow;");
12 doc.body.appendChild(div);
13
14 openInspector(aInspector => {
15 inspector = aInspector;
16 inspector.toolbox.highlighter.showBoxModel(getNodeFront(div)).then(runTest);
17 });
18 }
19
20 function runTest() {
21 let rect = getSimpleBorderRect();
22 is(rect.width, 100, "outline has the right width");
23
24 div.style.width = "200px";
25 inspector.toolbox.once("highlighter-ready", testRectWidth);
26 }
27
28 function testRectWidth() {
29 let rect = getSimpleBorderRect();
30 is(rect.width, 200, "outline updated");
31 finishUp();
32 }
33
34 function finishUp() {
35 inspector.toolbox.highlighter.hideBoxModel().then(() => {
36 doc = div = inspector = null;
37 gBrowser.removeCurrentTab();
38 finish();
39 });
40 }
41
42 waitForExplicitFinish();
43 gBrowser.selectedTab = gBrowser.addTab();
44 gBrowser.selectedBrowser.addEventListener("load", function() {
45 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
46 doc = content.document;
47 waitForFocus(createDocument, content);
48 }, true);
49
50 content.location = "data:text/html;charset=utf-8,browser_inspector_invalidate.js";
51 }

mercurial