source: Dev/trunk/src/client/dojo/tests/NodeList-fx.html

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

Added Dojo 1.9.3 release.

File size: 5.9 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>Testing dojo.fx extensions to dojo.NodeList</title>
6                <style type="text/css">
7                        @import "../resources/dojo.css";
8                </style>
9                <script type="text/javascript" src="../dojo.js" data-dojo-config="isDebug: true, popup: true"></script>
10                <script type="text/javascript">
11                        require(["doh", "dojo/aspect", "dojo/dom-style", "dojo/query", "dojo/NodeList-fx", "dojo/domReady!"],
12                                        function(doh, aspect, domStyle, query){
13                                doh.register("NodeList-fx",
14                                        [
15                                                function fadeOut(){
16                                                        query("p").style("opacity", 1);
17                                                        var anim = query("p").fadeOut();
18                                                        var d = new doh.Deferred();
19                                                        aspect.after(anim, "onEnd", d.getTestCallback(function(){
20                                                                query("p").forEach(function(item){
21                                                                        doh.is(0, domStyle.get(item, "opacity"), "opacity for " + item);
22                                                                });
23                                                        }), true);
24                                                        anim.play();
25                                                        return d;
26                                                },
27                                                function fadeIn(){
28                                                        query("p").style("opacity", 0);
29                                                        var anim = query("p").fadeIn();
30                                                        var d = new doh.Deferred();
31                                                        aspect.after(anim, "onEnd", d.getTestCallback(function(){
32                                                                query("p").forEach(function(item){
33                                                                        doh.is(1, domStyle.get(item, "opacity"), "opacity for " + item);
34                                                                });
35                                                        }), true);
36                                                        anim.play();
37                                                        return d;
38                                                },
39                                                function wipeOut(){
40                                                        query("p").style("height", "");
41                                                        var anim = query("p").wipeOut();
42                                                        var d = new doh.Deferred();
43                                                        aspect.after(anim, "onEnd", d.getTestCallback(function(){
44                                                                query("p").forEach(function(item){
45                                                                        doh.is(0, domStyle.get(item, "height"), "height for " + item);
46                                                                });
47                                                        }), true);
48                                                        anim.play();
49                                                        return d;
50                                                },
51                                                function wipeIn(){
52                                                        query("p").style("height", 0);
53                                                        var anim = query("p").wipeIn();
54                                                        var d = new doh.Deferred();
55                                                        aspect.after(anim, "onEnd", d.getTestCallback(function(){
56                                                                query("p").forEach(function(item){
57                                                                        // FIXME: need a more robust test for "have wiped all the way in"
58                                                                        doh.isNot(0, domStyle.get(item, "height"), "height for " + item);
59                                                                });
60                                                        }), true);
61                                                        anim.play();
62                                                        return d;
63                                                },
64                                                function slideTo(){
65                                                        var anim = query("p").slideTo({
66                                                                left: 500
67                                                        });
68                                                        var d = new doh.Deferred();
69                                                        aspect.after(anim, "onEnd", d.getTestCallback(function(){
70                                                                query("p").forEach(function(item){
71                                                                        // FIXME: need a more robust test for "have wiped all the way in"
72                                                                        doh.is(500, domStyle.get(item, "left"), "left for " + item);
73                                                                });
74                                                        }), true);
75                                                        anim.play();
76                                                        return d;
77                                                },
78                                                function anim(){
79                                                        query("p").style("position", "");
80                                                        query("p").style("left", "");
81                                                        var anim = query("p").anim({
82                                                                width: 500
83                                                        });
84                                                        console.debug(anim);
85                                                        var d = new doh.Deferred();
86                                                        aspect.after(anim, "onEnd", d.getTestCallback(function(){
87                                                                /*
88                                                                query("p").forEach(function(item){
89                                                                        // FIXME: need a more robust test for "have wiped all the way in"
90                                                                        doh.is(500, domStyle.get(item, "width"), "width for" + item);
91                                                                }));
92                                                                */
93                                                        }), true);
94                                                        return d;
95                                                },
96                                               
97                                                function auto(){
98                                                       
99                                                        var d = new doh.Deferred(), x = 0;
100                                                        var nl = query("p")
101                                                                .fadeOut({
102                                                                        auto:true,
103                                                                        onEnd:function(){
104                                                                                if(!x){
105                                                                                        // onend fires foreach in the list. only dfd once.
106                                                                                        x++; d.callback(true);
107                                                                                }
108                                                                        }
109                                                                })
110                                                                // past here we're expecting a NodeList back, not an Animation
111                                                                .at(0)
112                                                                .forEach(d.getTestErrback(function(n){
113                                                                        // TODO: this test is meaningless
114                                                                        doh.t(true); // it worked.
115                                                                }))
116                                                        ;
117                                                       
118                                                        doh.t(nl.length, "query() found some nodes"); // ensure we actually will do _something_
119                                                       
120                                                        return d;
121                                                }
122                                        ]
123                                );
124                                doh.run();
125                        });
126                </script>
127        </head>
128        <body>
129                <p>
130                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean semper
131                sagittis velit. Cras in mi. Duis porta mauris ut ligula.  Proin porta
132                rutrum lacus. Etiam consequat scelerisque quam. Nulla facilisi.
133                Maecenas luctus venenatis nulla. In sit amet dui non mi semper iaculis.
134                Sed molestie tortor at ipsum. Morbi dictum rutrum magna. Sed vitae
135                risus.
136                </p>
137                <p>
138                Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
139                imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
140                nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
141                massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
142                pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
143                quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
144                felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
145                quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
146                rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
147                semper velit ante id metus. Praesent massa dolor, porttitor sed,
148                pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
149                tortor pharetra congue.  Suspendisse pulvinar.
150                </p>
151                <p>
152                Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
153                imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
154                nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
155                massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
156                pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
157                quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
158                felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
159                quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
160                rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
161                semper velit ante id metus. Praesent massa dolor, porttitor sed,
162                pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
163                tortor pharetra congue.  Suspendisse pulvinar.
164                </p>
165        </body>
166</html>
167
Note: See TracBrowser for help on using the repository browser.