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> | 4 <script> |
5 | 5 |
6 function test() | 6 function test() |
7 { | 7 { |
8 function TestWidget(widgetName) | 8 function TestWidget(widgetName) |
9 { | 9 { |
10 WebInspector.Widget.call(this); | 10 WebInspector.Widget.call(this); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 else | 144 else |
145 InspectorTest.addResult("FAILED"); | 145 InspectorTest.addResult("FAILED"); |
146 next(); | 146 next(); |
147 }, | 147 }, |
148 | 148 |
149 function testEvents(next) | 149 function testEvents(next) |
150 { | 150 { |
151 var parentWidget = new TestWidget("Parent"); | 151 var parentWidget = new TestWidget("Parent"); |
152 parentWidget.markAsRoot(); | 152 parentWidget.markAsRoot(); |
153 var childWidget = new TestWidget("Child"); | 153 var childWidget = new TestWidget("Child"); |
154 parentWidget.show(WebInspector.inspectorView.element); | 154 parentWidget.show(document.body); |
155 | 155 |
156 parentWidget.doResize(); | 156 parentWidget.doResize(); |
157 childWidget.show(parentWidget.element); | 157 childWidget.show(parentWidget.element); |
158 parentWidget.doResize(); | 158 parentWidget.doResize(); |
159 parentWidget.detach(); | 159 parentWidget.detach(); |
160 parentWidget.show(WebInspector.inspectorView.element); | 160 parentWidget.show(document.body); |
161 childWidget.detach(); | 161 childWidget.detach(); |
162 parentWidget.detach(); | 162 parentWidget.detach(); |
163 next(); | 163 next(); |
164 }, | 164 }, |
165 | 165 |
166 function testEventsHideOnDetach(next) | 166 function testEventsHideOnDetach(next) |
167 { | 167 { |
168 var parentWidget = new TestWidget("Parent"); | 168 var parentWidget = new TestWidget("Parent"); |
169 var childWidget = new TestWidget("Child"); | 169 var childWidget = new TestWidget("Child"); |
170 childWidget.setHideOnDetach(); | 170 childWidget.setHideOnDetach(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 function testResizeOnWasShown(next) | 335 function testResizeOnWasShown(next) |
336 { | 336 { |
337 var parentWidget = new TestWidget("Parent"); | 337 var parentWidget = new TestWidget("Parent"); |
338 var childWidget = new TestWidget("Child"); | 338 var childWidget = new TestWidget("Child"); |
339 childWidget.show(parentWidget.element); | 339 childWidget.show(parentWidget.element); |
340 parentWidget.resizeOnWasShown = childWidget; | 340 parentWidget.resizeOnWasShown = childWidget; |
341 parentWidget.show(WebInspector.inspectorView.element); | 341 parentWidget.show(WebInspector.inspectorView.element); |
342 parentWidget.detach(); | 342 parentWidget.detach(); |
343 next(); | 343 next(); |
| 344 }, |
| 345 |
| 346 function testAlienParent(next) |
| 347 { |
| 348 var parentWidget1 = new TestWidget("Parent"); |
| 349 var parentWidget2 = new TestWidget("Parent"); |
| 350 var childWidget = new TestWidget("Child"); |
| 351 childWidget.attach(parentWidget1); |
| 352 try { |
| 353 childWidget.showWidget(parentWidget2.element); |
| 354 } catch (e) { |
| 355 InspectorTest.addResult(e); |
| 356 } |
| 357 next(); |
344 } | 358 } |
345 ]); | 359 ]); |
346 } | 360 } |
347 | 361 |
348 </script> | 362 </script> |
349 </head> | 363 </head> |
350 | 364 |
351 <body onload="runTest()"> | 365 <body onload="runTest()"> |
352 <p> | 366 <p> |
353 This tests that events are properly propagated through Widget hierarchy. | 367 This tests that events are properly propagated through Widget hierarchy. |
354 </p> | 368 </p> |
355 | 369 |
356 </body> | 370 </body> |
357 </html> | 371 </html> |
OLD | NEW |