| 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 | 6 |
| 7 function pseudoVisibility(pseudo) | 7 function pseudoVisibility(pseudo) |
| 8 { | 8 { |
| 9 var parentNode = document.getElementById("parent-node"); | 9 var parentNode = document.getElementById("parent-node"); |
| 10 return getComputedStyle(parentNode, ":" + pseudo).visibility; | 10 return getComputedStyle(parentNode, ":" + pseudo).visibility; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 function callback3(node) | 45 function callback3(node) |
| 46 { | 46 { |
| 47 frameNode = node; | 47 frameNode = node; |
| 48 next(); | 48 next(); |
| 49 } | 49 } |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 function testToggleHideShortcutOn(next) | 52 function testToggleHideShortcutOn(next) |
| 53 { | 53 { |
| 54 treeOutline.toggleHideElement(parentNode, callback); | 54 treeOutline.toggleHideElement(parentNode).then(callback); |
| 55 | 55 |
| 56 function callback() | 56 function callback() |
| 57 { | 57 { |
| 58 InspectorTest.addResult("=== Added hide shortcut ==="); | 58 InspectorTest.addResult("=== Added hide shortcut ==="); |
| 59 InspectorTest.cssModel.computedStylePromise(parentNode.id).then(
callback2); | 59 InspectorTest.cssModel.computedStylePromise(parentNode.id).then(
callback2); |
| 60 } | 60 } |
| 61 | 61 |
| 62 function callback2(style) | 62 function callback2(style) |
| 63 { | 63 { |
| 64 InspectorTest.addResult("=== Parent node is hidden ==="); | 64 InspectorTest.addResult("=== Parent node is hidden ==="); |
| 65 InspectorTest.addResult(getPropertyText(style, "visibility")); | 65 InspectorTest.addResult(getPropertyText(style, "visibility")); |
| 66 InspectorTest.cssModel.computedStylePromise(childNode.id).then(c
allback3); | 66 InspectorTest.cssModel.computedStylePromise(childNode.id).then(c
allback3); |
| 67 } | 67 } |
| 68 | 68 |
| 69 function callback3(style) | 69 function callback3(style) |
| 70 { | 70 { |
| 71 InspectorTest.addResult("=== Child node is hidden ==="); | 71 InspectorTest.addResult("=== Child node is hidden ==="); |
| 72 InspectorTest.addResult(getPropertyText(style, "visibility")); | 72 InspectorTest.addResult(getPropertyText(style, "visibility")); |
| 73 next(); | 73 next(); |
| 74 } | 74 } |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 function testToggleHideShortcutOff(next) | 77 function testToggleHideShortcutOff(next) |
| 78 { | 78 { |
| 79 treeOutline.toggleHideElement(parentNode, callback); | 79 treeOutline.toggleHideElement(parentNode).then(callback); |
| 80 | 80 |
| 81 function callback() | 81 function callback() |
| 82 { | 82 { |
| 83 InspectorTest.addResult("=== Removed hide shortcut ==="); | 83 InspectorTest.addResult("=== Removed hide shortcut ==="); |
| 84 InspectorTest.cssModel.computedStylePromise(parentNode.id).then(
callback2); | 84 InspectorTest.cssModel.computedStylePromise(parentNode.id).then(
callback2); |
| 85 } | 85 } |
| 86 | 86 |
| 87 function callback2(style) | 87 function callback2(style) |
| 88 { | 88 { |
| 89 InspectorTest.addResult("=== Parent node is visible ==="); | 89 InspectorTest.addResult("=== Parent node is visible ==="); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 114 testPseudoToggle(parentNode.beforePseudoElement(), next); | 114 testPseudoToggle(parentNode.beforePseudoElement(), next); |
| 115 }, | 115 }, |
| 116 | 116 |
| 117 function testToggleHideAfterPseudoShortcutOff(next) | 117 function testToggleHideAfterPseudoShortcutOff(next) |
| 118 { | 118 { |
| 119 testPseudoToggle(parentNode.afterPseudoElement(), next); | 119 testPseudoToggle(parentNode.afterPseudoElement(), next); |
| 120 }, | 120 }, |
| 121 | 121 |
| 122 function testToggleHideShortcutOnInFrame(next) | 122 function testToggleHideShortcutOnInFrame(next) |
| 123 { | 123 { |
| 124 treeOutline.toggleHideElement(frameNode, callback); | 124 treeOutline.toggleHideElement(frameNode).then(callback); |
| 125 | 125 |
| 126 function callback() | 126 function callback() |
| 127 { | 127 { |
| 128 InspectorTest.evaluateInPagePromise("pseudoIframeVisibility()").
then(function(result) { | 128 InspectorTest.evaluateInPagePromise("pseudoIframeVisibility()").
then(function(result) { |
| 129 InspectorTest.addResult("=== Added hide shortcut in frame ==
="); | 129 InspectorTest.addResult("=== Added hide shortcut in frame ==
="); |
| 130 InspectorTest.addResult("=== Frame node is hidden ==="); | 130 InspectorTest.addResult("=== Frame node is hidden ==="); |
| 131 InspectorTest.addResult("visibility: " + result.value + ";")
; | 131 InspectorTest.addResult("visibility: " + result.value + ";")
; |
| 132 next(); | 132 next(); |
| 133 }); | 133 }); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 ]); | 136 ]); |
| 137 | 137 |
| 138 function getPropertyText(computedStyle, propertyName) | 138 function getPropertyText(computedStyle, propertyName) |
| 139 { | 139 { |
| 140 return String.sprintf("%s: %s;", propertyName, computedStyle.get(propert
yName)); | 140 return String.sprintf("%s: %s;", propertyName, computedStyle.get(propert
yName)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 function testPseudoToggle(pseudoNode, next) | 143 function testPseudoToggle(pseudoNode, next) |
| 144 { | 144 { |
| 145 treeOutline.toggleHideElement(pseudoNode, callback); | 145 treeOutline.toggleHideElement(pseudoNode).then(callback); |
| 146 function callback() | 146 function callback() |
| 147 { | 147 { |
| 148 var pseudoNodeTypeArg = pseudoNode.pseudoType() ? ("\"" + pseudoNode
.pseudoType() + "\"") : "undefined"; | 148 var pseudoNodeTypeArg = pseudoNode.pseudoType() ? ("\"" + pseudoNode
.pseudoType() + "\"") : "undefined"; |
| 149 InspectorTest.evaluateInPagePromise("pseudoVisibility(" + pseudoNode
TypeArg + ")").then(function(result) { | 149 InspectorTest.evaluateInPagePromise("pseudoVisibility(" + pseudoNode
TypeArg + ")").then(function(result) { |
| 150 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node
visibility: '" + result.value + "'"); | 150 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node
visibility: '" + result.value + "'"); |
| 151 next(); | 151 next(); |
| 152 }); | 152 }); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 } | 155 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 174 <div id="parent-node">parent | 174 <div id="parent-node">parent |
| 175 <div style="visibility:hidden">hidden | 175 <div style="visibility:hidden">hidden |
| 176 <div id="child-node" style="visibility:visible">child</div> | 176 <div id="child-node" style="visibility:visible">child</div> |
| 177 </div> | 177 </div> |
| 178 </div> | 178 </div> |
| 179 | 179 |
| 180 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()"> | 180 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()"> |
| 181 | 181 |
| 182 </body> | 182 </body> |
| 183 </html> | 183 </html> |
| OLD | NEW |