Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / hide-shortcut.html
blob5a18711f2d292eb7ef9bee4cf038af32c4198184
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>
7 function pseudoVisibility(resolve, reject, pseudo)
9 var parentNode = document.getElementById("parent-node");
10 resolve(getComputedStyle(parentNode, ":" + pseudo).visibility);
13 function pseudoIframeVisibility(resolve, reject)
15 var parentNode = frames[0].document.getElementById("frame-node");
16 resolve(getComputedStyle(parentNode).visibility);
19 function test()
21 var treeOutline;
22 var parentNode;
23 var childNode;
24 var frameNode;
26 InspectorTest.runTestSuite([
27 function testSetUp(next)
29 treeOutline = InspectorTest.firstElementsTreeOutline();
31 InspectorTest.nodeWithId("parent-node", callback);
33 function callback(node)
35 parentNode = node
36 InspectorTest.nodeWithId("child-node", callback2);
39 function callback2(node)
41 childNode = node;
42 InspectorTest.nodeWithId("frame-node", callback3);
45 function callback3(node)
47 frameNode = node;
48 next();
52 function testToggleHideShortcutOn(next)
54 treeOutline.toggleHideElement(parentNode, callback);
56 function callback()
58 InspectorTest.addResult("=== Added hide shortcut ===");
59 InspectorTest.cssModel.computedStylePromise(parentNode.id).then(callback2);
62 function callback2(style)
64 InspectorTest.addResult("=== Parent node is hidden ===");
65 InspectorTest.addResult(getPropertyText(style, "visibility"));
66 InspectorTest.cssModel.computedStylePromise(childNode.id).then(callback3);
69 function callback3(style)
71 InspectorTest.addResult("=== Child node is hidden ===");
72 InspectorTest.addResult(getPropertyText(style, "visibility"));
73 next();
77 function testToggleHideShortcutOff(next)
79 treeOutline.toggleHideElement(parentNode, callback);
81 function callback()
83 InspectorTest.addResult("=== Removed hide shortcut ===");
84 InspectorTest.cssModel.computedStylePromise(parentNode.id).then(callback2);
87 function callback2(style)
89 InspectorTest.addResult("=== Parent node is visible ===");
90 InspectorTest.addResult(getPropertyText(style, "visibility"));
91 InspectorTest.cssModel.computedStylePromise(childNode.id).then(callback3);
94 function callback3(style)
96 InspectorTest.addResult("=== Child node is visible ===");
97 InspectorTest.addResult(getPropertyText(style, "visibility"));
98 next();
102 function testToggleHideBeforePseudoShortcutOn(next)
104 testPseudoToggle(parentNode.beforePseudoElement(), next);
107 function testToggleHideAfterPseudoShortcutOn(next)
109 testPseudoToggle(parentNode.afterPseudoElement(), next);
112 function testToggleHideBeforePseudoShortcutOff(next)
114 testPseudoToggle(parentNode.beforePseudoElement(), next);
117 function testToggleHideAfterPseudoShortcutOff(next)
119 testPseudoToggle(parentNode.afterPseudoElement(), next);
122 function testToggleHideShortcutOnInFrame(next)
124 treeOutline.toggleHideElement(frameNode, callback);
126 function callback()
128 InspectorTest.invokePageFunctionPromise("pseudoIframeVisibility", []).then(function(result) {
129 InspectorTest.addResult("=== Added hide shortcut in frame ===");
130 InspectorTest.addResult("=== Frame node is hidden ===");
131 InspectorTest.addResult("visibility: " + result + ";");
132 next();
138 function getPropertyText(computedStyle, propertyName)
140 return String.sprintf("%s: %s;", propertyName, computedStyle.get(propertyName));
143 function testPseudoToggle(pseudoNode, next)
145 treeOutline.toggleHideElement(pseudoNode, callback);
146 function callback()
148 InspectorTest.invokePageFunctionPromise("pseudoVisibility", [pseudoNode.pseudoType()]).then(function(result) {
149 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node visibility: '" + result + "'");
150 next();
155 </script>
156 <style>
157 #parent-node::before {
158 content: "before";
161 #parent-node::after {
162 content: "after";
164 </style>
165 </head>
167 <body>
169 Tests the hide shortcut, which toggles visibility:hidden on the node and it's ancestors.
170 <a href="https://bugs.webkit.org/show_bug.cgi?id=110641">Bug 110641</a>
171 </p>
173 <div id="parent-node">parent
174 <div style="visibility:hidden">hidden
175 <div id="child-node" style="visibility:visible">child</div>
176 </div>
177 </div>
179 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()">
181 </body>
182 </html>