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", pasteFirstProperty);
12 function pasteFirstProperty()
14 InspectorTest.addResult("Before pasting:");
15 InspectorTest.dumpSelectedElementStyles(true);
16 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][1];
19 var treeElement = section.addNewBlankProperty(0);
20 pasteProperty(treeElement, "margin-left: 1px", pasteTwoProperties);
23 function pasteTwoProperties()
25 InspectorTest.addResult("After pasting 'margin-left: 1px':");
26 InspectorTest.dumpSelectedElementStyles(true);
28 var treeElement = WebInspector.panels.elements.sidebarPanes.styles.sections[0][1].addNewBlankProperty(2);
29 pasteProperty(treeElement, "margin-top: 1px; color: red;", pasteOverExistingProperty);
32 function pasteOverExistingProperty()
34 InspectorTest.addResult("After pasting 'margin-top: 1px; color: red;':");
35 InspectorTest.dumpSelectedElementStyles(true);
37 var treeElement = InspectorTest.getElementStylePropertyTreeItem("margin-top");
38 pasteProperty(treeElement, "foo: bar; moo: zoo", dumpAndComplete);
41 function dumpAndComplete()
43 InspectorTest.addResult("After pasting 'foo: bar; moo: zoo' over 'margin-top':");
44 InspectorTest.dumpSelectedElementStyles(true);
46 InspectorTest.completeTest();
49 function pasteProperty(treeElement, propertyText, callback)
51 treeElement.nameElement.textContent = propertyText;
52 treeElement.startEditing();
54 document.execCommand("SelectAll");
55 document.execCommand("Copy");
56 document.execCommand("Paste");
57 InspectorTest.runAfterPendingDispatches(reloadStyles.bind(this, callback));
60 function reloadStyles(callback) {
61 InspectorTest.selectNodeWithId("other");
62 InspectorTest.runAfterPendingDispatches(otherCallback);
64 function otherCallback()
66 InspectorTest.selectNodeAndWaitForStyles("inspected", callback);
74 <body onload="runTest()">
76 Tests that splitting properties when pasting works.
79 <div id="inspected" style="font-size: 12px">Text</div>
80 <div id="other"></div>