3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script>
14 InspectorTest.runTestSuite([
15 function testSetUp(next)
17 treeOutline = InspectorTest.firstElementsTreeOutline();
19 InspectorTest.nodeWithId("parent-node", callback);
21 function callback(node)
24 InspectorTest.nodeWithId("child-node", callback2);
27 function callback2(node)
30 InspectorTest.nodeWithId("frame-node", callback3);
33 function callback3(node)
40 function testToggleHideShortcutOn(next)
42 treeOutline._toggleHideShortcut(parentNode, callback);
46 InspectorTest.addResult("=== Added hide shortcut ===");
47 WebInspector.cssModel.getComputedStyleAsync(parentNode.id, callback2);
50 function callback2(style)
52 InspectorTest.addResult("=== Parent node is hidden ===");
53 InspectorTest.addResult(style.getLiveProperty("visibility").propertyText);
54 WebInspector.cssModel.getComputedStyleAsync(childNode.id, callback3);
57 function callback3(style)
59 InspectorTest.addResult("=== Child node is hidden ===");
60 InspectorTest.addResult(style.getLiveProperty("visibility").propertyText);
65 function testToggleHideShortcutOff(next)
67 treeOutline._toggleHideShortcut(parentNode, callback);
71 InspectorTest.addResult("=== Removed hide shortcut ===");
72 WebInspector.cssModel.getComputedStyleAsync(parentNode.id, callback2);
75 function callback2(style)
77 InspectorTest.addResult("=== Parent node is visible ===");
78 InspectorTest.addResult(style.getLiveProperty("visibility").propertyText);
79 WebInspector.cssModel.getComputedStyleAsync(childNode.id, callback3);
82 function callback3(style)
84 InspectorTest.addResult("=== Child node is visible ===");
85 InspectorTest.addResult(style.getLiveProperty("visibility").propertyText);
90 function testToggleHideBeforePseudoShortcutOn(next)
92 testPseudoToggle(WebInspector.DOMNode.PseudoElementNames.Before, next);
95 function testToggleHideAfterPseudoShortcutOn(next)
97 testPseudoToggle(WebInspector.DOMNode.PseudoElementNames.After, next);
100 function testToggleHideBeforePseudoShortcutOff(next)
102 testPseudoToggle(WebInspector.DOMNode.PseudoElementNames.Before, next);
105 function testToggleHideAfterPseudoShortcutOff(next)
107 testPseudoToggle(WebInspector.DOMNode.PseudoElementNames.After, next);
110 function testToggleHideShortcutOnInFrame(next)
112 treeOutline._toggleHideShortcut(frameNode, callback);
116 InspectorTest.addResult("=== Added hide shortcut in frame ===");
117 WebInspector.cssModel.getComputedStyleAsync(frameNode.id, callback2);
120 function callback2(style)
122 InspectorTest.addResult("=== Frame node is hidden ===");
123 InspectorTest.addResult(style.getLiveProperty("visibility").propertyText);
129 function testPseudoToggle(pseudoType, next)
131 var pseudoNode = parentNode.pseudoElements()[pseudoType];
132 treeOutline._toggleHideShortcut(pseudoNode, callback);
136 WebInspector.cssModel.getComputedStyleAsync(pseudoNode.id, callback2);
139 function callback2(style)
141 InspectorTest.addResult("::" + pseudoType + " node visibility: '" + style.getLiveProperty("visibility").value + "'");
148 #parent-node::before {
152 #parent-node::after {
160 Tests the hide shortcut, which toggles visibility:hidden on the node and it's ancestors.
161 <a href="https://bugs.webkit.org/show_bug.cgi?id=110641">Bug 110641</a>
164 <div id="parent-node">parent
165 <div style="visibility:hidden">hidden
166 <div id="child-node" style="visibility:visible">child</div>
170 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()">