| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function addStyle() | 6 function addStyle() |
| 7 { | 7 { |
| 8 var style = document.createElement("style"); | 8 var style = document.createElement("style"); |
| 9 document.documentElement.appendChild(style); | 9 document.documentElement.appendChild(style); |
| 10 style.sheet.insertRule("foo {display: none;}", 0); | 10 style.sheet.insertRule("foo {display: none;}", 0); |
| 11 } | 11 } |
| 12 | 12 |
| 13 function test() | 13 function test() |
| 14 { | 14 { |
| 15 WebInspector.inspectorView.showPanel("elements"); | 15 WebInspector.inspectorView.showPanel("elements"); |
| 16 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetAdded, stylesheetAdded); | 16 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetAdded, stylesheetAdded); |
| 17 InspectorTest.evaluateInPage("addStyle()"); | 17 InspectorTest.evaluateInPage("addStyle()"); |
| 18 | 18 |
| 19 function stylesheetAdded() | 19 function stylesheetAdded() |
| 20 { | 20 { |
| 21 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve
nts.StyleSheetAdded, stylesheetAdded); | 21 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve
nts.StyleSheetAdded, stylesheetAdded); |
| 22 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); | 22 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); |
| 23 } | 23 } |
| 24 | 24 |
| 25 var treeElement; | 25 var treeElement; |
| 26 var hasResourceChanged; | 26 var hasResourceChanged; |
| 27 | 27 |
| 28 function step1() | 28 function step1() |
| 29 { | 29 { |
| 30 // Click "Add new rule". | 30 InspectorTest.addNewRule("inspected", step2); |
| 31 document.getElementById("add-style-button-test-id").click(); | |
| 32 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; | |
| 33 section._selectorElement.textContent = "inspected"; | |
| 34 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Ent
er")); | |
| 35 InspectorTest.runAfterPendingDispatches(step2); | |
| 36 } | 31 } |
| 37 | 32 |
| 38 function step2() | 33 function step2() |
| 39 { | 34 { |
| 40 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; | 35 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; |
| 41 var newProperty = section.addNewBlankProperty(); | 36 var newProperty = section.addNewBlankProperty(); |
| 42 newProperty.startEditing(); | 37 newProperty.startEditing(); |
| 43 newProperty.nameElement.textContent = "color"; | 38 newProperty.nameElement.textContent = "color"; |
| 44 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Ente
r")); | 39 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Ente
r")); |
| 45 newProperty.valueElement.textContent = "maroon"; | 40 newProperty.valueElement.textContent = "maroon"; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 60 | 55 |
| 61 <body onload="runTest()"> | 56 <body onload="runTest()"> |
| 62 <p> | 57 <p> |
| 63 Tests that adding a new rule works when there is a STYLE element after BODY. TIM
EOUT SHOULD NOT OCCUR! <a href="https://bugs.webkit.org/show_bug.cgi?id=111299">
Bug 111299</a> | 58 Tests that adding a new rule works when there is a STYLE element after BODY. TIM
EOUT SHOULD NOT OCCUR! <a href="https://bugs.webkit.org/show_bug.cgi?id=111299">
Bug 111299</a> |
| 64 </p> | 59 </p> |
| 65 | 60 |
| 66 <div id="inspected" style="font-size: 12px">Text</div> | 61 <div id="inspected" style="font-size: 12px">Text</div> |
| 67 | 62 |
| 68 </body> | 63 </body> |
| 69 </html> | 64 </html> |
| OLD | NEW |