OLD | NEW |
1 var initialize_ElementTest = function() { | 1 var initialize_ElementTest = function() { |
2 | 2 |
3 InspectorTest.findNode = function(matchFunction, callback) | 3 InspectorTest.findNode = function(matchFunction, callback) |
4 { | 4 { |
5 callback = InspectorTest.safeWrap(callback); | 5 callback = InspectorTest.safeWrap(callback); |
6 var result = null; | 6 var result = null; |
7 var pendingRequests = 0; | 7 var pendingRequests = 0; |
8 function processChildren(node) | 8 function processChildren(node) |
9 { | 9 { |
10 try { | 10 try { |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 var treeOutline = InspectorTest.firstElementsTreeOutline(); | 500 var treeOutline = InspectorTest.firstElementsTreeOutline(); |
501 treeOutline._updateModifiedNodes(); | 501 treeOutline._updateModifiedNodes(); |
502 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de
pth || 10000); | 502 print(rootNode ? treeOutline.findTreeElement(rootNode) : treeOutline, "", de
pth || 10000); |
503 }; | 503 }; |
504 | 504 |
505 InspectorTest.expandElementsTree = function(callback) | 505 InspectorTest.expandElementsTree = function(callback) |
506 { | 506 { |
| 507 var expandedSomething = false; |
507 callback = InspectorTest.safeWrap(callback); | 508 callback = InspectorTest.safeWrap(callback); |
508 | 509 |
509 function expand(treeItem) | 510 function expand(treeItem) |
510 { | 511 { |
511 var children = treeItem.children; | 512 var children = treeItem.children; |
512 for (var i = 0; children && i < children.length; ++i) { | 513 for (var i = 0; children && i < children.length; ++i) { |
513 children[i].expand(); | 514 var child = children[i]; |
514 expand(children[i]); | 515 if (child.hasChildren && !child.expanded) { |
| 516 child.expand(); |
| 517 expandedSomething = true; |
| 518 } |
| 519 expand(child); |
515 } | 520 } |
516 } | 521 } |
517 | 522 |
518 function onAllNodesAvailable() | 523 function onAllNodesAvailable() |
519 { | 524 { |
520 InspectorTest.firstElementsTreeOutline()._updateModifiedNodes(); | 525 InspectorTest.firstElementsTreeOutline()._updateModifiedNodes(); |
521 expand(InspectorTest.firstElementsTreeOutline()); | 526 expand(InspectorTest.firstElementsTreeOutline()); |
522 callback(); | 527 callback(expandedSomething); |
523 } | 528 } |
524 WebInspector.inspectorView.showPanel("elements"); | 529 WebInspector.inspectorView.showPanel("elements"); |
525 InspectorTest.findNode(function() { return false; }, onAllNodesAvailable); | 530 InspectorTest.findNode(function() { return false; }, onAllNodesAvailable); |
526 }; | 531 }; |
527 | 532 |
528 InspectorTest.dumpDOMAgentTree = function(node) | 533 InspectorTest.dumpDOMAgentTree = function(node) |
529 { | 534 { |
530 if (!WebInspector.domModel._document) | 535 if (!WebInspector.domModel._document) |
531 return; | 536 return; |
532 | 537 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 var testNode = InspectorTest.expandedNodeWithId(/function\s([^(]*)/.exec
(testBody)[1]); | 569 var testNode = InspectorTest.expandedNodeWithId(/function\s([^(]*)/.exec
(testBody)[1]); |
565 InspectorTest.addResult("Initial:"); | 570 InspectorTest.addResult("Initial:"); |
566 InspectorTest.dumpElementsTree(testNode); | 571 InspectorTest.dumpElementsTree(testNode); |
567 | 572 |
568 testBody(undo); | 573 testBody(undo); |
569 | 574 |
570 function undo() | 575 function undo() |
571 { | 576 { |
572 InspectorTest.addResult("Post-action:"); | 577 InspectorTest.addResult("Post-action:"); |
573 InspectorTest.dumpElementsTree(testNode); | 578 InspectorTest.dumpElementsTree(testNode); |
574 WebInspector.domModel.undo(redo); | 579 InspectorTest.expandElementsTree(expandedCallback); |
| 580 |
| 581 function expandedCallback(expandedSomething) |
| 582 { |
| 583 if (expandedSomething) { |
| 584 InspectorTest.addResult("== Expanded: =="); |
| 585 InspectorTest.dumpElementsTree(testNode); |
| 586 } |
| 587 WebInspector.domModel.undo(redo); |
| 588 } |
575 } | 589 } |
576 | 590 |
577 function redo() | 591 function redo() |
578 { | 592 { |
579 InspectorTest.addResult("Post-undo (initial):"); | 593 InspectorTest.addResult("Post-undo (initial):"); |
580 InspectorTest.dumpElementsTree(testNode); | 594 InspectorTest.dumpElementsTree(testNode); |
581 WebInspector.domModel.redo(done); | 595 InspectorTest.expandElementsTree(expandedCallback); |
| 596 |
| 597 function expandedCallback(expandedSomething) |
| 598 { |
| 599 if (expandedSomething) { |
| 600 InspectorTest.addResult("== Expanded: =="); |
| 601 InspectorTest.dumpElementsTree(testNode); |
| 602 } |
| 603 WebInspector.domModel.redo(done); |
| 604 } |
582 } | 605 } |
583 | 606 |
584 function done() | 607 function done() |
585 { | 608 { |
586 InspectorTest.addResult("Post-redo (action):"); | 609 InspectorTest.addResult("Post-redo (action):"); |
587 InspectorTest.dumpElementsTree(testNode); | 610 InspectorTest.dumpElementsTree(testNode); |
588 next(); | 611 InspectorTest.expandElementsTree(expandedCallback); |
| 612 |
| 613 function expandedCallback(expandedSomething) |
| 614 { |
| 615 if (expandedSomething) { |
| 616 InspectorTest.addResult("== Expanded: =="); |
| 617 InspectorTest.dumpElementsTree(testNode); |
| 618 } |
| 619 next(); |
| 620 } |
589 } | 621 } |
590 } | 622 } |
591 result.toString = function() | 623 result.toString = function() |
592 { | 624 { |
593 return testBody.toString(); | 625 return testBody.toString(); |
594 } | 626 } |
595 return result; | 627 return result; |
596 } | 628 } |
597 | 629 |
598 const indent = " "; | 630 const indent = " "; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 781 |
750 InspectorTest.dumpInspectorHighlightShape = function(node, callback) | 782 InspectorTest.dumpInspectorHighlightShape = function(node, callback) |
751 { | 783 { |
752 node.boxModel(function(shapes) { | 784 node.boxModel(function(shapes) { |
753 InspectorTest.addResult(JSON.stringify(shapes.shapeOutside.shape)); | 785 InspectorTest.addResult(JSON.stringify(shapes.shapeOutside.shape)); |
754 callback(); | 786 callback(); |
755 }); | 787 }); |
756 } | 788 } |
757 | 789 |
758 }; | 790 }; |
OLD | NEW |