| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function test() | |
| 8 { | |
| 9 InspectorTest.selectNodeAndWaitForStyles("inspected", pasteFirstProperty); | |
| 10 | |
| 11 function pasteFirstProperty() | |
| 12 { | |
| 13 InspectorTest.addResult("Before pasting:"); | |
| 14 InspectorTest.dumpSelectedElementStyles(true); | |
| 15 var section = InspectorTest.inlineStyleSection(); | |
| 16 | |
| 17 var treeElement = section.addNewBlankProperty(0); | |
| 18 pasteProperty(treeElement, "margin-left: 1px", pasteTwoProperties); | |
| 19 } | |
| 20 | |
| 21 function pasteTwoProperties() | |
| 22 { | |
| 23 InspectorTest.addResult("After pasting 'margin-left: 1px':"); | |
| 24 InspectorTest.dumpSelectedElementStyles(true); | |
| 25 | |
| 26 var treeElement = InspectorTest.inlineStyleSection().addNewBlankProperty
(2); | |
| 27 pasteProperty(treeElement, "margin-top: 1px; color: red;", pasteOverExis
tingProperty); | |
| 28 } | |
| 29 | |
| 30 function pasteOverExistingProperty() | |
| 31 { | |
| 32 InspectorTest.addResult("After pasting 'margin-top: 1px; color: red;':")
; | |
| 33 InspectorTest.dumpSelectedElementStyles(true); | |
| 34 | |
| 35 var treeElement = InspectorTest.getElementStylePropertyTreeItem("margin-
top"); | |
| 36 pasteProperty(treeElement, "foo: bar; moo: zoo", dumpAndComplete); | |
| 37 } | |
| 38 | |
| 39 function dumpAndComplete() | |
| 40 { | |
| 41 InspectorTest.addResult("After pasting 'foo: bar; moo: zoo' over 'margin
-top':"); | |
| 42 InspectorTest.dumpSelectedElementStyles(true); | |
| 43 | |
| 44 InspectorTest.completeTest(); | |
| 45 } | |
| 46 | |
| 47 function pasteProperty(treeElement, propertyText, callback) | |
| 48 { | |
| 49 treeElement.nameElement.textContent = propertyText; | |
| 50 treeElement.startEditing(); | |
| 51 | |
| 52 document.execCommand("SelectAll"); | |
| 53 document.execCommand("Copy"); | |
| 54 InspectorTest.waitForStyleApplied(reloadStyles.bind(this, callback)); | |
| 55 document.execCommand("Paste"); | |
| 56 } | |
| 57 | |
| 58 function reloadStyles(callback) { | |
| 59 InspectorTest.selectNodeAndWaitForStyles("other", otherCallback); | |
| 60 | |
| 61 function otherCallback() | |
| 62 { | |
| 63 InspectorTest.selectNodeAndWaitForStyles("inspected", callback); | |
| 64 } | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 </script> | |
| 69 </head> | |
| 70 | |
| 71 <body onload="runTest()"> | |
| 72 <p> | |
| 73 Tests that splitting properties when pasting works. | |
| 74 </p> | |
| 75 | |
| 76 <div id="inspected" style="font-size: 12px">Text</div> | |
| 77 <div id="other"></div> | |
| 78 | |
| 79 </body> | |
| 80 </html> | |
| OLD | NEW |