3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
7 var initialize_AdditionalPreload = function() {
8 InspectorTest
.preloadModule("source_frame");
13 InspectorTest
.selectNodeAndWaitForStyles("inspected", step1
);
14 InspectorTest
.addSniffer(WebInspector
.UISourceCode
.prototype, "addRevision", onRevisionAdded
);
17 var hasResourceChanged
;
19 var testFinished
= false;
20 var revisionAdded
= false;
25 // Click "Add new rule".
26 InspectorTest
.addNewRule("foo, div#inspected, bar", step2
);
31 var section
= InspectorTest
.firstMatchedStyleSection();
32 var newProperty
= section
.addNewBlankProperty();
33 newProperty
.startEditing();
34 textInputController
.insertText("color");
35 newProperty
.nameElement
.dispatchEvent(InspectorTest
.createKeyEvent("U+0009")); // Tab
36 textInputController
.insertText("maroon");
37 newProperty
.valueElement
.dispatchEvent(InspectorTest
.createKeyEvent("U+0009")); // Tab
38 InspectorTest
.selectNodeAndWaitForStyles("other", step3
);
43 // Click "Add new rule".
44 InspectorTest
.addNewRule(null, onRuleAdded
);
46 function onRuleAdded()
48 InspectorTest
.selectNodeAndWaitForStyles("inspected", step4
);
54 InspectorTest
.addResult("After adding new rule (inspected):");
55 InspectorTest
.dumpSelectedElementStyles(true, false, true, true);
56 InspectorTest
.selectNodeAndWaitForStyles("other", step5
);
61 InspectorTest
.addResult("After adding new rule (other):");
62 InspectorTest
.dumpSelectedElementStyles(true, false, true);
67 function maybeCompleteTest()
69 if (!testFinished
|| !revisionAdded
)
71 InspectorTest
.addResult("Revision added: " + displayName
);
72 InspectorTest
.completeTest();
75 function onRevisionAdded(revision
)
77 displayName
= this.displayName();
86 <body onload=
"runTest()">
88 Tests that adding a new rule works after switching nodes.
91 <div id=
"inspected" style=
"font-size: 12px">Text
</div>
92 <div id=
"other" style=
"color:red"></div>