Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Side by Side Diff: LayoutTests/inspector/elements/hide-shortcut.html

Issue 1308663002: DevTools: simplify WI.CSSProperty and WI.CSSStyleDeclaration interfaces (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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(resolve, reject, pseudo) 7 function pseudoVisibility(resolve, reject, pseudo)
8 { 8 {
9 var parentNode = document.getElementById("parent-node"); 9 var parentNode = document.getElementById("parent-node");
10 resolve(getComputedStyle(parentNode, ":" + pseudo).visibility); 10 resolve(getComputedStyle(parentNode, ":" + pseudo).visibility);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(style.getLiveProperty("visibility").prop ertyText); 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(style.getLiveProperty("visibility").prop ertyText); 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, 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 ===");
90 InspectorTest.addResult(style.getLiveProperty("visibility").prop ertyText); 90 InspectorTest.addResult(getPropertyText(style, "visibility"));
91 InspectorTest.cssModel.computedStylePromise(childNode.id).then(c allback3); 91 InspectorTest.cssModel.computedStylePromise(childNode.id).then(c allback3);
92 } 92 }
93 93
94 function callback3(style) 94 function callback3(style)
95 { 95 {
96 InspectorTest.addResult("=== Child node is visible ==="); 96 InspectorTest.addResult("=== Child node is visible ===");
97 InspectorTest.addResult(style.getLiveProperty("visibility").prop ertyText); 97 InspectorTest.addResult(getPropertyText(style, "visibility"));
98 next(); 98 next();
99 } 99 }
100 }, 100 },
101 101
102 function testToggleHideBeforePseudoShortcutOn(next) 102 function testToggleHideBeforePseudoShortcutOn(next)
103 { 103 {
104 testPseudoToggle(parentNode.beforePseudoElement(), next); 104 testPseudoToggle(parentNode.beforePseudoElement(), next);
105 }, 105 },
106 106
107 function testToggleHideAfterPseudoShortcutOn(next) 107 function testToggleHideAfterPseudoShortcutOn(next)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 { 139 {
140 treeOutline.toggleHideElement(pseudoNode, callback); 140 treeOutline.toggleHideElement(pseudoNode, callback);
141 function callback() 141 function callback()
142 { 142 {
143 InspectorTest.invokePageFunctionPromise("pseudoVisibility", [pseudoN ode.pseudoType()]).then(function(result) { 143 InspectorTest.invokePageFunctionPromise("pseudoVisibility", [pseudoN ode.pseudoType()]).then(function(result) {
144 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node visibility: '" + result + "'"); 144 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node visibility: '" + result + "'");
145 next(); 145 next();
146 }); 146 });
147 } 147 }
148 } 148 }
149
150 function getPropertyText(style, propertyName)
151 {
152 for (var property of style.allProperties) {
153 if (!property.activeInStyle())
154 continue;
155 if (property.name === propertyName)
156 return property.propertyText;
157 }
158 return "";
159 }
149 } 160 }
150 </script> 161 </script>
151 <style> 162 <style>
152 #parent-node::before { 163 #parent-node::before {
153 content: "before"; 164 content: "before";
154 } 165 }
155 166
156 #parent-node::after { 167 #parent-node::after {
157 content: "after"; 168 content: "after";
158 } 169 }
159 </style> 170 </style>
160 </head> 171 </head>
161 172
162 <body> 173 <body>
163 <p> 174 <p>
164 Tests the hide shortcut, which toggles visibility:hidden on the node and it's an cestors. 175 Tests the hide shortcut, which toggles visibility:hidden on the node and it's an cestors.
165 <a href="https://bugs.webkit.org/show_bug.cgi?id=110641">Bug 110641</a> 176 <a href="https://bugs.webkit.org/show_bug.cgi?id=110641">Bug 110641</a>
166 </p> 177 </p>
167 178
168 <div id="parent-node">parent 179 <div id="parent-node">parent
169 <div style="visibility:hidden">hidden 180 <div style="visibility:hidden">hidden
170 <div id="child-node" style="visibility:visible">child</div> 181 <div id="child-node" style="visibility:visible">child</div>
171 </div> 182 </div>
172 </div> 183 </div>
173 184
174 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()"> 185 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()">
175 186
176 </body> 187 </body>
177 </html> 188 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698