summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/elements/move-node.html
blob: 85965e3e02fcf44a12d5222faaad66538397541a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script>

function test()
{
    var containerNode;

    InspectorTest.runTestSuite([
        function testDumpInitial(next)
        {
            function callback(node)
            {
                containerNode = InspectorTest.expandedNodeWithId("container");

                InspectorTest.addResult("========= Original ========");
                InspectorTest.dumpElementsTree(containerNode);
                next();
            }
            InspectorTest.expandElementsTree(callback);
        },

        function testDragAndDrop(next)
        {
            var treeOutline = WebInspector.panels.elements.treeOutline;
            treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, selectionChanged);

            function selectionChanged()
            {
                InspectorTest.addResult("===== Moved child2 =====");
                InspectorTest.dumpElementsTree(containerNode);
                InspectorTest.addResult("Selection: " + WebInspector.DOMPresentationUtils.appropriateSelectorFor(treeOutline.selectedDOMNode()));
                next();
            }

            treeOutline._treeElementBeingDragged = treeOutline.getCachedTreeElement(InspectorTest.expandedNodeWithId("child2"));
            var treeElementToDropOn = treeOutline.getCachedTreeElement(InspectorTest.expandedNodeWithId("child4"));
            treeOutline._doMove(treeElementToDropOn);
        }
    ]);
}

</script>
</head>

<body onload="runTest()">
<p>
Tests elements drag and drop operation internals, verifies post-move selection.
</p>

<div id="container">
    <div id="child1"></div>
    <div id="child2"></div>
    <div id="child3"></div>
    <div id="child4"></div>
</div>

</body>
</html>