~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/tests/event/tests/focusblur.html

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
 
<html>
3
 
<head>
4
 
    <title>YUI focus/blur synth Tests</title>
5
 
 
6
 
    <script src="../../../build/yui/yui.js"></script>
7
 
    <script src="window-focus.js"></script>
8
 
</head>
9
 
<body class="yui3-skin-sam">
10
 
 
11
 
    <div id="container">
12
 
        <button id="button-1">Click Me!</button>
13
 
        <a id="anchor-1" href="http://www.yahoo.com">Click Me!</a>
14
 
        <input type="text" id="text-1">
15
 
    </div>
16
 
 
17
 
    <script>
18
 
        YUI({
19
 
            filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
20
 
            allowRollup: false,
21
 
            lazyEventFacade: true
22
 
        }).use('console', 'test', 'event', 'event-simulate', 'window-focus', function (Y) {
23
 
 
24
 
            var Assert = Y.Assert;
25
 
 
26
 
            new Y.Console({ /*useBrowserConsole: true*/ }).render();
27
 
 
28
 
            Y.Test.Runner.add(new Y.Test.Case({
29
 
                name: "Event Focus And Blur Test",
30
 
 
31
 
                _should: {
32
 
                    fail: {
33
 
                        //test_purge_focus: 2528244, // fixed
34
 
                        //test_purge_blur: 2528244   // fixed
35
 
                    }
36
 
                },
37
 
 
38
 
                tearDown: function () {
39
 
                    Y.one('#container').purge(true);
40
 
                },
41
 
 
42
 
                test_add_focus: function(){
43
 
 
44
 
                    var foo = false,
45
 
                        target,
46
 
                        boundEl,
47
 
 
48
 
                        onFocus = function(e) {
49
 
 
50
 
                            foo = true;
51
 
                            boundEl = this;
52
 
                            target = e.target;
53
 
 
54
 
                        };
55
 
 
56
 
                    Y.on('focus', onFocus, '#container');
57
 
 
58
 
                    Y.one('#button-1').focus();
59
 
 
60
 
                    if (Y.isWindowInFocus()) {
61
 
                        Assert.isTrue(foo, "simple focus fails, container should pickup the focus event");
62
 
                        Assert.areEqual(Y.one('#button-1'), target, "the target is the incorrect node, should be the actual focus target");
63
 
                        Assert.areEqual(Y.one('#container'), boundEl, "the default scope should be the bound element");
64
 
 
65
 
                        foo = false;
66
 
                        target = null;
67
 
                        boundEl = null;
68
 
 
69
 
                        Y.one('#text-1').focus();
70
 
                        Y.one('#button-1').focus();
71
 
 
72
 
                        Assert.isTrue(foo, "simple focus fails, container should pickup the focus event");
73
 
                        Assert.areEqual(Y.one('#button-1'), target, "the target is the incorrect node, should be the actual focus target");
74
 
                        Assert.areEqual(Y.one('#container'), boundEl, "the default scope should be the bound element");
75
 
 
76
 
                        Y.one('#button-1').blur();
77
 
                    } else {
78
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
79
 
                    }
80
 
                },
81
 
 
82
 
                test_remove_focus: function () {
83
 
 
84
 
                    var foo = false,
85
 
 
86
 
                        onFocus = function(e) {
87
 
 
88
 
                            foo = true;
89
 
 
90
 
                        };
91
 
 
92
 
                    var handle = Y.on('focus', onFocus, '#container');
93
 
 
94
 
                    if (Y.isWindowInFocus()) {
95
 
                        Y.one('#button-1').focus();
96
 
 
97
 
                        Assert.isTrue(foo, "simple focus fails, container should pickup the focus event");
98
 
 
99
 
                        handle.detach();
100
 
 
101
 
                        Y.one('#button-1').blur();
102
 
 
103
 
                        foo = false;
104
 
 
105
 
                        Y.one('#button-1').focus();
106
 
 
107
 
                        Assert.isFalse(foo, "container should not pickup the focus event after listener is removed");
108
 
 
109
 
                        Y.one('#button-1').blur();
110
 
                    } else {
111
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
112
 
                    }
113
 
                },
114
 
 
115
 
                test_purge_focus: function () {
116
 
 
117
 
                    var foo = false,
118
 
 
119
 
                        onFocus = function(e) {
120
 
 
121
 
                            foo = true;
122
 
 
123
 
                        };
124
 
 
125
 
                    if (Y.isWindowInFocus()) {
126
 
                        Y.on('focus', onFocus, '#container');
127
 
 
128
 
                        Y.one('#button-1').focus();
129
 
 
130
 
                        Assert.isTrue(foo, "simple focus fails, container should pickup the focus event");
131
 
 
132
 
                        Y.Event.purgeElement('#container', false, 'focus');
133
 
 
134
 
                        Y.one('#button-1').blur();
135
 
 
136
 
                        foo = false;
137
 
 
138
 
                        Y.one('#button-1').focus();
139
 
 
140
 
                        Assert.isFalse(foo, "container should not pickup the focus event after listener has been purged");
141
 
                    } else {
142
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
143
 
                    }
144
 
                },
145
 
 
146
 
                test_bubble_order: function () {
147
 
                    var from = [],
148
 
                        doc  = Y.one(Y.config.doc),
149
 
                        body = Y.one('body'),
150
 
                        container = Y.one('#container');
151
 
 
152
 
                    function onFocus(e) {
153
 
                        from.push(this);
154
 
                    }
155
 
 
156
 
                    if (Y.isWindowInFocus()) {
157
 
                        container.on('focus', onFocus);
158
 
                        doc.on('focus', onFocus);
159
 
                        body.on('focus', onFocus);
160
 
 
161
 
                        Y.one('#anchor-1').focus();
162
 
 
163
 
                        Y.ArrayAssert.itemsAreSame([container, body, doc], from, "Incorrect bubble order");
164
 
                    } else {
165
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
166
 
                    }
167
 
                },
168
 
 
169
 
                test_add_blur: function () {
170
 
 
171
 
                    var foo = false,
172
 
                        target,
173
 
                        boundEl,
174
 
 
175
 
                        onBlur = function(e) {
176
 
 
177
 
                            foo = true;
178
 
                            boundEl = this;
179
 
                            target = e.target;
180
 
 
181
 
                        };
182
 
 
183
 
                    if (Y.isWindowInFocus()) {
184
 
                        Y.on('blur', onBlur, '#container');
185
 
 
186
 
                        Y.one('#button-1').focus();
187
 
                        Y.one('#button-1').blur();
188
 
 
189
 
                        Assert.isTrue(foo, "simple blur fails, container should pickup the focus event");
190
 
                        Assert.areEqual(target, Y.one('#button-1'), "the target is the incorrect node, should be the actual blur target");
191
 
                        Assert.areEqual(boundEl, Y.one('#container'), "the default scope should be the bound element");
192
 
 
193
 
                        foo = false;
194
 
                        target = null;
195
 
                        boundEl = null;
196
 
 
197
 
                        Y.one('#button-1').focus();
198
 
                        Y.one('#text-1').focus();
199
 
 
200
 
                        Assert.isTrue(foo, "simple blur fails, container should pickup the focus event");
201
 
                        Assert.areEqual(target, Y.one('#button-1'), "the target is the incorrect node, should be the actual blur target");
202
 
                        Assert.areEqual(boundEl, Y.one('#container'), "the default scope should be the bound element");
203
 
                    } else {
204
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
205
 
                    }
206
 
                },
207
 
 
208
 
                test_remove_blur: function () {
209
 
                    var foo = false,
210
 
                        onBlur = function(e) {
211
 
                            foo = true;
212
 
                        };
213
 
 
214
 
                    if (Y.isWindowInFocus()) {
215
 
                        var handle = Y.on('blur', onBlur, '#container');
216
 
 
217
 
                        Y.one('#button-1').focus();
218
 
                        Y.one('#button-1').blur();
219
 
 
220
 
                        Assert.isTrue(foo, "simple focus fails, container should pickup the focus event");
221
 
                        foo = false;
222
 
                        handle.detach();
223
 
                        Y.one('#button-1').focus();
224
 
                        Y.one('#text-1').focus();
225
 
                        Assert.isFalse(foo, "container should not pickup the blur event after listener has been removed");
226
 
                    } else {
227
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
228
 
                    }
229
 
                },
230
 
 
231
 
                test_purge_blur: function () {
232
 
                    var foo = false,
233
 
                        onBlur = function(e) {
234
 
                            foo = true;
235
 
                        };
236
 
 
237
 
                    if (Y.isWindowInFocus()) {
238
 
                        Y.on('blur', onBlur, '#container');
239
 
 
240
 
                        Y.one('#button-1').focus();
241
 
                        Y.one('#button-1').blur();
242
 
                        Assert.isTrue(foo, "simple focus fails, container should pickup the focus event");
243
 
                        foo = false;
244
 
                        Y.Event.purgeElement('#container', false, 'blur');
245
 
                        Y.one('#button-1').focus();
246
 
                        Y.one('#text-1').focus();
247
 
                        Assert.isFalse(foo, "container should not pickup the blur event after listener has been purged");
248
 
                    } else {
249
 
                        Y.log("Window is not focused.", "warn", "TestRunner");
250
 
                    }
251
 
                }
252
 
 
253
 
            }));
254
 
 
255
 
            Y.Test.Runner.setName("EventFocusBlur");
256
 
            Y.Test.Runner.run();
257
 
 
258
 
        });
259
 
    </script>
260
 
</body>
261
 
</html>