3 <link rel=
"stylesheet" href=
"resources/style.css">
4 <script src=
"../inspector/inspector-test.js"></script>
5 <script src=
"../inspector/elements-test.js"></script>
13 function reopenWebInspector(objectId
)
16 testRunner
.closeWebInspector();
17 setTimeout(function() {
18 testRunner
.showWebInspector();
25 delete window
.didReopen
;
26 if (window
.testRunner
)
27 testRunner
.waitUntilDone();
28 if (window
.testRunner
)
29 testRunner
.showWebInspector();
35 InspectorTest
.RuntimeAgent
.evaluate("window.didReopen", dispatch
);
37 function dispatch(error
, result
, wasThrown
)
39 if (result
.type
!== "number") {
40 InspectorTest
.addResult("Opening front-end for the first time");
43 InspectorTest
.addResult("Opening front-end second time");
44 InspectorTest
.addResult("Dump styles after inspector was reopened:");
45 dump(InspectorTest
.completeTest
);
49 function testFirstOpen()
51 InspectorTest
.addResult("Dump initial styles:");
54 function onStylesDumped()
56 treeElement
= InspectorTest
.getMatchedStylePropertyTreeItem("color");
57 treeElement
.startEditing();
58 treeElement
.nameElement
.textContent
= "color";
59 treeElement
.nameElement
.dispatchEvent(InspectorTest
.createKeyEvent("Enter"));
62 treeElement
.valueElement
.textContent
= "green";
63 treeElement
.valueElement
.firstChild
.select();
64 treeElement
.valueElement
.dispatchEvent(InspectorTest
.createKeyEvent("Enter"));
65 InspectorTest
.waitForStyleApplied(onStyleSheetPropertyEdited
);
68 function onStyleSheetPropertyEdited()
70 treeElement
= InspectorTest
.getMatchedStylePropertyTreeItem("font-family");
71 treeElement
.startEditing();
72 treeElement
.nameElement
.textContent
= "font-family";
73 treeElement
.nameElement
.dispatchEvent(InspectorTest
.createKeyEvent("Enter"));
76 treeElement
.valueElement
.textContent
= "Helvetica";
77 treeElement
.valueElement
.firstChild
.select();
78 treeElement
.valueElement
.dispatchEvent(InspectorTest
.createKeyEvent("Enter"));
79 InspectorTest
.waitForStyleApplied(onStyleTagPropertyEdited
);
82 function onStyleTagPropertyEdited()
84 InspectorTest
.addNewRule("#testDiv, my-custom-tag", onFirstRuleAdded
);
87 function onFirstRuleAdded()
89 InspectorTest
.addNewRule("#testDiv, another-custom-tag", onSecondRuleAdded
);
92 function onSecondRuleAdded()
94 InspectorTest
.domModel
.undo(onRuleRemoved
);
97 function onRuleRemoved()
99 InspectorTest
.selectNodeAndWaitForStyles("other", step4
);
104 InspectorTest
.addResult("Dump styles after editing:");
105 dump(reopenInspector
);
109 function reopenInspector()
111 InspectorTest
.flushResults();
112 InspectorTest
.evaluateInPage("reopenWebInspector()");
115 function dump(callback
)
117 InspectorTest
.selectNodeAndWaitForStyles("testDiv", step2
);
121 InspectorTest
.dumpSelectedElementStyles(true);
129 <body onload=
"initTest()">
130 <p>This test checks that styles edited through inspector are correctly shown upon reattach.
</p>
131 <div id=
"testDiv"></div>
132 <div id=
"other"></div>