| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script type="text/javascript" src="css-protocol-test.js"></script> |
| 5 <script type="text/javascript" src="edit-range-utils.js"></script> |
| 6 <script type="text/javascript"> |
| 7 function test() |
| 8 { |
| 9 var editStyleSheet; |
| 10 var checkProtocolError; |
| 11 |
| 12 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled); |
| 13 |
| 14 function onCSSEnabled() |
| 15 { |
| 16 InspectorTest.requestNodeId("#reddiv", onNodeRecieved); |
| 17 } |
| 18 |
| 19 function onNodeRecieved(nodeId) |
| 20 { |
| 21 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { |
| 22 nodeId: nodeId, |
| 23 }, onInlineStyleRecieved); |
| 24 } |
| 25 |
| 26 function onInlineStyleRecieved(result) |
| 27 { |
| 28 var styleSheetId = result.inlineStyle.styleId.styleSheetId; |
| 29 editStyleSheet = InspectorTest.editStyleSheet.bind(null, styleSheetId); |
| 30 checkProtocolError = InspectorTest.checkProtocolError.bind(null, styleSh
eetId); |
| 31 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
styleSheetId }, onInitialStyleSheetText); |
| 32 } |
| 33 |
| 34 function onInitialStyleSheetText(result) |
| 35 { |
| 36 InspectorTest.log("==== Initial style sheet text ===="); |
| 37 InspectorTest.log(result.text); |
| 38 InspectorTest.runTestSuite(testSuite); |
| 39 } |
| 40 |
| 41 var testSuite = [ |
| 42 function testEditProperty(next) |
| 43 { |
| 44 editStyleSheet({ |
| 45 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 10
}, |
| 46 text: "content: 'EDITED PROPERTY'" |
| 47 }, InspectorTest.undoAndNext(next)); |
| 48 }, |
| 49 |
| 50 function testBreakingCommentEditProperty(next) |
| 51 { |
| 52 checkProtocolError({ |
| 53 range: { startLine: 0, startColumn: 4, endLine: 0, endColumn: 10
}, |
| 54 text: "/*<--OPENED COMMENT" |
| 55 }, next); |
| 56 }, |
| 57 |
| 58 function testInsertFirstProperty(next) |
| 59 { |
| 60 editStyleSheet({ |
| 61 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0
}, |
| 62 text: "content: 'INSERTED PROPERTY';" |
| 63 }, InspectorTest.undoAndNext(next)); |
| 64 }, |
| 65 |
| 66 function testInsertLastProperty(next) |
| 67 { |
| 68 editStyleSheet({ |
| 69 range: { startLine: 0, startColumn: 24, endLine: 0, endColumn: 2
4 }, |
| 70 text: "content: 'INSERTED PROPERTY';" |
| 71 }, InspectorTest.undoAndNext(next)); |
| 72 }, |
| 73 |
| 74 function testInsertMultipleProperties(next) |
| 75 { |
| 76 editStyleSheet({ |
| 77 range: { startLine: 0, startColumn: 11, endLine: 0, endColumn: 1
1 }, |
| 78 text: "content: 'INSERTED #1';content: 'INSERTED #2';" |
| 79 }, InspectorTest.undoAndNext(next)); |
| 80 }, |
| 81 ]; |
| 82 } |
| 83 |
| 84 </script> |
| 85 </head> |
| 86 <body onload="runTest();"> |
| 87 <div id="reddiv" style="color: red; border: 0px;">Some red text goes here</d
iv> |
| 88 </body> |
| 89 </html> |
| OLD | NEW |