3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
9 InspectorTest.selectNodeAndWaitForStyles("inspected", pasteFirstProperty);
11 function pasteFirstProperty()
13 InspectorTest.addResult("Before pasting:");
14 InspectorTest.dumpSelectedElementStyles(true);
15 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][1];
18 var treeElement = section.addNewBlankProperty(0);
19 pasteProperty(treeElement, "margin-left: 1px", pasteTwoProperties);
22 function pasteTwoProperties()
24 InspectorTest.addResult("After pasting 'margin-left: 1px':");
25 InspectorTest.dumpSelectedElementStyles(true);
27 var treeElement = WebInspector.panels.elements.sidebarPanes.styles.sections[0][1].addNewBlankProperty(2);
28 pasteProperty(treeElement, "margin-top: 1px; color: red;", pasteOverExistingProperty);
31 function pasteOverExistingProperty()
33 InspectorTest.addResult("After pasting 'margin-top: 1px; color: red;':");
34 InspectorTest.dumpSelectedElementStyles(true);
36 var treeElement = InspectorTest.getElementStylePropertyTreeItem("margin-top");
37 pasteProperty(treeElement, "foo: bar; moo: zoo", dumpAndComplete);
40 function dumpAndComplete()
42 InspectorTest.addResult("After pasting 'foo: bar; moo: zoo' over 'margin-top':");
43 InspectorTest.dumpSelectedElementStyles(true);
45 InspectorTest.completeTest();
48 function pasteProperty(treeElement, propertyText, callback)
50 treeElement.nameElement.textContent = propertyText;
51 treeElement.startEditing();
53 document.execCommand("SelectAll");
54 document.execCommand("Copy");
55 InspectorTest.waitForStyleApplied(reloadStyles.bind(this, callback));
56 document.execCommand("Paste");
59 function reloadStyles(callback) {
60 InspectorTest.selectNodeAndWaitForStyles("other", otherCallback);
62 function otherCallback()
64 InspectorTest.selectNodeAndWaitForStyles("inspected", callback);
72 <body onload="runTest()">
74 Tests that splitting properties when pasting works.
77 <div id="inspected" style="font-size: 12px">Text</div>
78 <div id="other"></div>