3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script>
9 WebInspector.showPanel("elements");
10 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
11 InspectorTest.addSniffer(WebInspector.Resource.prototype, "addRevision", revisionAdded);
14 var hasResourceChanged;
18 // Click "Add new rule".
19 document.getElementById("add-style-button-test-id").click();
20 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
21 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
22 InspectorTest.runAfterPendingDispatches(step2);
27 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
28 var newProperty = section.addNewBlankProperty();
29 newProperty.startEditing();
30 newProperty.nameElement.textContent = "color";
31 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
32 newProperty.valueElement.textContent = "maroon";
33 newProperty.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
34 InspectorTest.selectNodeAndWaitForStyles("other", step3);
39 // Click "Add new rule".
40 document.getElementById("add-style-button-test-id").click();
41 InspectorTest.selectNodeAndWaitForStyles("inspected", step4);
46 InspectorTest.addResult("After adding new rule (inspected):");
47 InspectorTest.dumpSelectedElementStyles(true, false, true);
48 InspectorTest.selectNodeAndWaitForStyles("other", step5);
53 InspectorTest.addResult("After adding new rule (other):");
54 InspectorTest.dumpSelectedElementStyles(true, false, true);
55 InspectorTest.completeTest();
58 function revisionAdded(revision)
60 InspectorTest.addResult("Revision added: " + this.parsedURL.displayName);
67 <body onload="runTest()">
69 Tests that adding a new rule works after switching nodes.
72 <div id="inspected" style="font-size: 12px">Text</div>
73 <div id="other" style="color:red"></div>