3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
9 InspectorTest
.selectNodeAndWaitForStyles("inspected", step1
);
10 InspectorTest
.addSniffer(WebInspector
.UISourceCode
.prototype, "addRevision", onRevisionAdded
);
13 var hasResourceChanged
;
15 var revisionAdded
= false;
16 var testFinished
= false;
21 InspectorTest
.addNewRule("foo, div#inspected, bar", step2
);
26 var section
= InspectorTest
.firstMatchedStyleSection();
27 var newProperty
= section
.addNewBlankProperty();
28 newProperty
.startEditing();
29 textInputController
.insertText("color");
30 eventSender
.keyDown(":");
31 textInputController
.insertText("maroon");
32 InspectorTest
.waitForStyleApplied(step3
);
33 eventSender
.keyDown(";");
37 InspectorTest
.selectNodeAndWaitForStyles("other", step4
);
42 InspectorTest
.addNewRule(null, onRuleAdded
);
44 function onRuleAdded()
46 InspectorTest
.selectNodeAndWaitForStyles("inspected", step5
);
52 InspectorTest
.addResult("After adding new rule (inspected):");
53 InspectorTest
.dumpSelectedElementStyles(true, false, true, true);
54 InspectorTest
.selectNodeAndWaitForStyles("other", step6
);
59 InspectorTest
.addResult("After adding new rule (other):");
60 InspectorTest
.dumpSelectedElementStyles(true, false, true);
65 function maybeCompleteTest()
67 if (!testFinished
|| !revisionAdded
)
69 InspectorTest
.addResult("Revision added: " + displayName
);
70 InspectorTest
.completeTest();
73 function onRevisionAdded(revision
)
76 displayName
= this.displayName();
84 <body onload=
"runTest()">
86 Tests that adding a new rule works after switching nodes.
89 <div id=
"inspected" style=
"font-size: 12px">Text
</div>
90 <div id=
"other" style=
"color:red"></div>