source: Dev/trunk/src/client/dojox/dnd/tests/test_boundingBoxController.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 2.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2    "http://www.w3.org/TR/html4/strict.dtd">
3<html>
4    <head>
5        <title>dojox dnd BoundingBoxController</title>
6        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7        <style type="text/css">
8            @import "../../../dojo/resources/dojo.css";
9            @import "../../../dojo/tests/dnd/dndDefault.css";
10            body { padding: 20px; }
11            #boundingBox {
12                background:#999;
13                border:1px solid #2B2B2B;
14                opacity:0.6;
15                position:absolute;
16                                z-index:19999;
17                        }
18                </style>
19                <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
20                <script type="text/javascript">
21                        dojo.require("dojox.dnd.BoundingBoxController");
22                        dojo.require("dojox.dnd.Selector");
23                        dojo.require("doh.runner");
24                        mockEvent = function(args) {
25                                var evt = {
26                                        stopPropagation: function() {},
27                                        preventDefault: function() {},
28                                        button: 0
29                                };
30                                dojo.mixin(evt, args);
31                                return evt;
32                        };
33                        dojo.addOnLoad(function(){
34                                source = new dojox.dnd.Selector(dojo.byId("source"));
35                                doh.register("dojox.dnd.BoundingBoxController",
36                                        [
37                                                {
38                                                        name: "testMouseDownUp",
39                                                        timeout: 1000,
40                                                        setUp: function() {
41                                                                source.conservative = false;
42                                                                bbc = new dojox.dnd.BoundingBoxController([source], dojo.byId("boundingBox"));
43                                                        },
44                                                        runTest: function() {
45                                                                var def = new doh.Deferred(), res = false,
46                                                                s = dojo.subscribe("/dojox/dnd/bounding", function() {
47                                                                        dojo.unsubscribe(s);
48                                                                        res = true;
49                                                                });
50                                                                bbc._onMouseDown(mockEvent({clientX: 1, clientY: 1}));
51                                                                bbc._onMouseMove(mockEvent({clientX: 1000, clientY: 1000}));
52                                                                doh.assertTrue(dojo.style(dojo.byId("boundingBox"), "display") !== "none");
53                                                                bbc._onMouseUp(mockEvent());
54                                                                doh.assertTrue(source.getSelectedNodes().length === 3);
55                                                                setTimeout(function() {
56                                                                        res && dojo.style(dojo.byId("boundingBox"), "display") === "none" ? def.callback(true) : def.errback(false);
57                                                                }, 500);
58                                                                return def;
59                                                        },
60                                                        tearDown: function() {
61                                                               
62                                                        }
63                                                }
64                                        ]
65                                );
66                                doh.run();
67                        });
68                </script>
69        </head>
70        <body>
71                <h1 id="header">Dojox DnD BoundingBoxController test</h1>
72                <div id="source" class="container">
73                        <div id="blonde" class="dojoDndItem">Blonde on Blonde</div>
74                        <div id="highway" class="dojoDndItem">Highway 61 Revisited</div>
75                        <div id="tracks" class="dojoDndItem">Blood on the Tracks</div>
76                </div>
77                <div id="boundingBox"></div>
78        </body>
79</html>
Note: See TracBrowser for help on using the repository browser.