Merge lp:~sidnei/lazr-js/yui-3.0.0-redux into lp:lazr-js
- yui-3.0.0-redux
- Merge into toolchain
Status: | Merged |
---|---|
Approved by: | Edwin Grubbs |
Approved revision: | 154 |
Merged at revision: | not available |
Proposed branch: | lp:~sidnei/lazr-js/yui-3.0.0-redux |
Merge into: | lp:lazr-js |
Diff against target: |
159000 lines 0 files modified
|
To merge this branch: | bzr merge lp:~sidnei/lazr-js/yui-3.0.0-redux |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Edwin Grubbs (community) | code | Approve | |
Review via email: mp+13743@code.launchpad.net |
Commit message
Update to YUI 3.0.0.
Description of the change
Sidnei da Silva (sidnei) wrote : | # |
Sidnei da Silva (sidnei) wrote : | # |
Since the branch is large due to the inclusion of YUI 3.0.0, I've made a smaller incremental diff from the base branch (lp:~sidnei/lazr-js/jstestdriver-support).
Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Sidnei,
I'm glad I didn't have to do all this work. Thanks. I have quite a few
questions, so I'm marking this
needs-fixing
-Edwin
>=== modified file 'examples/
>--- examples/
>+++ new 2009-10-21 17:31:07.000000000 -0500
> var multiline_text = new Y.EditableText({
>- contentBox: '#edit-
>- multiline: true,
>- buttons: 'top'
>+ contentBox: '#multiline_text',
>+ multi_line: true,
>+ size: 70
> });
> multiline_
>
>- // Add the 2 second delay to the underlying editor widget.
>- multiline_
Why was this removed?
>+ // XXX remove this when done writing the *error CSS stuff.
>+ // editor.
>+ // editor.
Why were these comments added?
> });
> </script>
>
>=== modified file 'src-js/
>--- src-js/
>+++ src-js/
>@@ -4,7 +4,7 @@
> base: '../../
> filter: 'raw',
> combine: false
>- }).use(
>+ }).use(
Line too long.
> // Local aliases
> var Assert = Y.Assert,
>
>=== modified file 'src-js/
>--- src-js/
>+++ src-js/
>@@ -1,11 +1,11 @@
> /* Copyright (c) 2008, Canonical Ltd. All rights reserved. */
>
> YUI({
>- base: '../../
>+ base: '../../
> filter: 'raw',
> combine: false
> }).use(
>- 'lazr.testing.
>+ 'lazr.testing.
> 'console', function(Y) {
>
> var Assert = Y.Assert; // For easy access to isTrue(), etc.
>@@ -20,6 +20,17 @@
> Y.Event.
> }
>
>+/* Helper function to cleanup and destroy a form overlay instance */
>+function cleanup_
>+ if (form_overlay.
>+ var bb = form_overlay.
>+ bb.get(
>+ }
>+
>+ // Kill the widget itself.
>+ form_overlay.
>+}
>+
> /* Helper function that creates a new form overlay instance. */
> function make_form_
> var form_overlay = new Y.lazr.
>@@ -52,17 +63,7 @@
>
> tearDown: function() {
> window.
>- this.cleanUp(
>- },
>-
>- cleanUp: function(
>- if (form_overlay.
>- var bb = form_overlay.
>- ...
- 144. By Sidnei da Silva
-
- Merge from jstestdriver-
support - 145. By Sidnei da Silva
-
- Sort
- 146. By Sidnei da Silva
-
- Revert unwanted change to examples.
- Use proper AOP on Picker like on FormOverlay
- Kill some now meaningless comments (after above changes)
- Wrap some long lines - 147. By Sidnei da Silva
-
- Fix some long lines
Sidnei da Silva (sidnei) wrote : | # |
>>=== modified file 'examples/
>>--- examples/
>>- // Add the 2 second delay to the underlying editor widget.
>>- multiline_
>
> Why was this removed?
Uhm, that's something that came from Maris' branch. Since it doesn't
make sense to me either, re-adding it.
>>+ // XXX remove this when done writing the *error CSS stuff.
>>+ // editor.
>>+ // editor.
>
> Why were these comments added?
Same as above. Since it doesn't make sense to me, removing it.
>>=== modified file 'widgets.conf'
>>--- widgets.conf 2009-10-20 13:11:56 +0000
>>+++ widgets.conf 2009-10-21 22:29:49 +0000
>>@@ -5,37 +5,53 @@
>
>
> How is this file generated? There appear to be a bunch of diffs
> from entries just moving to different spots. If this is generated by
> a script, it would be nice to have it sort the list, so that future
> diffs show only real changes.
It's manually generated, though it would make sense to have a script
generate it. I will keep that in mind for the future.
In the meantime, I've sorted the file.
As for the long-lines and indentation, all fixed.
I also changed the Picker widget to use the AOP approach like was done
for FormOverlay, and all tests pass. Incremental diff below.
=== modified file 'examples/
--- examples/
+++ examples/
@@ -421,9 +421,8 @@
});
multiline_
- // XXX remove this when done writing the *error CSS stuff.
- // editor.
- // editor.
+ // Add the 2 second delay to the underlying editor widget.
+ multiline_
});
</script>
=== modified file 'src-js/
--- src-js/
+++ src-js/
@@ -4,7 +4,8 @@
base: '../../
filter: 'raw',
combine: false
- }).use(
'widget-stack', 'console', function(Y) {
+ }).use(
+ 'event', 'widget-stack', 'console', function(Y) {
// Local aliases
var Assert = Y.Assert,
=== modified file 'src-js/
--- src-js/
+++ src-js/
@@ -75,28 +75,19 @@
},
- // This fails because YUI adds an extra div for some reason.
- // If and when this is fixed, and this passes, we'll need to
- // update test_form_
- // _should: {
- // fail: {test_bodyConte
- // },
-
- test_bodyConten
+ test_body_
- 148. By Sidnei da Silva
-
- Fix comments
- 149. By Sidnei da Silva
-
- Fix some examples, though not all
- 150. By Sidnei da Silva
-
- Need to unplug the NodeMenuNav before plugging it, otherwise the descendants are all wrong.
- 151. By Sidnei da Silva
-
- AOP-ize more. Fix a bug with the zIndex of the PrettyOverlay
- 152. By Sidnei da Silva
-
- Merge from jstestdriver-
support - 153. By Sidnei da Silva
-
- Remove custom 'show()' method and use a handler on visibleChange instead.
- 154. By Sidnei da Silva
-
- Fix example
Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Sidnei,
Thanks for the fixes, and thanks for the explanations of some of the changes that the new version of YUI brings.
merge-approved
-Edwin
- 155. By Sidnei da Silva
-
- Merge from parent branch
Preview Diff
1 | === modified file 'buildout.cfg' |
2 | --- buildout.cfg 2009-10-27 08:59:24 +0000 |
3 | +++ buildout.cfg 2009-10-30 17:01:13 +0000 |
4 | @@ -2,6 +2,7 @@ |
5 | develop = . |
6 | parts = |
7 | scripts |
8 | + test |
9 | |
10 | unzip = true |
11 | eggs-directory = eggs |
12 | @@ -27,6 +28,16 @@ |
13 | [versions] |
14 | # Alphabetical, case-insensitive, please! :-) |
15 | bzr = 2.0.0 |
16 | +lazr.testing = 0.1.1 |
17 | +mocker = 0.10.1 |
18 | setuptools = 0.6c9 |
19 | zc.buildout = 1.4.1 |
20 | zc.recipe.egg = 1.2.2 |
21 | +zc.recipe.testrunner = 1.2.0 |
22 | +zope.exceptions = 3.5.2 |
23 | +zope.interface = 3.5.1 |
24 | +zope.testing = 3.8.1 |
25 | + |
26 | +[test] |
27 | +recipe = zc.recipe.testrunner |
28 | +eggs = lazr-js |
29 | |
30 | === modified file 'examples/activator/index.html' |
31 | --- examples/activator/index.html 2009-04-22 02:42:02 +0000 |
32 | +++ examples/activator/index.html 2009-10-30 17:01:13 +0000 |
33 | @@ -3,7 +3,7 @@ |
34 | <html> |
35 | <head> |
36 | <title>Lazr-js examples: Activator</title> |
37 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
38 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
39 | <script type="text/javascript" src="../../build/anim/anim.js"></script> |
40 | <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
41 | <script type="text/javascript" src="../../build/activator/activator.js"></script> |
42 | @@ -11,7 +11,7 @@ |
43 | <script id="example-script" type="text/javascript"> |
44 | |
45 | YUI({ |
46 | - base: '../../lib/yui/current/build/', |
47 | + base: '../../build/yui/current/build/', |
48 | filter: 'raw' |
49 | }).use('node', 'lazr.activator', function(Y) { |
50 | |
51 | @@ -96,9 +96,9 @@ |
52 | We need to include individual css files because some of them have |
53 | relative paths to images. |
54 | --> |
55 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssreset/reset.css" /> |
56 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssfonts/fonts.css" /> |
57 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssbase/base.css" /> |
58 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssreset/reset.css" /> |
59 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssfonts/fonts.css" /> |
60 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssbase/base.css" /> |
61 | |
62 | <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
63 | <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
64 | |
65 | === modified file 'examples/anim/index.html' |
66 | --- examples/anim/index.html 2009-03-12 02:55:06 +0000 |
67 | +++ examples/anim/index.html 2009-10-30 17:01:13 +0000 |
68 | @@ -3,14 +3,14 @@ |
69 | <html> |
70 | <head> |
71 | <title>Lazr-js examples: anim</title> |
72 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui-min.js"></script> |
73 | - <script type="text/javascript" src="../../lib/yui/current/build/oop/oop-min.js"></script> |
74 | - <script type="text/javascript" src="../../lib/yui/current/build/event/event-min.js"></script> |
75 | - <script type="text/javascript" src="../../lib/yui/current/build/attribute/attribute-min.js"></script> |
76 | - <script type="text/javascript" src="../../lib/yui/current/build/base/base-min.js"></script> |
77 | - <script type="text/javascript" src="../../lib/yui/current/build/dom/dom-min.js"></script> |
78 | - <script type="text/javascript" src="../../lib/yui/current/build/node/node-min.js"></script> |
79 | - <script type="text/javascript" src="../../lib/yui/current/build/anim/anim-min.js"></script> |
80 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui-min.js"></script> |
81 | + <script type="text/javascript" src="../../build/yui/current/build/oop/oop-min.js"></script> |
82 | + <script type="text/javascript" src="../../build/yui/current/build/event/event-min.js"></script> |
83 | + <script type="text/javascript" src="../../build/yui/current/build/attribute/attribute-min.js"></script> |
84 | + <script type="text/javascript" src="../../build/yui/current/build/base/base-min.js"></script> |
85 | + <script type="text/javascript" src="../../build/yui/current/build/dom/dom-min.js"></script> |
86 | + <script type="text/javascript" src="../../build/yui/current/build/node/node-min.js"></script> |
87 | + <script type="text/javascript" src="../../build/yui/current/build/anim/anim-min.js"></script> |
88 | |
89 | <script type="text/javascript" src="../../build/anim/anim.js"></script> |
90 | <script type="text/javascript"> |
91 | |
92 | === modified file 'examples/autocomplete/index.html' |
93 | --- examples/autocomplete/index.html 2009-04-22 19:02:42 +0000 |
94 | +++ examples/autocomplete/index.html 2009-10-30 17:01:13 +0000 |
95 | @@ -4,20 +4,20 @@ |
96 | <head> |
97 | <title>Lazr-js examples: autocomplete</title> |
98 | |
99 | - <link type="text/css" rel="stylesheet" href="../../lib/yui/current/build/cssreset/reset.css"></link> |
100 | - <link type="text/css" rel="stylesheet" href="../../lib/yui/current/build/cssfonts/fonts.css"></link> |
101 | - <link type="text/css" rel="stylesheet" href="../../lib/yui/current/build/cssbase/base.css"></link> |
102 | - |
103 | - |
104 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
105 | - <script type="text/javascript" src="../../lib/yui/current/build/widget/widget-position-debug.js"></script> |
106 | - <script type="text/javascript" src="../../lib/yui/current/build/widget/widget-position-ext-debug.js"></script> |
107 | - <script type="text/javascript" src="../../lib/lazr/build/lazr.js"></script> |
108 | - <script type="text/javascript" src="../../lib/lazr/build/autocomplete/autocomplete.js"></script> |
109 | + <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"></link> |
110 | + <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"></link> |
111 | + <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"></link> |
112 | + |
113 | + |
114 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
115 | + <script type="text/javascript" src="../../build/yui/current/build/widget/widget-position-debug.js"></script> |
116 | + <script type="text/javascript" src="../../build/yui/current/build/widget/widget-position-ext-debug.js"></script> |
117 | + <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
118 | + <script type="text/javascript" src="../../build/autocomplete/autocomplete.js"></script> |
119 | <script type="text/javascript"> |
120 | |
121 | var LP = YUI({ |
122 | - base: '../../lib/yui/current/build/', |
123 | + base: '../../build/yui/current/build/', |
124 | filter: 'raw' |
125 | }); |
126 | |
127 | @@ -241,9 +241,9 @@ |
128 | We need to include individual css files because some of them have |
129 | relative paths to images. |
130 | --> |
131 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr-sam.css"></link> |
132 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr/assets/skins/sam/lazr.css"></link> |
133 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/autocomplete/assets/skins/sam/autocomplete.css"></link> |
134 | + <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
135 | + <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
136 | + <link type="text/css" rel="stylesheet" href="../../build/autocomplete/assets/skins/sam/autocomplete.css"></link> |
137 | |
138 | <style type="text/css"> |
139 | #example { |
140 | |
141 | === modified file 'examples/choiceedit/index.html' |
142 | --- examples/choiceedit/index.html 2009-07-30 22:55:42 +0000 |
143 | +++ examples/choiceedit/index.html 2009-10-30 17:01:13 +0000 |
144 | @@ -2,150 +2,27 @@ |
145 | <html> |
146 | <head> |
147 | <title>Lazr-js examples: Choice editing</title> |
148 | - <script type="text/javascript" src="../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
149 | - <script type="text/javascript" src="../../lib/lazr/build/lazr.js"></script> |
150 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
151 | + <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
152 | + <script type="text/javascript" src="../../build/anim/anim.js"></script> |
153 | + <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
154 | |
155 | <!-- |
156 | We need to include individual css files because some of them have |
157 | relative paths to images. |
158 | --> |
159 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr-sam.css"></link> |
160 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr/assets/skins/sam/lazr.css"></link> |
161 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/inlineedit/assets/skins/sam/editor.css"></link> |
162 | - |
163 | - <script type="text/javascript" src="../../lib/lazr/build/choiceedit/choiceedit.js"></script> |
164 | - <script> |
165 | - YUI({ |
166 | - base: '../../lib/yui/3.0.0pr2/build/', |
167 | - filter: 'raw' |
168 | - }).use('node', 'event', 'widget', 'plugin', 'overlay', 'lazr.choiceedit', function(Y) { |
169 | - |
170 | - // Add a delay between the start and end of the inline editor widget's |
171 | - // "save" event. |
172 | - var DelayedSavePlugin = function(config) { |
173 | - DelayedSavePlugin.superclass.constructor.apply(this, arguments); |
174 | - }; |
175 | - |
176 | - DelayedSavePlugin.NAME = 'delayedsave'; |
177 | - DelayedSavePlugin.NS = 'fx'; |
178 | - |
179 | - DelayedSavePlugin.ATTRS = { |
180 | - /* |
181 | - * Default duration of the 'saving' delay, in milliseconds. |
182 | - */ |
183 | - duration: { |
184 | - value: 2000 |
185 | - } |
186 | - }; |
187 | - |
188 | - Y.extend(DelayedSavePlugin, Y.Plugin, { |
189 | - |
190 | - initializer: function(config) { |
191 | - // Save a reference to the original _saveData() method before |
192 | - // we wrap it up. |
193 | - this.original_save = config.owner._saveData; |
194 | - |
195 | - // We want to run our delayed-save code before the original |
196 | - // 'save' method. Using doBefore() means that unplugging our |
197 | - // code will leave the original widget in a clean state. |
198 | - this.doBefore("_saveData", this._altSave); |
199 | - }, |
200 | - |
201 | - destructor: function() {}, |
202 | - |
203 | - /* |
204 | - * Our own _altSave() method, used to override the owner's default |
205 | - * behaviour. This method will only be called if the editor's input |
206 | - * is valid. |
207 | - */ |
208 | - _altSave: function() { |
209 | - var owner = this._owner, |
210 | - delay = this.get('duration'); |
211 | - |
212 | - Y.log("Running alternative _saveData()", 'info'); |
213 | - |
214 | - // Set the UI 'waiting' status. |
215 | - owner._uiSetWaiting(); |
216 | - |
217 | - // Introduce a configurable delay around the owner's _saveData() |
218 | - // method. |
219 | - Y.later(delay, this, function() { |
220 | - |
221 | - Y.log("Running original 'save' method.", 'info'); |
222 | - this.original_save.apply(owner, arguments[0]); |
223 | - |
224 | - // Make sure we clear the 'waiting' status. |
225 | - owner._uiClearWaiting(); |
226 | - |
227 | - }, arguments); |
228 | - |
229 | - // Make sure we prevent the default _devSave() method from |
230 | - // running. |
231 | - return new Y.Do.Halt(); |
232 | - } |
233 | - }); |
234 | - |
235 | - |
236 | - var choice_edit = new Y.ChoiceSource({ |
237 | - contentBox: '#status', |
238 | - value: 'incomplete', |
239 | - title: 'Change status to', |
240 | - items: [ |
241 | - { name: 'New', value: 'new', style: '', |
242 | - help: '', disabled: false }, |
243 | - { name: 'Invalid', value: 'invalid', style: '', |
244 | - help: '', disabled: true }, |
245 | - { name: 'Incomplete', value: 'incomplete', style: '', |
246 | - help: '', disabled: false }, |
247 | - { name: 'Fix Released', value: 'fixreleased', style: '', |
248 | - help: '', disabled: false }, |
249 | - { name: 'Fix Committed', value: 'fixcommitted', style: '', |
250 | - help: '', disabled: true }, |
251 | - { name: 'In Progress', value: 'inprogress', style: '', |
252 | - help: '', disabled: false } |
253 | - ] |
254 | - }); |
255 | - |
256 | - // Add the 2 second delay to the underlying editor widget. |
257 | - choice_edit.plug({fn:DelayedSavePlugin}); |
258 | - |
259 | - choice_edit.render(); |
260 | - |
261 | - |
262 | - var null_choice_edit = new Y.NullChoiceSource({ |
263 | - contentBox: '#nullchoiceedit', |
264 | - value: null, |
265 | - title: 'Choose something', |
266 | - items: [ |
267 | - { name: 'Chico', value: 'chico', style: '', |
268 | - help: '', disabled: false }, |
269 | - { name: 'Harpo', value: 'harpo', style: '', |
270 | - help: '', disabled: false }, |
271 | - { name: 'Groucho', value: 'groucho', style: '', |
272 | - help: '', disabled: false }, |
273 | - { name: 'Gummo', value: 'gummo', style: '', |
274 | - help: '', disabled: false }, |
275 | - { name: 'Zeppo', value: 'zeppo', style: '', |
276 | - help: '', disabled: false }, |
277 | - { name: 'Not funny!', value: null, style: '', |
278 | - help: '', disabled: false } |
279 | - ] |
280 | - }); |
281 | - |
282 | - // Add the 2 second delay to the underlying editor widget. |
283 | - null_choice_edit.plug({fn:DelayedSavePlugin}); |
284 | - |
285 | - null_choice_edit.render(); |
286 | - }) |
287 | - |
288 | - </script> |
289 | - |
290 | - <link type="text/css" rel="stylesheet" |
291 | - href="../../lib/lazr/build/overlay/assets/pretty-overlay-core.css"> |
292 | - <link type="text/css" rel="stylesheet" |
293 | - href="../../lib/lazr/build/overlay/assets/skins/sam/pretty-overlay-skin.css"> |
294 | - <link type="text/css" rel="stylesheet" |
295 | - href="../../lib/lazr/build/choiceedit/assets/choiceedit-core.css"> |
296 | + <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
297 | + <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
298 | + <link type="text/css" rel="stylesheet" href="../../build/inlineedit/assets/skins/sam/editor.css"></link> |
299 | + |
300 | + <script type="text/javascript" src="../../build/choiceedit/choiceedit.js"></script> |
301 | + |
302 | + <link type="text/css" rel="stylesheet" |
303 | + href="../../build/overlay/assets/pretty-overlay-core.css"> |
304 | + <link type="text/css" rel="stylesheet" |
305 | + href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"> |
306 | + <link type="text/css" rel="stylesheet" |
307 | + href="../../build/choiceedit/assets/choiceedit-core.css"> |
308 | </head> |
309 | <body class="yui-skin-sam"> |
310 | |
311 | @@ -159,15 +36,15 @@ |
312 | |
313 | <h2>Required include dependencies</h2> |
314 | <pre> |
315 | - <script type="text/javascript" src="../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
316 | - <script type="text/javascript" src="../../lib/lazr/build/choiceedit/choiceedit.js"></script> |
317 | - <script type="text/javascript" src="../../lib/lazr/build/anim/anim.js"></script> |
318 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
319 | + <script type="text/javascript" src="../../build/choiceedit/choiceedit.js"></script> |
320 | + <script type="text/javascript" src="../../build/anim/anim.js"></script> |
321 | |
322 | <!-- overlay required files --> |
323 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/overlay/assets/pretty-overlay-core.css"></link> |
324 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/overlay/assets/skins/sam/pretty-overlay-skin.css"></link> |
325 | + <link type="text/css" rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css"></link> |
326 | + <link type="text/css" rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"></link> |
327 | <!-- choiceedit required files --> |
328 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/choiceedit/assets/choiceedit-core.css"></link> |
329 | + <link type="text/css" rel="stylesheet" href="../../build/choiceedit/assets/choiceedit-core.css"></link> |
330 | |
331 | </pre> |
332 | |
333 | @@ -297,5 +174,131 @@ |
334 | </p> |
335 | </pre> |
336 | |
337 | + <script> |
338 | + YUI({ |
339 | + base: '../../build/yui/current/build/', |
340 | + filter: 'raw' |
341 | + }).use('node', 'event', 'widget', 'plugin', 'overlay', 'lazr.choiceedit', function(Y) { |
342 | + |
343 | + // Add a delay between the start and end of the inline editor widget's |
344 | + // "save" event. |
345 | + var DelayedSavePlugin = function(config) { |
346 | + DelayedSavePlugin.superclass.constructor.apply(this, arguments); |
347 | + }; |
348 | + |
349 | + DelayedSavePlugin.NAME = 'delayedsave'; |
350 | + DelayedSavePlugin.NS = 'fx'; |
351 | + |
352 | + DelayedSavePlugin.ATTRS = { |
353 | + /* |
354 | + * Default duration of the 'saving' delay, in milliseconds. |
355 | + */ |
356 | + duration: { |
357 | + value: 2000 |
358 | + } |
359 | + }; |
360 | + |
361 | + Y.extend(DelayedSavePlugin, Y.Plugin.Base, { |
362 | + |
363 | + initializer: function(config) { |
364 | + // Save a reference to the original _saveData() method before |
365 | + // we wrap it up. |
366 | + this.original_save = config.host._saveData; |
367 | + |
368 | + // We want to run our delayed-save code before the original |
369 | + // 'save' method. Using doBefore() means that unplugging our |
370 | + // code will leave the original widget in a clean state. |
371 | + this.doBefore("_saveData", this._altSave); |
372 | + }, |
373 | + |
374 | + destructor: function() {}, |
375 | + |
376 | + /* |
377 | + * Our own _altSave() method, used to override the host's default |
378 | + * behaviour. This method will only be called if the editor's input |
379 | + * is valid. |
380 | + */ |
381 | + _altSave: function() { |
382 | + var host = this.get('host'), |
383 | + delay = this.get('duration'); |
384 | + |
385 | + Y.log("Running alternative _saveData()", 'info'); |
386 | + |
387 | + // Set the UI 'waiting' status. |
388 | + host._uiSetWaiting(); |
389 | + |
390 | + // Introduce a configurable delay around the host's _saveData() |
391 | + // method. |
392 | + Y.later(delay, this, function() { |
393 | + |
394 | + Y.log("Running original 'save' method.", 'info'); |
395 | + this.original_save.apply(host, arguments); |
396 | + |
397 | + // Make sure we clear the 'waiting' status. |
398 | + host._uiClearWaiting(); |
399 | + |
400 | + }, arguments); |
401 | + |
402 | + // Make sure we prevent the default _devSave() method from |
403 | + // running. |
404 | + return new Y.Do.Halt(); |
405 | + } |
406 | + }); |
407 | + |
408 | + |
409 | + var choice_edit = new Y.ChoiceSource({ |
410 | + contentBox: '#status', |
411 | + value: 'incomplete', |
412 | + title: 'Change status to', |
413 | + items: [ |
414 | + { name: 'New', value: 'new', style: '', |
415 | + help: '', disabled: false }, |
416 | + { name: 'Invalid', value: 'invalid', style: '', |
417 | + help: '', disabled: true }, |
418 | + { name: 'Incomplete', value: 'incomplete', style: '', |
419 | + help: '', disabled: false }, |
420 | + { name: 'Fix Released', value: 'fixreleased', style: '', |
421 | + help: '', disabled: false }, |
422 | + { name: 'Fix Committed', value: 'fixcommitted', style: '', |
423 | + help: '', disabled: true }, |
424 | + { name: 'In Progress', value: 'inprogress', style: '', |
425 | + help: '', disabled: false } |
426 | + ] |
427 | + }); |
428 | + |
429 | + // Add the 2 second delay to the underlying editor widget. |
430 | + choice_edit.plug({fn:DelayedSavePlugin}); |
431 | + |
432 | + choice_edit.render(); |
433 | + |
434 | + |
435 | + var null_choice_edit = new Y.NullChoiceSource({ |
436 | + contentBox: '#nullchoiceedit', |
437 | + value: null, |
438 | + title: 'Choose something', |
439 | + items: [ |
440 | + { name: 'Chico', value: 'chico', style: '', |
441 | + help: '', disabled: false }, |
442 | + { name: 'Harpo', value: 'harpo', style: '', |
443 | + help: '', disabled: false }, |
444 | + { name: 'Groucho', value: 'groucho', style: '', |
445 | + help: '', disabled: false }, |
446 | + { name: 'Gummo', value: 'gummo', style: '', |
447 | + help: '', disabled: false }, |
448 | + { name: 'Zeppo', value: 'zeppo', style: '', |
449 | + help: '', disabled: false }, |
450 | + { name: 'Not funny!', value: null, style: '', |
451 | + help: '', disabled: false } |
452 | + ] |
453 | + }); |
454 | + |
455 | + // Add the 2 second delay to the underlying editor widget. |
456 | + null_choice_edit.plug({fn:DelayedSavePlugin}); |
457 | + |
458 | + null_choice_edit.render(); |
459 | + }) |
460 | + |
461 | + </script> |
462 | + |
463 | </body> |
464 | </html> |
465 | |
466 | === modified file 'examples/effects/index.html' |
467 | --- examples/effects/index.html 2009-07-21 02:14:12 +0000 |
468 | +++ examples/effects/index.html 2009-10-30 17:01:13 +0000 |
469 | @@ -4,21 +4,21 @@ |
470 | <head> |
471 | <title>Lazr-js examples: lazr.effects</title> |
472 | |
473 | - <link type="text/css" rel="stylesheet" href="../../lib/yui/current/build/cssreset/reset.css"></link> |
474 | - <link type="text/css" rel="stylesheet" href="../../lib/yui/current/build/cssfonts/fonts.css"></link> |
475 | - <link type="text/css" rel="stylesheet" href="../../lib/yui/current/build/cssbase/base.css"></link> |
476 | + <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"></link> |
477 | + <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"></link> |
478 | + <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"></link> |
479 | |
480 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
481 | - <script type="text/javascript" src="../../lib/lazr/build/lazr.js"></script> |
482 | - <script type="text/javascript" src="../../lib/lazr/build/effects/effects.js"></script> |
483 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
484 | + <script type="text/javascript" src="../../build/lazr.js"></script> |
485 | + <script type="text/javascript" src="../../build/effects/effects.js"></script> |
486 | |
487 | <!-- |
488 | We need to include individual css files because some of them have |
489 | relative paths to images. |
490 | --> |
491 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr-sam.css"></link> |
492 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr/assets/skins/sam/lazr.css"></link> |
493 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/effects/assets/skins/sam/effects.css"></link> |
494 | + <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
495 | + <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
496 | + <link type="text/css" rel="stylesheet" href="../../build/effects/assets/skins/sam/effects.css"></link> |
497 | |
498 | <style type="text/css"> |
499 | .example { |
500 | @@ -192,7 +192,7 @@ |
501 | <script type="text/javascript"> |
502 | |
503 | YUI({ |
504 | - base: '../../lib/yui/current/build/', |
505 | + base: '../../build/yui/current/build/', |
506 | filter: 'raw' |
507 | }).use('node', 'event', 'lazr.effects', function(Y) { |
508 | |
509 | |
510 | === modified file 'examples/formoverlay/index.html' |
511 | --- examples/formoverlay/index.html 2009-05-15 07:38:48 +0000 |
512 | +++ examples/formoverlay/index.html 2009-10-30 17:01:13 +0000 |
513 | @@ -5,21 +5,22 @@ |
514 | <title>LAZR JS Examples: lazr.formoverlay</title> |
515 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
516 | |
517 | - <script type="text/javascript" src="../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
518 | - <script type="text/javascript" src="../../lib/lazr/build/overlay/overlay.js"></script> |
519 | - <script type="text/javascript" src="../../lib/lazr/build/formoverlay/formoverlay.js"></script> |
520 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
521 | + <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
522 | + <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
523 | + <script type="text/javascript" src="../../build/formoverlay/formoverlay.js"></script> |
524 | |
525 | - <link rel="stylesheet" href="../../lib/yui/3.0.0pr2/build/cssreset/reset.css"/> |
526 | - <link rel="stylesheet" href="../../lib/yui/3.0.0pr2/build/cssfonts/fonts.css"/> |
527 | - <link rel="stylesheet" href="../../lib/yui/3.0.0pr2/build/cssbase/base.css"/> |
528 | - <link rel="stylesheet" href="../../lib/lazr/build/overlay/assets/pretty-overlay-core.css"/> |
529 | - <link rel="stylesheet" href="../../lib/lazr/build/overlay/assets/skins/sam/pretty-overlay-skin.css"/> |
530 | - <link rel="stylesheet" href="../../lib/lazr/build/formoverlay/assets/formoverlay.css"/> |
531 | + <link rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"/> |
532 | + <link rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"/> |
533 | + <link rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"/> |
534 | + <link rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css"/> |
535 | + <link rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"/> |
536 | + <link rel="stylesheet" href="../../build/formoverlay/assets/formoverlay.css"/> |
537 | |
538 | <script type="text/javascript"> |
539 | |
540 | YUI({ |
541 | - base: "../../lib/yui/3.0.0pr2/build/", |
542 | + base: "../../build/yui/current/build/", |
543 | filter: 'raw', |
544 | }).use('lazr.formoverlay', 'node', 'event', 'dump', function(Y) { |
545 | |
546 | @@ -93,7 +94,9 @@ |
547 | }); |
548 | formoverlay.render(); |
549 | |
550 | - Y.on("domready", function(){ formoverlay.show()}); |
551 | + Y.on("domready", function(){ |
552 | + formoverlay.show(); |
553 | + }); |
554 | |
555 | Y.on('click', function(e) { |
556 | Y.log("Showing overlay", "info"); |
557 | @@ -123,16 +126,16 @@ |
558 | |
559 | <h3>Javascript</h3> |
560 | <pre> |
561 | - <script type="text/javascript" src="../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
562 | - <script type="text/javascript" src="../../lib/lazr/build/overlay/overlay.js"></script> |
563 | - <script type="text/javascript" src="../../lib/lazr/build/formoverlay/formoverlay.js"></script> |
564 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
565 | + <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
566 | + <script type="text/javascript" src="../../build/formoverlay/formoverlay.js"></script> |
567 | </pre> |
568 | |
569 | <h3>CSS</h3> |
570 | <pre> |
571 | - <link rel="stylesheet" href="../../lib/lazr/build/overlay/assets/pretty-overlay-core.css" /> |
572 | - <link rel="stylesheet" href="../../lib/lazr/build/overlay/assets/skins/sam/pretty-overlay-skin.css" /> |
573 | - <link rel="stylesheet" href="../../lib/lazr/build/formoverlay/assets/formoverlay.css" /> |
574 | + <link rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css" /> |
575 | + <link rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css" /> |
576 | + <link rel="stylesheet" href="../../build/formoverlay/assets/formoverlay.css" /> |
577 | </pre> |
578 | |
579 | <h2>Widget Setup</h2> |
580 | |
581 | === modified file 'examples/inlineeditor/index.html' |
582 | --- examples/inlineeditor/index.html 2009-10-22 02:04:44 +0000 |
583 | +++ examples/inlineeditor/index.html 2009-10-30 17:01:13 +0000 |
584 | @@ -3,117 +3,19 @@ |
585 | <html> |
586 | <head> |
587 | <title>Lazr-js examples: In-line text editing</title> |
588 | - <script type="text/javascript" src="../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
589 | - <script type="text/javascript" src="../../lib/lazr/build/lazr.js"></script> |
590 | - <script type="text/javascript" src="../../lib/lazr/build/inlineedit/editor.js"></script> |
591 | - <script type="text/javascript"> |
592 | - |
593 | -YUI({ |
594 | - base: '../../lib/yui/3.0.0pr2/build/', |
595 | - filter: 'raw' |
596 | - }).use('node', 'event', 'plugin', 'lazr.editor', function(Y) { |
597 | - |
598 | - // Add a delay between the start and end of the inline editor widget's |
599 | - // "save" event. |
600 | - var DelayedSavePlugin = function(config) { |
601 | - DelayedSavePlugin.superclass.constructor.apply(this, arguments); |
602 | - }; |
603 | - |
604 | - DelayedSavePlugin.NAME = 'delayedsave'; |
605 | - DelayedSavePlugin.NS = 'fx'; |
606 | - |
607 | - DelayedSavePlugin.ATTRS = { |
608 | - /* |
609 | - * Default duration of the 'saving' delay, in milliseconds. |
610 | - */ |
611 | - duration: { |
612 | - value: 2000 |
613 | - } |
614 | - }; |
615 | - |
616 | - Y.extend(DelayedSavePlugin, Y.Plugin, { |
617 | - |
618 | - initializer: function(config) { |
619 | - // Save a reference to the original _saveData() method before |
620 | - // we wrap it up. |
621 | - this.original_save = config.owner._saveData; |
622 | - |
623 | - // We want to run our delayed-save code before the original |
624 | - // 'save' method. Using doBefore() means that unplugging our |
625 | - // code will leave the original widget in a clean state. |
626 | - this.doBefore("_saveData", this._altSave); |
627 | - }, |
628 | - |
629 | - destructor: function() {}, |
630 | - |
631 | - /* |
632 | - * Our own _altSave() method, used to override the owner's default |
633 | - * behaviour. This method will only be called if the editor's input |
634 | - * is valid. |
635 | - */ |
636 | - _altSave: function() { |
637 | - var owner = this._owner, |
638 | - delay = this.get('duration'); |
639 | - |
640 | - Y.log("Running alternative _saveData()", 'info'); |
641 | - |
642 | - // Set the UI 'waiting' status. |
643 | - owner._uiSetWaiting(); |
644 | - |
645 | - // Introduce a configurable delay around the owner's _saveData() |
646 | - // method. |
647 | - Y.later(delay, this, function() { |
648 | - |
649 | - Y.log("Running original 'save' method.", 'info'); |
650 | - this.original_save.apply(owner, arguments[0]); |
651 | - |
652 | - // Make sure we clear the 'waiting' status. |
653 | - owner._uiClearWaiting(); |
654 | - |
655 | - }, arguments); |
656 | - |
657 | - // Make sure we prevent the default _devSave() method from |
658 | - // running. |
659 | - return new Y.Do.Halt(); |
660 | - } |
661 | - }); |
662 | - |
663 | - var editable_text = new Y.EditableText({ |
664 | - contentBox: '#editable_text' |
665 | - }); |
666 | - |
667 | - editable_text.render(); |
668 | - |
669 | - // Add the 2 second delay to the underlying editor widget. |
670 | - editable_text.editor.plug({fn:DelayedSavePlugin}); |
671 | - |
672 | - // Hook up the "allow empty" button. |
673 | - Y.on('click', function(ev) { |
674 | - var accept_empty = !editor.get('accept_empty'); |
675 | - Y.log("Allowing empty editor input: " + accept_empty, 'info'); |
676 | - editor.set('accept_empty', accept_empty); |
677 | - }, 'input[name=accept_empty]'); |
678 | - |
679 | - var multiline_text = new Y.EditableText({ |
680 | - contentBox: '#edit-test-description', |
681 | - multiline: true, |
682 | - buttons: 'top' |
683 | - }); |
684 | - multiline_text.render(); |
685 | - |
686 | - // Add the 2 second delay to the underlying editor widget. |
687 | - multiline_text.editor.plug({fn:DelayedSavePlugin}); |
688 | -}); |
689 | - </script> |
690 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
691 | + <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
692 | + <script type="text/javascript" src="../../build/anim/anim.js"></script> |
693 | + <script type="text/javascript" src="../../build/inlineedit/editor.js"></script> |
694 | |
695 | <!-- |
696 | We need to include individual css files because some of them have |
697 | relative paths to images. |
698 | --> |
699 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr-sam.css"></link> |
700 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/lazr/assets/skins/sam/lazr.css"></link> |
701 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/inlineedit/assets/skins/sam/editor.css"></link> |
702 | - <link rel="stylesheet" type="text/css" href="../../src/inlineedit/assets/skins/sam/editor-skin.css" /> |
703 | + <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
704 | + <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
705 | + <link type="text/css" rel="stylesheet" href="../../build/inlineedit/assets/skins/sam/editor.css"></link> |
706 | + <link rel="stylesheet" type="text/css" href="../../build/inlineedit/assets/skins/sam/editor-skin.css" /> |
707 | <style> |
708 | #example { |
709 | margin-left: 20px; |
710 | @@ -163,11 +65,11 @@ |
711 | <p><strong>Don't forget to include the widget's CSS files!</strong></p> |
712 | |
713 | <pre> |
714 | - <script type="text/javascript" src="../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
715 | - <script type="text/javascript" src="../../lib/lazr/build/inlineedit/editor.js"></script> |
716 | - <script type="text/javascript" src="../../lib/lazr/build/anim/anim.js"></script> |
717 | + <script type="text/javascript" src="../../build/yui/3.0.0pr2/build/yui/yui.js"></script> |
718 | + <script type="text/javascript" src="../../build/inlineedit/editor.js"></script> |
719 | + <script type="text/javascript" src="../../build/anim/anim.js"></script> |
720 | |
721 | - <link type="text/css" rel="stylesheet" href="../../lib/lazr/build/inlineedit/assets/skins/sam/editor.css"></link> |
722 | + <link type="text/css" rel="stylesheet" href="../../build/inlineedit/assets/skins/sam/editor.css"></link> |
723 | </pre> |
724 | |
725 | <pre> |
726 | @@ -425,5 +327,106 @@ |
727 | </li> |
728 | </ul> |
729 | |
730 | + <script type="text/javascript"> |
731 | + |
732 | +YUI({ |
733 | + base: '../../build/yui/current/build/', |
734 | + filter: 'raw' |
735 | + }).use('node', 'event', 'plugin', 'lazr.editor', function(Y) { |
736 | + |
737 | + // Add a delay between the start and end of the inline editor widget's |
738 | + // "save" event. |
739 | + var DelayedSavePlugin = function(config) { |
740 | + DelayedSavePlugin.superclass.constructor.apply(this, arguments); |
741 | + }; |
742 | + |
743 | + DelayedSavePlugin.NAME = 'delayedsave'; |
744 | + DelayedSavePlugin.NS = 'fx'; |
745 | + |
746 | + DelayedSavePlugin.ATTRS = { |
747 | + /* |
748 | + * Default duration of the 'saving' delay, in milliseconds. |
749 | + */ |
750 | + duration: { |
751 | + value: 2000 |
752 | + } |
753 | + }; |
754 | + |
755 | + Y.extend(DelayedSavePlugin, Y.Plugin.Base, { |
756 | + |
757 | + initializer: function(config) { |
758 | + // Save a reference to the original _saveData() method before |
759 | + // we wrap it up. |
760 | + this.original_save = config.host._saveData; |
761 | + |
762 | + // We want to run our delayed-save code before the original |
763 | + // 'save' method. Using doBefore() means that unplugging our |
764 | + // code will leave the original widget in a clean state. |
765 | + this.doBefore("_saveData", this._altSave); |
766 | + }, |
767 | + |
768 | + destructor: function() {}, |
769 | + |
770 | + /* |
771 | + * Our own _altSave() method, used to override the host's default |
772 | + * behaviour. This method will only be called if the editor's input |
773 | + * is valid. |
774 | + */ |
775 | + _altSave: function() { |
776 | + var host = this.get('host'), |
777 | + delay = this.get('duration'); |
778 | + |
779 | + Y.log("Running alternative _saveData()", 'info'); |
780 | + |
781 | + // Set the UI 'waiting' status. |
782 | + host._uiSetWaiting(); |
783 | + |
784 | + // Introduce a configurable delay around the host's _saveData() |
785 | + // method. |
786 | + Y.later(delay, this, function() { |
787 | + |
788 | + Y.log("Running original 'save' method.", 'info'); |
789 | + this.original_save.apply(host, arguments); |
790 | + |
791 | + // Make sure we clear the 'waiting' status. |
792 | + host._uiClearWaiting(); |
793 | + |
794 | + }, arguments); |
795 | + |
796 | + // Make sure we prevent the default _devSave() method from |
797 | + // running. |
798 | + return new Y.Do.Halt(); |
799 | + } |
800 | + }); |
801 | + |
802 | + var editable_text = new Y.EditableText({ |
803 | + contentBox: '#editable_text' |
804 | + }); |
805 | + |
806 | + editable_text.render(); |
807 | + |
808 | + // Add the 2 second delay to the underlying editor widget. |
809 | + editable_text.editor.plug({fn:DelayedSavePlugin}); |
810 | + |
811 | + // Hook up the "allow empty" button. |
812 | + Y.on('click', function(ev) { |
813 | + var accept_empty = !editable_text.get('accept_empty'); |
814 | + Y.log("Allowing empty editor input: " + accept_empty, 'info'); |
815 | + editable_text.set('accept_empty', accept_empty); |
816 | + }, 'input[name=accept_empty]'); |
817 | + |
818 | + var multiline_text = new Y.EditableText({ |
819 | + contentBox: '#edit-test-description', |
820 | + multiline: true, |
821 | + buttons: 'top', |
822 | + }); |
823 | + multiline_text.render(); |
824 | + |
825 | + // Add the 2 second delay to the underlying editor widget. |
826 | + multiline_text.editor.plug({fn:DelayedSavePlugin}); |
827 | + |
828 | +}); |
829 | + </script> |
830 | + |
831 | </body> |
832 | </html> |
833 | |
834 | === modified file 'examples/lazr/index.html' |
835 | --- examples/lazr/index.html 2009-03-05 01:50:43 +0000 |
836 | +++ examples/lazr/index.html 2009-10-30 17:01:13 +0000 |
837 | @@ -5,13 +5,13 @@ |
838 | <title>LAZR JS Examples: lazr.base</title> |
839 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
840 | |
841 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
842 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
843 | <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
844 | |
845 | <script type="text/javascript"> |
846 | |
847 | YUI({ |
848 | - base: "../../lib/yui/current/build/", |
849 | + base: "../../build/yui/current/build/", |
850 | filter: 'raw', |
851 | }).use('node', 'lazr.base', function(Y) { |
852 | |
853 | @@ -72,7 +72,7 @@ |
854 | <p>The common usage:</p> |
855 | |
856 | <pre> |
857 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
858 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
859 | <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
860 | <script type="text/javascript" src="../../build/lazr/assets/skins/sam/lazr-skin.css"></script> |
861 | </pre> |
862 | |
863 | === modified file 'examples/overlay/index.html' |
864 | --- examples/overlay/index.html 2009-02-21 18:21:14 +0000 |
865 | +++ examples/overlay/index.html 2009-10-30 17:01:13 +0000 |
866 | @@ -5,12 +5,12 @@ |
867 | <title>LAZR JS Examples: lazr.overlay</title> |
868 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
869 | |
870 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
871 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
872 | <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
873 | |
874 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssreset/reset.css" /> |
875 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssfonts/fonts.css" /> |
876 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssbase/base.css" /> |
877 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssreset/reset.css" /> |
878 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssfonts/fonts.css" /> |
879 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssbase/base.css" /> |
880 | |
881 | <link rel="stylesheet" type="text/css" href="../../build/overlay/assets/pretty-overlay-core.css" /> |
882 | <link rel="stylesheet" type="text/css" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css" /> |
883 | @@ -109,7 +109,7 @@ |
884 | |
885 | <script type="text/javascript"> |
886 | YUI({ |
887 | - base: '../../lib/yui/current/build/', |
888 | + base: '../../build/yui/current/build/', |
889 | filter: "raw", |
890 | combine: false |
891 | }).use('lazr.overlay', function(Y) { |
892 | |
893 | === modified file 'examples/picker/index.html' |
894 | --- examples/picker/index.html 2009-05-07 16:27:01 +0000 |
895 | +++ examples/picker/index.html 2009-10-30 17:01:13 +0000 |
896 | @@ -3,7 +3,7 @@ |
897 | <html> |
898 | <head> |
899 | <title>Lazr-js examples: Picker widget</title> |
900 | - <script type="text/javascript" src="../../lib/yui/current/build/yui/yui.js"></script> |
901 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
902 | <script type="text/javascript" src="../../build/anim/anim.js"></script> |
903 | <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
904 | <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
905 | @@ -12,7 +12,7 @@ |
906 | <script type="text/javascript"> |
907 | |
908 | YUI({ |
909 | - base: '../../lib/yui/current/build/', |
910 | + base: '../../build/yui/current/build/', |
911 | filter: 'raw' |
912 | }).use('lazr.picker', 'dump', function(Y) { |
913 | // Parse the content of the textarea in the data structure |
914 | @@ -160,9 +160,9 @@ |
915 | }); |
916 | </script> |
917 | |
918 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssreset/reset.css" /> |
919 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssfonts/fonts.css" /> |
920 | - <link rel="stylesheet" type="text/css" href="../../lib/yui/current/build/cssbase/base.css" /> |
921 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssreset/reset.css" /> |
922 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssfonts/fonts.css" /> |
923 | + <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssbase/base.css" /> |
924 | |
925 | <link rel="stylesheet" type="text/css" href="../../build/overlay/assets/skins/sam/pretty-overlay.css" /> |
926 | <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css" /> |
927 | |
928 | === modified file 'setup.py' |
929 | --- setup.py 2009-10-28 19:04:25 +0000 |
930 | +++ setup.py 2009-10-30 17:01:13 +0000 |
931 | @@ -26,6 +26,7 @@ |
932 | license='GPL v3', |
933 | install_requires=[ |
934 | 'bzr', |
935 | + 'lazr.testing', |
936 | 'setuptools', |
937 | ], |
938 | url='https://launchpad.net/lazr-js', |
939 | |
940 | === modified file 'src-js/lazrjs/activator/tests/activator.html' |
941 | --- src-js/lazrjs/activator/tests/activator.html 2009-03-13 15:54:02 +0000 |
942 | +++ src-js/lazrjs/activator/tests/activator.html 2009-10-30 17:01:13 +0000 |
943 | @@ -5,30 +5,24 @@ |
944 | <title>Activator</title> |
945 | |
946 | <!-- YUI 3.0 Setup --> |
947 | - <script type="text/javascript" src="../../../lib/yui/current/build/yui/yui.js"></script> |
948 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssreset/reset.css"/> |
949 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssfonts/fonts.css"/> |
950 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssbase/base.css"/> |
951 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
952 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
953 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
954 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
955 | |
956 | <!-- The module under test --> |
957 | - <script type="text/javascript" src="../../../build/activator/activator.js"></script> |
958 | - <script type="text/javascript" src="../../../build/anim/anim.js"></script> |
959 | - <script type="text/javascript" src="../../../build/lazr/lazr.js"></script> |
960 | + <script type="text/javascript" src="../../activator/activator.js"></script> |
961 | + <script type="text/javascript" src="../../anim/anim.js"></script> |
962 | + <script type="text/javascript" src="../../lazr/lazr.js"></script> |
963 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
964 | |
965 | <!-- The test suite --> |
966 | <script type="text/javascript" src="activator.js"></script> |
967 | |
968 | - <link rel="stylesheet" href="../../../src/testing/assets/testlogger.css"/> |
969 | + <link rel="stylesheet" href="../../testing/assets/testlogger.css"/> |
970 | </head> |
971 | <body class="yui-skin-sam"> |
972 | |
973 | -<div id="workspace" |
974 | - style="border: 1px solid blue; |
975 | - width: 20em; |
976 | - margin: 1em; |
977 | - padding: 1em"> |
978 | -</div> |
979 | - |
980 | <div id="log"></div> |
981 | </body> |
982 | </html> |
983 | |
984 | === modified file 'src-js/lazrjs/activator/tests/activator.js' |
985 | --- src-js/lazrjs/activator/tests/activator.js 2009-04-22 02:42:02 +0000 |
986 | +++ src-js/lazrjs/activator/tests/activator.js 2009-10-30 17:01:13 +0000 |
987 | @@ -1,10 +1,11 @@ |
988 | /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
989 | |
990 | YUI({ |
991 | - base: '../../../lib/yui/current/build/', |
992 | + base: '../../yui/current/build/', |
993 | filter: 'raw', |
994 | combine: false |
995 | - }).use('lazr.activator', 'node', 'event', 'yuitest', 'console', function(Y) { |
996 | + }).use('lazr.activator', 'lazr.testing.runner', 'node', |
997 | + 'event', 'event-simulate', 'console', function(Y) { |
998 | |
999 | var Assert = Y.Assert; // For easy access to isTrue(), etc. |
1000 | |
1001 | @@ -37,6 +38,16 @@ |
1002 | |
1003 | setUp: function() { |
1004 | this.workspace = Y.get('#workspace'); |
1005 | + if (!this.workspace){ |
1006 | + Y.get(document.body).appendChild(Y.Node.create( |
1007 | + '<div id="workspace" ' + |
1008 | + 'style="border: 1px solid blue; ' + |
1009 | + 'width: 20em; ' + |
1010 | + 'margin: 1em; ' + |
1011 | + 'padding: 1em">'+ |
1012 | + '</div>')); |
1013 | + this.workspace = Y.get('#workspace'); |
1014 | + } |
1015 | this.workspace.appendChild(Y.Node.create( |
1016 | '<div id="example-1">' + |
1017 | '<span class="yui-activator-data-box">' + |
1018 | @@ -233,15 +244,7 @@ |
1019 | } |
1020 | })); |
1021 | |
1022 | -Y.Test.Runner.add(suite); |
1023 | - |
1024 | -var yconsole = new Y.Console({ |
1025 | - newestOnTop: false |
1026 | -}); |
1027 | -yconsole.render('#log'); |
1028 | - |
1029 | -Y.on('domready', function() { |
1030 | - Y.Test.Runner.run(); |
1031 | -}); |
1032 | +Y.lazr.testing.Runner.add(suite); |
1033 | +Y.lazr.testing.Runner.run(); |
1034 | |
1035 | }); |
1036 | |
1037 | === modified file 'src-js/lazrjs/autocomplete/autocomplete.js' |
1038 | --- src-js/lazrjs/autocomplete/autocomplete.js 2009-07-16 19:35:57 +0000 |
1039 | +++ src-js/lazrjs/autocomplete/autocomplete.js 2009-10-30 17:01:14 +0000 |
1040 | @@ -1,19 +1,4 @@ |
1041 | -/* |
1042 | - Copyright (c) 2009, Canonical Ltd. All rights reserved. |
1043 | - |
1044 | - This program is free software: you can redistribute it and/or modify |
1045 | - it under the terms of the GNU Affero General Public License as published by |
1046 | - the Free Software Foundation, either version 3 of the License, or |
1047 | - (at your option) any later version. |
1048 | - |
1049 | - This program is distributed in the hope that it will be useful, |
1050 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
1051 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1052 | - GNU Affero General Public License for more details. |
1053 | - |
1054 | - You should have received a copy of the GNU Affero General Public License |
1055 | - along with this program. If not, see <http://www.gnu.org/licenses/>. |
1056 | -*/ |
1057 | +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
1058 | |
1059 | YUI.add('lazr.autocomplete', function(Y) { |
1060 | |
1061 | @@ -51,7 +36,7 @@ |
1062 | |
1063 | // We need a base class on which to build our autocomplete widget, so we will |
1064 | // make that class capable of positioning itself, too. |
1065 | -var AutoCompleteBase = Y.Base.build(Y.Widget, [Y.WidgetStack]); |
1066 | +var AutoCompleteBase = Y.Base.build("AutoCompleteBase", Y.Widget, [Y.WidgetStack]); |
1067 | |
1068 | |
1069 | /** |
1070 | @@ -119,7 +104,7 @@ |
1071 | */ |
1072 | input: { |
1073 | value: null, |
1074 | - set: function(val) { |
1075 | + setter: function(val) { |
1076 | return this._setInput(val); |
1077 | } |
1078 | }, |
1079 | @@ -254,6 +239,8 @@ |
1080 | |
1081 | var cbox = this.get(CONTENT_BOX); |
1082 | |
1083 | + this.get(BOUNDING_BOX).unplug(Y.Plugin.NodeMenuNav); |
1084 | + |
1085 | if (this._completions) { |
1086 | cbox.replaceChild(list, this._completions); |
1087 | } else { |
1088 | @@ -261,7 +248,7 @@ |
1089 | } |
1090 | |
1091 | // Re-plug the MenuNav, so it updates the menu options. |
1092 | - this.get(BOUNDING_BOX).plug(Y.plugin.NodeMenuNav); |
1093 | + this.get(BOUNDING_BOX).plug(Y.Plugin.NodeMenuNav); |
1094 | |
1095 | // Highlight the first item. |
1096 | this._selectItem(0, false); |
1097 | @@ -601,7 +588,7 @@ |
1098 | // It is ugly to have to check protected members of the menu |
1099 | // like this, but the 'currently selected item' should |
1100 | // really be public, don't you think? |
1101 | - var menu = this.get(BOUNDING_BOX).MenuNav; |
1102 | + var menu = this.get(BOUNDING_BOX).menuNav; |
1103 | if (menu) { |
1104 | return menu._activeItem ? menu._activeItem : null; |
1105 | } |
1106 | @@ -620,11 +607,12 @@ |
1107 | * be found. |
1108 | */ |
1109 | _selectItem: function(index, set_focus) { |
1110 | - var menu = this.get(BOUNDING_BOX).MenuNav; |
1111 | + var menu = this.get(BOUNDING_BOX).menuNav; |
1112 | |
1113 | // More ugliness, looking at protected object members that should |
1114 | // be made public. |
1115 | - var item = menu ? menu._firstItem : null; |
1116 | + var firstItem = menu._rootMenu.all('.yui-menuitem').item(0) |
1117 | + var item = menu ? firstItem : null; |
1118 | if (!menu || !item) { |
1119 | return null; |
1120 | } |
1121 | @@ -636,11 +624,14 @@ |
1122 | } |
1123 | } |
1124 | |
1125 | - menu._setActiveItem(item); |
1126 | if (set_focus) { |
1127 | // We need an anchor to focus on, because some browsers (IE, ahem) |
1128 | // don't like focusing non-anchor things. |
1129 | var anchor = item.query('a'); |
1130 | + |
1131 | + menu._focusManager.set("activeDescendant", anchor); |
1132 | + menu._focusItem(item); |
1133 | + |
1134 | if (anchor) { |
1135 | // Use a 5ms timer to give the browser rendering engine some |
1136 | // time to catch up to the JS call, and prevent a race |
1137 | @@ -648,6 +639,7 @@ |
1138 | Y.later(5, anchor, anchor.focus); |
1139 | } |
1140 | } |
1141 | + menu._setActiveItem(item); |
1142 | return item; |
1143 | }, |
1144 | |
1145 | @@ -722,7 +714,7 @@ |
1146 | }, |
1147 | |
1148 | /** |
1149 | - * Handle presses of keys like Tab ane Enter |
1150 | + * Handle presses of keys like Tab and Enter |
1151 | * |
1152 | * @method _onInputKeydown |
1153 | * @protected |
1154 | @@ -797,11 +789,4 @@ |
1155 | }; |
1156 | |
1157 | |
1158 | -}, null, { |
1159 | - requires:[ |
1160 | - 'oop', |
1161 | - 'base', |
1162 | - 'widget', |
1163 | - 'widget-stack', |
1164 | - 'node-menunav' |
1165 | -]}); |
1166 | +}, '0.1', {requires:['oop', 'base', 'event', 'widget', 'widget-stack', 'node-menunav']}); |
1167 | |
1168 | === renamed file 'src-js/lazrjs/autocomplete/tests/test.js' => 'src-js/lazrjs/autocomplete/tests/autocomplete.js' |
1169 | --- src-js/lazrjs/autocomplete/tests/test.js 2009-03-27 04:38:14 +0000 |
1170 | +++ src-js/lazrjs/autocomplete/tests/autocomplete.js 2009-10-30 17:01:14 +0000 |
1171 | @@ -1,33 +1,17 @@ |
1172 | -/* |
1173 | - Copyright (c) 2009, Canonical Ltd. All rights reserved. |
1174 | - |
1175 | - This program is free software: you can redistribute it and/or modify |
1176 | - it under the terms of the GNU Affero General Public License as published by |
1177 | - the Free Software Foundation, either version 3 of the License, or |
1178 | - (at your option) any later version. |
1179 | - |
1180 | - This program is distributed in the hope that it will be useful, |
1181 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
1182 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1183 | - GNU Affero General Public License for more details. |
1184 | - |
1185 | - You should have received a copy of the GNU Affero General Public License |
1186 | - along with this program. If not, see <http://www.gnu.org/licenses/>. |
1187 | -*/ |
1188 | +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
1189 | |
1190 | YUI({ |
1191 | - base: '../../../lib/yui/current/build/', |
1192 | + base: '../../yui/current/build/', |
1193 | filter: 'raw', |
1194 | combine: false |
1195 | - }).use('lazr.autocomplete', 'node', 'event', 'yuitest', 'console', function(Y) { |
1196 | - |
1197 | + }).use('lazr.autocomplete', 'lazr.testing.runner', |
1198 | + 'node', 'event', 'console', function(Y) { |
1199 | |
1200 | /***************************** |
1201 | * |
1202 | * Helper methods and aliases |
1203 | * |
1204 | */ |
1205 | - |
1206 | var Assert = Y.Assert; |
1207 | |
1208 | /* Helper function to clean up a dynamically added widget instance. */ |
1209 | @@ -584,16 +568,7 @@ |
1210 | } |
1211 | })); |
1212 | |
1213 | - |
1214 | -Y.Test.Runner.add(suite); |
1215 | - |
1216 | -var yconsole = new Y.Console({ |
1217 | - newestOnTop: false |
1218 | -}); |
1219 | -yconsole.render('#log'); |
1220 | - |
1221 | -Y.on('domready', function() { |
1222 | - Y.Test.Runner.run(); |
1223 | -}); |
1224 | +Y.lazr.testing.Runner.add(suite); |
1225 | +Y.lazr.testing.Runner.run(); |
1226 | |
1227 | }); |
1228 | |
1229 | === modified file 'src-js/lazrjs/autocomplete/tests/index.html' |
1230 | --- src-js/lazrjs/autocomplete/tests/index.html 2009-03-18 00:42:42 +0000 |
1231 | +++ src-js/lazrjs/autocomplete/tests/index.html 2009-10-30 17:01:14 +0000 |
1232 | @@ -5,18 +5,19 @@ |
1233 | <title>autocomplete unit tests</title> |
1234 | |
1235 | <!-- YUI 3.0 Setup --> |
1236 | - <script type="text/javascript" src="../../../lib/yui/current/build/yui/yui.js"></script> |
1237 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssreset/reset.css"/> |
1238 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssfonts/fonts.css"/> |
1239 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssbase/base.css"/> |
1240 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
1241 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
1242 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
1243 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
1244 | |
1245 | - <link rel="stylesheet" href="../../../src/testing/assets/testlogger.css"/> |
1246 | + <link rel="stylesheet" href="../../testing/assets/testlogger.css"/> |
1247 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
1248 | |
1249 | <!-- The module under test --> |
1250 | <script type="text/javascript" src="../autocomplete.js"></script> |
1251 | |
1252 | <!-- The test suite --> |
1253 | - <script type="text/javascript" src="test.js"></script> |
1254 | + <script type="text/javascript" src="autocomplete.js"></script> |
1255 | |
1256 | </head> |
1257 | <body class="yui-skin-sam"> |
1258 | |
1259 | === modified file 'src-js/lazrjs/choiceedit/choiceedit.js' |
1260 | --- src-js/lazrjs/choiceedit/choiceedit.js 2009-08-21 14:06:19 +0000 |
1261 | +++ src-js/lazrjs/choiceedit/choiceedit.js 2009-10-30 17:01:14 +0000 |
1262 | @@ -20,6 +20,9 @@ |
1263 | C_ADDICON = 'addicon', |
1264 | SAVE = 'save', |
1265 | LEFT_MOUSE_BUTTON = 1, |
1266 | + RENDERUI = "renderUI", |
1267 | + BINDUI = "bindUI", |
1268 | + SYNCUI = "syncUI", |
1269 | NOTHING = new Object(); |
1270 | |
1271 | /** |
1272 | @@ -33,6 +36,8 @@ |
1273 | |
1274 | var ChoiceSource = function() { |
1275 | ChoiceSource.superclass.constructor.apply(this, arguments); |
1276 | + Y.after(this._bindUIChoiceSource, this, BINDUI); |
1277 | + Y.after(this._syncUIChoiceSource, this, SYNCUI); |
1278 | }; |
1279 | |
1280 | ChoiceSource.NAME = CHOICESOURCE; |
1281 | @@ -94,7 +99,7 @@ |
1282 | */ |
1283 | value_location: { |
1284 | value: null, |
1285 | - set: function(v) { |
1286 | + setter: function(v) { |
1287 | return Y.get(v); |
1288 | } |
1289 | }, |
1290 | @@ -110,7 +115,7 @@ |
1291 | */ |
1292 | editicon: { |
1293 | value: null, |
1294 | - set: function(v) { |
1295 | + setter: function(v) { |
1296 | return Y.get(v); |
1297 | } |
1298 | }, |
1299 | @@ -123,14 +128,14 @@ |
1300 | * @type Node |
1301 | */ |
1302 | actionicon: { |
1303 | - get: function() { |
1304 | + getter: function() { |
1305 | return this.get('editicon'); |
1306 | } |
1307 | }, |
1308 | |
1309 | elementToFlash: { |
1310 | value: null, |
1311 | - set: function(v) { |
1312 | + setter: function(v) { |
1313 | return Y.get(v); |
1314 | } |
1315 | }, |
1316 | @@ -138,7 +143,7 @@ |
1317 | backgroundColor: { |
1318 | value: null |
1319 | }, |
1320 | - |
1321 | + |
1322 | clickable_content: { |
1323 | value: true |
1324 | } |
1325 | @@ -160,10 +165,15 @@ |
1326 | |
1327 | /** |
1328 | * bind UI events |
1329 | + * <p> |
1330 | + * This method is invoked after bindUI is invoked for the Widget class |
1331 | + * using YUI's aop infrastructure. |
1332 | + * </p> |
1333 | * |
1334 | - * @method bindUI |
1335 | + * @method _bindUIChoiceSource |
1336 | + * @protected |
1337 | */ |
1338 | - bindUI: function() { |
1339 | + _bindUIChoiceSource: function() { |
1340 | var that = this; |
1341 | if (this.get('clickable_content')) { |
1342 | var clickable_element = this.get('contentBox'); |
1343 | @@ -188,10 +198,15 @@ |
1344 | |
1345 | /** |
1346 | * Update in-page HTML with current value of the field |
1347 | + * <p> |
1348 | + * This method is invoked after syncUI is invoked for the Widget class |
1349 | + * using YUI's aop infrastructure. |
1350 | + * </p> |
1351 | * |
1352 | - * @method syncUI |
1353 | + * @method _syncUIChoiceSource |
1354 | + * @protected |
1355 | */ |
1356 | - syncUI: function() { |
1357 | + _syncUIChoiceSource: function() { |
1358 | var items = this.get("items"); |
1359 | var value = this.get("value"); |
1360 | var node = this.get("value_location"); |
1361 | @@ -411,14 +426,21 @@ |
1362 | */ |
1363 | this.publish("valueChosen"); |
1364 | this.after("renderedChange", this._positionCorrectly); |
1365 | + Y.after(this._renderUIChoiceList, this, RENDERUI); |
1366 | + Y.after(this._bindUIChoiceList, this, BINDUI); |
1367 | }, |
1368 | |
1369 | /** |
1370 | * Render the popup menu |
1371 | + * <p> |
1372 | + * This method is invoked after renderUI is invoked for the Widget class |
1373 | + * using YUI's aop infrastructure. |
1374 | + * </p> |
1375 | * |
1376 | - * @method renderUI |
1377 | + * @method _renderUIChoiceList |
1378 | + * @protected |
1379 | */ |
1380 | - renderUI: function() { |
1381 | + _renderUIChoiceList: function() { |
1382 | this.set("align", { |
1383 | node: this.get("value_location"), |
1384 | points:[Y.WidgetPositionExt.TL, Y.WidgetPositionExt.TL] |
1385 | @@ -448,26 +470,26 @@ |
1386 | } |
1387 | display_items_list.appendChild(li); |
1388 | } |
1389 | - this.set("bodyContent", display_items_list); |
1390 | + |
1391 | + this.setStdModContent(Y.WidgetStdMod.BODY, display_items_list, Y.WidgetStdMod.REPLACE); |
1392 | this.move(-10000, 0); |
1393 | }, |
1394 | |
1395 | /** |
1396 | * Bind UI events |
1397 | + * <p> |
1398 | + * This method is invoked after bindUI is invoked for the Widget class |
1399 | + * using YUI's aop infrastructure. |
1400 | + * </p> |
1401 | * |
1402 | - * @method bindUI |
1403 | + * @method _bindUIChoiceList |
1404 | + * @protected |
1405 | */ |
1406 | - bindUI: function() { |
1407 | - // We need to call the superclass's bindUI because it does things. |
1408 | - ChoiceList.superclass.bindUI.apply(this); |
1409 | - |
1410 | + _bindUIChoiceList: function() { |
1411 | var display_items_list = this.get("display_items_list"); |
1412 | var that = this; |
1413 | - display_items_list.on("click", function(e) { |
1414 | - var target = e.target; |
1415 | - while (target.get("nodeName").toLowerCase() != "a") { |
1416 | - target = target.get("parentNode"); |
1417 | - } |
1418 | + Y.delegate("click", function(e) { |
1419 | + var target = e.currentTarget; |
1420 | var value = target._value; |
1421 | var items = that.get("items"); |
1422 | for (var i=0; i<items.length; i++) { |
1423 | @@ -478,7 +500,7 @@ |
1424 | break; |
1425 | } |
1426 | } |
1427 | - }); |
1428 | + }, display_items_list, "li a"); |
1429 | }, |
1430 | |
1431 | /** |
1432 | @@ -581,7 +603,7 @@ |
1433 | * @attribute actionicon |
1434 | */ |
1435 | actionicon: { |
1436 | - get: function() { |
1437 | + getter: function() { |
1438 | if (Y.Lang.isValue(this.get('value'))) { |
1439 | return this.get('editicon'); |
1440 | } else { |
1441 | @@ -598,7 +620,7 @@ |
1442 | */ |
1443 | items: { |
1444 | value: [], |
1445 | - get: function(v) { |
1446 | + getter: function(v) { |
1447 | if (!Y.Lang.isValue(this.get("value"))) { |
1448 | v = Y.Array(v).filter(function(item) { |
1449 | return (Y.Lang.isValue(item.value)); |
1450 | @@ -619,7 +641,7 @@ |
1451 | } |
1452 | return v; |
1453 | }, |
1454 | - clone : Y.Attribute.CLONE.DEEP |
1455 | + clone : "deep" |
1456 | } |
1457 | } |
1458 | |
1459 | @@ -647,6 +669,7 @@ |
1460 | |
1461 | Y.NullChoiceSource = NullChoiceSource; |
1462 | |
1463 | -},'0.2', {requires: |
1464 | - ['oop', 'event', 'node', 'widget', 'overlay', 'lazr.overlay', 'lazr.anim', 'lazr.base']}); |
1465 | +},'0.2', {requires: ['oop', 'event', 'event-delegate', 'node', |
1466 | + 'widget', 'widget-stdmod', 'overlay', |
1467 | + 'lazr.overlay', 'lazr.anim', 'lazr.base']}); |
1468 | |
1469 | |
1470 | === modified file 'src-js/lazrjs/choiceedit/tests/choiceedit.html' |
1471 | --- src-js/lazrjs/choiceedit/tests/choiceedit.html 2009-02-20 14:15:34 +0000 |
1472 | +++ src-js/lazrjs/choiceedit/tests/choiceedit.html 2009-10-30 17:01:14 +0000 |
1473 | @@ -4,17 +4,19 @@ |
1474 | <title>Status Editor</title> |
1475 | |
1476 | <!-- YUI 3.0 Setup --> |
1477 | - <script type="text/javascript" src="../../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
1478 | - <link rel="stylesheet" href="../../../lib/yui/3.0.0pr2/build/cssreset/reset.css"/> |
1479 | - <link rel="stylesheet" href="../../../lib/yui/3.0.0pr2/build/cssfonts/fonts.css"/> |
1480 | - <link rel="stylesheet" href="../../../lib/yui/3.0.0pr2/build/cssbase/base.css"/> |
1481 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
1482 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
1483 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
1484 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
1485 | |
1486 | <!-- Dependency --> |
1487 | - <script type="text/javascript" src="../../../lib/lazr/build/lazr.js"></script> |
1488 | - <script type="text/javascript" src="../../../lib/lazr/build/overlay/overlay.js"></script> |
1489 | + <script type="text/javascript" src="../../lazr/lazr.js"></script> |
1490 | + <script type="text/javascript" src="../../anim/anim.js"></script> |
1491 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
1492 | + <script type="text/javascript" src="../../overlay/overlay.js"></script> |
1493 | |
1494 | <!-- The module under test --> |
1495 | - <script type="text/javascript" src="../../../lib/lazr/build/choiceedit/choiceedit.js"></script> |
1496 | + <script type="text/javascript" src="../../choiceedit/choiceedit.js"></script> |
1497 | |
1498 | <!-- The test suite --> |
1499 | <script type="text/javascript" src="choiceedit.js"></script> |
1500 | |
1501 | === modified file 'src-js/lazrjs/choiceedit/tests/choiceedit.js' |
1502 | --- src-js/lazrjs/choiceedit/tests/choiceedit.js 2009-08-21 14:06:19 +0000 |
1503 | +++ src-js/lazrjs/choiceedit/tests/choiceedit.js 2009-10-30 17:01:14 +0000 |
1504 | @@ -1,10 +1,11 @@ |
1505 | /* Copyright (c) 2008, Canonical Ltd. All rights reserved. */ |
1506 | |
1507 | YUI({ |
1508 | - base: '../../../lib/yui/current/build/', |
1509 | + base: '../../yui/current/build/', |
1510 | filter: 'raw', |
1511 | combine: false |
1512 | - }).use('lazr.choiceedit', 'node', 'event', 'yuitest', 'widget-stack', 'console', function(Y) { |
1513 | + }).use('lazr.choiceedit', 'lazr.testing.runner', 'node', |
1514 | + 'event', 'widget-stack', 'console', function(Y) { |
1515 | |
1516 | // Local aliases |
1517 | var Assert = Y.Assert, |
1518 | @@ -525,15 +526,7 @@ |
1519 | } |
1520 | })); |
1521 | |
1522 | -Y.Test.Runner.add(suite); |
1523 | - |
1524 | -var yconsole = new Y.Console({ |
1525 | - newestOnTop: false |
1526 | -}); |
1527 | -yconsole.render('#log'); |
1528 | - |
1529 | -Y.on('domready', function() { |
1530 | - Y.Test.Runner.run(); |
1531 | -}); |
1532 | +Y.lazr.testing.Runner.add(suite); |
1533 | +Y.lazr.testing.Runner.run(); |
1534 | |
1535 | }); |
1536 | |
1537 | === modified file 'src-js/lazrjs/formoverlay/formoverlay.js' |
1538 | --- src-js/lazrjs/formoverlay/formoverlay.js 2009-08-13 13:08:36 +0000 |
1539 | +++ src-js/lazrjs/formoverlay/formoverlay.js 2009-10-30 17:01:14 +0000 |
1540 | @@ -8,6 +8,13 @@ |
1541 | * @module lazr.formoverlay |
1542 | */ |
1543 | |
1544 | + |
1545 | +var getCN = Y.ClassNameManager.getClassName, |
1546 | + NAME = 'lazr-formoverlay', |
1547 | + CONTENT_BOX = 'contentBox', |
1548 | + RENDERUI = "renderUI", |
1549 | + BINDUI = "bindUI"; |
1550 | + |
1551 | /** |
1552 | * The FormOverlay class builds on the lazr.PrettyOverlay class |
1553 | * to display form content and extract form data for the callsite. |
1554 | @@ -17,11 +24,12 @@ |
1555 | */ |
1556 | function FormOverlay(config) { |
1557 | FormOverlay.superclass.constructor.apply(this, arguments); |
1558 | + |
1559 | + Y.after(this._renderUIFormOverlay, this, RENDERUI); |
1560 | + Y.after(this._bindUIFormOverlay, this, BINDUI); |
1561 | + |
1562 | } |
1563 | |
1564 | -var getCN = Y.ClassNameManager.getClassName; |
1565 | -var NAME = 'lazr-formoverlay'; |
1566 | - |
1567 | FormOverlay.NAME = NAME; |
1568 | |
1569 | /** |
1570 | @@ -184,16 +192,19 @@ |
1571 | |
1572 | /** |
1573 | * Create the nodes for the form and add them to the contentBody. |
1574 | + * <p> |
1575 | + * This method is invoked after renderUI is invoked for the Widget class |
1576 | + * using YUI's aop infrastructure. |
1577 | + * </p> |
1578 | * |
1579 | - * @method renderUI |
1580 | + * @method _renderUIFormOverlay |
1581 | + * @protected |
1582 | */ |
1583 | - renderUI: function(){ |
1584 | - FormOverlay.superclass.renderUI.apply(this); |
1585 | - |
1586 | + _renderUIFormOverlay: function(){ |
1587 | // Create a node that will contain the form header: |
1588 | this.form_header_node = Y.Node.create( |
1589 | FormOverlay.FORM_HEADER_TEMPLATE); |
1590 | - |
1591 | + |
1592 | // Create a form node that will contain the form content: |
1593 | this.form_node = Y.Node.create(FormOverlay.FORM_TEMPLATE); |
1594 | |
1595 | @@ -216,51 +227,43 @@ |
1596 | this.error_node = Y.Node.create(FormOverlay.ERROR_TEMPLATE); |
1597 | |
1598 | this._setFormContent(); |
1599 | - |
1600 | }, |
1601 | |
1602 | /** |
1603 | * Bind the submit button to the _onFormSubmit() method. |
1604 | + * <p> |
1605 | + * This method is invoked after bindUI is invoked for the Widget class |
1606 | + * using YUI's aop infrastructure. |
1607 | + * </p> |
1608 | * |
1609 | * @method bindUI |
1610 | + * @protected |
1611 | */ |
1612 | - bindUI: function(){ |
1613 | - this.constructor.superclass.bindUI.call(this); |
1614 | - |
1615 | - Y.on( |
1616 | - "submit", |
1617 | - Y.bind(this._onFormSubmit, this), |
1618 | - this.form_node); |
1619 | + _bindUIFormOverlay: function(){ |
1620 | + Y.on("submit", |
1621 | + Y.bind(this._onFormSubmit, this), |
1622 | + this.form_node); |
1623 | |
1624 | // Setup the cancel button to hide the formoverlay. |
1625 | - Y.on( |
1626 | - "click", |
1627 | - Y.bind(function(e){ this.hide();}, this), |
1628 | - this.get("form_cancel_button")); |
1629 | - }, |
1630 | - |
1631 | - /** |
1632 | - * Show the widget by setting the "visible" attribute to "true". |
1633 | - * |
1634 | - * Overridden here to ensure that the focus is given to the first |
1635 | - * input element whenever the FormOverlay is shown. |
1636 | - * |
1637 | - * @method show |
1638 | - */ |
1639 | - show: function(){ |
1640 | - // If the 'centered' configuration attribute is set to true, |
1641 | - // then we should always re-center relative to the current |
1642 | - // viewport when shown: |
1643 | - if (this.get('centered')){ |
1644 | - this.centered(); |
1645 | - } |
1646 | - |
1647 | - this.constructor.superclass.show.call(this); |
1648 | - |
1649 | - var form_elem = Y.Node.getDOMNode(this.form_node); |
1650 | - if (form_elem.elements.length > 0) { |
1651 | - form_elem.elements[0].focus(); |
1652 | - } |
1653 | + Y.on("click", |
1654 | + Y.bind(function(e){ this.hide();}, this), |
1655 | + this.get("form_cancel_button")); |
1656 | + |
1657 | + this.on("visibleChange", function(e) { |
1658 | + // If the 'centered' configuration attribute is set to true, |
1659 | + // then we should always re-center relative to the current |
1660 | + // viewport when shown: |
1661 | + if (e.newVal) { |
1662 | + if (this.get('centered')){ |
1663 | + this.centered(); |
1664 | + } |
1665 | + |
1666 | + var form_elem = Y.Node.getDOMNode(this.form_node); |
1667 | + if (form_elem.elements.length > 0) { |
1668 | + Y.get(form_elem.elements[0]).focus(); |
1669 | + } |
1670 | + } |
1671 | + }); |
1672 | }, |
1673 | |
1674 | /** |
1675 | @@ -274,6 +277,7 @@ |
1676 | this.form_header_node.set('innerHTML', |
1677 | this.get('form_header')); |
1678 | |
1679 | + |
1680 | // Add the form content to the form node. |
1681 | // The form_content can be a string of HTML (as is useful when |
1682 | // it is obtained via AJAX) or a form node (as is useful if the |
1683 | @@ -300,7 +304,7 @@ |
1684 | body_node.appendChild(this.form_header_node); |
1685 | body_node.appendChild(this.form_node); |
1686 | |
1687 | - this.set("bodyContent", body_node); |
1688 | + this.setStdModContent(Y.WidgetStdMod.BODY, body_node, Y.WidgetStdMod.REPLACE); |
1689 | }, |
1690 | |
1691 | /** |
1692 | |
1693 | === modified file 'src-js/lazrjs/formoverlay/tests/formoverlay.html' |
1694 | --- src-js/lazrjs/formoverlay/tests/formoverlay.html 2009-08-13 08:54:56 +0000 |
1695 | +++ src-js/lazrjs/formoverlay/tests/formoverlay.html 2009-10-30 17:01:14 +0000 |
1696 | @@ -4,50 +4,26 @@ |
1697 | <title>Form Overlay</title> |
1698 | |
1699 | <!-- YUI 3.0 Setup --> |
1700 | - <script type="text/javascript" src="../../../lib/yui/3.0.0pr2/build/yui/yui.js"></script> |
1701 | - <link rel="stylesheet" href="../../../lib/yui/3.0.0pr2/build/cssreset/reset.css"/> |
1702 | - <link rel="stylesheet" href="../../../lib/yui/3.0.0pr2/build/cssfonts/fonts.css"/> |
1703 | - <link rel="stylesheet" href="../../../lib/yui/3.0.0pr2/build/cssbase/base.css"/> |
1704 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
1705 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
1706 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
1707 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
1708 | + <link rel="stylesheet" href="../../testing/assets/testlogger.css"/> |
1709 | |
1710 | <!-- dependent modules from lazr--> |
1711 | - <script type="text/javascript" src="../../../lib/lazr/build/lazr/lazr.js"></script> |
1712 | - <script type="text/javascript" src="../../../lib/lazr/build/overlay/overlay.js"></script> |
1713 | + <script type="text/javascript" src="../../lazr/lazr.js"></script> |
1714 | + <script type="text/javascript" src="../../overlay/overlay.js"></script> |
1715 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
1716 | |
1717 | <!-- The module under test --> |
1718 | - <script type="text/javascript" src="../../../lib/lazr/build/formoverlay/formoverlay.js"></script> |
1719 | + <script type="text/javascript" src="../../formoverlay/formoverlay.js"></script> |
1720 | |
1721 | <!-- Testing helpers --> |
1722 | - <script type="text/javascript" src="../../../lib/lazr/build/testing/mockio.js"></script> |
1723 | + <script type="text/javascript" src="../../testing/mockio.js"></script> |
1724 | |
1725 | <!-- The test suite --> |
1726 | <script type="text/javascript" src="formoverlay.js"></script> |
1727 | |
1728 | - <style> |
1729 | - /* Taken and customized from testlogger.css */ |
1730 | - #log .yui-console-content { width:44em } |
1731 | - #log .yui-console .yui-console-bd { height:30em } |
1732 | - #log .yui-console .yui-console-controls { display:none; } |
1733 | - #log .yui-console .yui-console-hd { display:none; } |
1734 | - #log .yui-console .yui-console-ft { position:absolute;top:0em; } |
1735 | - |
1736 | - #log .yui-console-entry-src { display:none; } |
1737 | - |
1738 | - #log .yui-console-entry-pass .yui-console-entry-cat { |
1739 | - background-color: green; |
1740 | - font-weight: bold; |
1741 | - color: white; |
1742 | - } |
1743 | - #log .yui-console-entry-fail .yui-console-entry-cat { |
1744 | - background-color: red; |
1745 | - font-weight: bold; |
1746 | - color: white; |
1747 | - } |
1748 | - #log .yui-console-entry-ignore .yui-console-entry-cat { |
1749 | - background-color: #666; |
1750 | - font-weight: bold; |
1751 | - color: white; |
1752 | - } |
1753 | - </style> |
1754 | </head> |
1755 | <body class="yui-skin-sam"> |
1756 | <div id="form_overlay_example"> |
1757 | |
1758 | === modified file 'src-js/lazrjs/formoverlay/tests/formoverlay.js' |
1759 | --- src-js/lazrjs/formoverlay/tests/formoverlay.js 2009-08-13 13:08:36 +0000 |
1760 | +++ src-js/lazrjs/formoverlay/tests/formoverlay.js 2009-10-30 17:01:14 +0000 |
1761 | @@ -1,11 +1,12 @@ |
1762 | /* Copyright (c) 2008, Canonical Ltd. All rights reserved. */ |
1763 | |
1764 | YUI({ |
1765 | - base: '../../../lib/yui/3.0.0pr2/build/', |
1766 | + base: '../../yui/current/build/', |
1767 | filter: 'raw', |
1768 | combine: false |
1769 | - }).use('lazr.formoverlay', 'lazr.testing', 'node', 'event', 'yuitest', |
1770 | - 'dump', 'console', function(Y) { |
1771 | + }).use('lazr.formoverlay', 'lazr.testing.runner', |
1772 | + 'lazr.testing.mockio', 'node', 'event', 'dump', |
1773 | + 'console', function(Y) { |
1774 | |
1775 | var Assert = Y.Assert; // For easy access to isTrue(), etc. |
1776 | |
1777 | @@ -19,6 +20,17 @@ |
1778 | Y.Event.simulate(rawnode, evtype, options); |
1779 | } |
1780 | |
1781 | +/* Helper function to cleanup and destroy a form overlay instance */ |
1782 | +function cleanup_form_overlay(form_overlay) { |
1783 | + if (form_overlay.get('rendered')) { |
1784 | + var bb = form_overlay.get('boundingBox'); |
1785 | + bb.get('parentNode').removeChild(bb); |
1786 | + } |
1787 | + |
1788 | + // Kill the widget itself. |
1789 | + form_overlay.destroy(); |
1790 | +} |
1791 | + |
1792 | /* Helper function that creates a new form overlay instance. */ |
1793 | function make_form_overlay(cfg) { |
1794 | var form_overlay = new Y.lazr.FormOverlay(cfg); |
1795 | @@ -44,21 +56,14 @@ |
1796 | }); |
1797 | |
1798 | // Ensure window size is constant for tests |
1799 | - window.resizeTo(800, 600); |
1800 | + this.width = window.top.outerWidth; |
1801 | + this.height = window.top.outerHeight; |
1802 | + window.top.resizeTo(800, 600); |
1803 | }, |
1804 | |
1805 | tearDown: function() { |
1806 | - this.cleanUp(this.form_overlay); |
1807 | - }, |
1808 | - |
1809 | - cleanUp: function(form_overlay) { |
1810 | - if (form_overlay.get('rendered')) { |
1811 | - var bb = form_overlay.get('boundingBox'); |
1812 | - bb.get('parentNode').removeChild(bb); |
1813 | - } |
1814 | - |
1815 | - // Kill the widget itself. |
1816 | - form_overlay.destroy(); |
1817 | + window.top.resizeTo(this.width, this.height); |
1818 | + cleanup_form_overlay(this.form_overlay); |
1819 | }, |
1820 | |
1821 | test_form_overlay_can_be_instantiated: function() { |
1822 | @@ -67,45 +72,36 @@ |
1823 | Y.lazr.FormOverlay, |
1824 | overlay, |
1825 | "Form overlay could not be instantiated."); |
1826 | - }, |
1827 | - |
1828 | - // This fails because YUI adds an extra div for some reason. |
1829 | - // If and when this is fixed, and this passes, we'll need to |
1830 | - // update test_form_content_in_bodyContent below. |
1831 | - _should: { |
1832 | - fail: {test_bodyContent_is_single_node: true} |
1833 | - }, |
1834 | - |
1835 | - test_bodyContent_is_single_node: function() { |
1836 | + cleanup_form_overlay(overlay); |
1837 | + }, |
1838 | + |
1839 | + test_body_content_is_single_node: function() { |
1840 | Assert.areEqual( |
1841 | 1, |
1842 | - this.form_overlay.get("bodyContent").size(), |
1843 | - "The bodyContent should be a single node, not a node list."); |
1844 | + this.form_overlay.getStdModNode("body").size(), |
1845 | + "The body content should be a single node, not a node list."); |
1846 | }, |
1847 | |
1848 | - test_form_content_in_bodyContent: function() { |
1849 | - // The form_content should be included in the bodyContent of the |
1850 | + test_form_content_in_body_content: function() { |
1851 | + // The form_content should be included in the body of the |
1852 | // overlay during initialization. |
1853 | - var body_content = this.form_overlay.get("bodyContent"); |
1854 | + var body_content = this.form_overlay.getStdModNode("body"); |
1855 | |
1856 | // Ensure the body_content contains our form node. |
1857 | - // Note: see failing test_bodyContent_is_single_node above for why |
1858 | - // an index is used here. |
1859 | Assert.isTrue( |
1860 | - body_content.contains(this.form_overlay.form_node)[1], |
1861 | + body_content.contains(this.form_overlay.form_node), |
1862 | "The form node is part of the body content."); |
1863 | |
1864 | // And then make sure that the user-supplied form_content is |
1865 | // included in the form node: |
1866 | Assert.areNotEqual( |
1867 | - body_content.get("innerHTML")[1].search( |
1868 | + body_content.get("innerHTML").search( |
1869 | this.form_overlay.get("form_content"))); |
1870 | }, |
1871 | |
1872 | test_first_input_has_focus: function() { |
1873 | // The first input element in the form content should have |
1874 | // focus. |
1875 | - |
1876 | var first_input = this.form_overlay.form_node.query('#field1'); |
1877 | |
1878 | // Hide the overlay and ensure that the first input does not |
1879 | @@ -125,26 +121,23 @@ |
1880 | }); |
1881 | }; |
1882 | |
1883 | - Y.on('focus', onFocus, first_input); |
1884 | + first_input.on('focus', onFocus); |
1885 | |
1886 | this.form_overlay.show(); |
1887 | |
1888 | this.wait(5000); |
1889 | }, |
1890 | |
1891 | - test_form_submit_in_bodyContent: function() { |
1892 | - // The bodyContent should include the submit button. |
1893 | - |
1894 | - var body_content = this.form_overlay.get("bodyContent"); |
1895 | - // Note: see failing test_bodyContent_is_single_node above for why |
1896 | - // an index is used here. |
1897 | + test_form_submit_in_body_content: function() { |
1898 | + // The body content should include the submit button. |
1899 | + var body_content = this.form_overlay.getStdModNode("body"); |
1900 | Assert.isTrue( |
1901 | body_content.contains( |
1902 | - this.form_overlay.get("form_submit_button"))[1], |
1903 | - "The bodyContent includes the form_submit_button."); |
1904 | + this.form_overlay.get("form_submit_button")), |
1905 | + "The body content includes the form_submit_button."); |
1906 | }, |
1907 | |
1908 | - test_users_submit_button_in_bodyContent: function() { |
1909 | + test_users_submit_button_in_body_content: function() { |
1910 | // If a user supplies a custom submit button, it should be included |
1911 | // in the form instead of the default one. |
1912 | var submit_button = Y.Node.create( |
1913 | @@ -161,22 +154,19 @@ |
1914 | form_overlay.form_node.contains(submit_button), |
1915 | "The form should include the users submit button."); |
1916 | |
1917 | - this.cleanUp(form_overlay); |
1918 | + cleanup_form_overlay(form_overlay); |
1919 | }, |
1920 | |
1921 | - test_form_cancel_in_bodyContent: function() { |
1922 | - // The bodyContent should include the cancel button. |
1923 | - |
1924 | - var body_content = this.form_overlay.get("bodyContent"); |
1925 | - // Note: see failing test_bodyContent_is_single_node above for why |
1926 | - // an index is used here. |
1927 | + test_form_cancel_in_body_content: function() { |
1928 | + // The body content should include the cancel button. |
1929 | + var body_content = this.form_overlay.getStdModNode("body"); |
1930 | Assert.isTrue( |
1931 | body_content.contains( |
1932 | - this.form_overlay.get("form_cancel_button"))[1], |
1933 | - "The bodyContent includes the form_cancel_button."); |
1934 | + this.form_overlay.get("form_cancel_button")), |
1935 | + "The body content includes the form_cancel_button."); |
1936 | }, |
1937 | |
1938 | - test_users_cancel_button_in_bodyContent: function() { |
1939 | + test_users_cancel_button_in_body_content: function() { |
1940 | // If a user supplies a custom cancel button, it should be included |
1941 | // in the form instead of the default one. |
1942 | var cancel_button = Y.Node.create( |
1943 | @@ -193,7 +183,7 @@ |
1944 | form_overlay.form_node.contains(cancel_button), |
1945 | "The form should include the users cancel button."); |
1946 | |
1947 | - this.cleanUp(form_overlay); |
1948 | + cleanup_form_overlay(form_overlay); |
1949 | }, |
1950 | |
1951 | test_hide_when_cancel_clicked: function() { |
1952 | @@ -219,11 +209,9 @@ |
1953 | |
1954 | this.form_overlay.showError("My special error"); |
1955 | |
1956 | - var body_content = this.form_overlay.get("bodyContent"); |
1957 | - // Note: see failing test_bodyContent_is_single_node above for why |
1958 | - // an index is used here. |
1959 | + var body_content = this.form_overlay.getStdModNode("body"); |
1960 | Assert.areNotEqual( |
1961 | - body_content.get("innerHTML")[1].search("My special error"), |
1962 | + body_content.get("innerHTML").search("My special error"), |
1963 | -1, |
1964 | "The error text was included in the body content."); |
1965 | }, |
1966 | @@ -234,12 +222,10 @@ |
1967 | // chars. Not sure what to do about unicode, for eg. |
1968 | this.form_overlay.showError("<h2>My special error</h2>"); |
1969 | |
1970 | - var body_content = this.form_overlay.get("bodyContent"); |
1971 | - // Note: see failing test_bodyContent_is_single_node above for why |
1972 | - // an index is used here. |
1973 | + var body_content = this.form_overlay.getStdModNode("body"); |
1974 | Assert.areEqual( |
1975 | -1, |
1976 | - body_content.get("innerHTML")[1].search("<h2>"), |
1977 | + body_content.get("innerHTML").search("<h2>"), |
1978 | "The tags were stripped from the error message."); |
1979 | }, |
1980 | |
1981 | @@ -247,9 +233,9 @@ |
1982 | // The error message should be cleared from the body content. |
1983 | this.form_overlay.showError("My special error"); |
1984 | this.form_overlay.clearError(); |
1985 | - var body_content = this.form_overlay.get("bodyContent"); |
1986 | + var body_content = this.form_overlay.getStdModNode("body"); |
1987 | Assert.areEqual( |
1988 | - body_content.get("innerHTML")[1].search("My special error"), |
1989 | + body_content.get("innerHTML").search("My special error"), |
1990 | -1, |
1991 | "The error text is cleared from the body content."); |
1992 | }, |
1993 | @@ -272,7 +258,7 @@ |
1994 | this.form_overlay.hide(); |
1995 | |
1996 | // The position is updated after resizing the window and re-showing: |
1997 | - window.resizeTo(850, 550); |
1998 | + window.top.resizeTo(850, 550); |
1999 | this.form_overlay.show(); |
2000 | Assert.areNotEqual( |
2001 | Y.dump(centered_pos_before_resize), |
2002 | @@ -305,6 +291,7 @@ |
2003 | Assert.isTrue( |
2004 | callback_called, |
2005 | "The form_submit_callback should be called."); |
2006 | + cleanup_form_overlay(form_overlay); |
2007 | }, |
2008 | |
2009 | test_submit_with_callback_prevents_propagation: function() { |
2010 | @@ -334,6 +321,7 @@ |
2011 | Assert.isFalse( |
2012 | event_was_propagated, |
2013 | "The onsubmit event should not be propagated."); |
2014 | + cleanup_form_overlay(form_overlay); |
2015 | }, 3000); |
2016 | }, |
2017 | |
2018 | @@ -352,6 +340,8 @@ |
2019 | Assert.isTrue(event_was_propagated, |
2020 | "The normal form submission event is propagated as " + |
2021 | "normal when no callback is provided."); |
2022 | + cleanup_form_overlay(form_overlay); |
2023 | + |
2024 | }); |
2025 | e.preventDefault(); |
2026 | }; |
2027 | @@ -382,6 +372,7 @@ |
2028 | '{field1 => [val1], field2 => [val2], field3 => [val3]}', |
2029 | Y.dump(form_overlay.getFormData()), |
2030 | "The getFormData method returns simple input data correctly."); |
2031 | + cleanup_form_overlay(form_overlay); |
2032 | }, |
2033 | |
2034 | test_getFormData_returns_inputs_nested_several_levels: function() { |
2035 | @@ -406,6 +397,7 @@ |
2036 | '{field1 => [val1], field2 => [val2], field3 => [val3]}', |
2037 | Y.dump(form_overlay.getFormData()), |
2038 | "The getFormData method returns simple input data correctly."); |
2039 | + cleanup_form_overlay(form_overlay); |
2040 | |
2041 | }, |
2042 | |
2043 | @@ -425,6 +417,7 @@ |
2044 | Assert.isTrue( |
2045 | form_overlay.form_node.contains(input_node), |
2046 | "Failed to pass the form content as a Y.Node instance."); |
2047 | + cleanup_form_overlay(form_overlay); |
2048 | }, |
2049 | |
2050 | test_form_content_loaded_from_url_success: function() { |
2051 | @@ -455,6 +448,7 @@ |
2052 | Assert.areEqual( |
2053 | external_form_content, form_node_text.match(external_form_content), |
2054 | "Failed to render the form."); |
2055 | + cleanup_form_overlay(form_overlay); |
2056 | }, |
2057 | |
2058 | test_form_content_loaded_from_url_failure: function() { |
2059 | @@ -482,6 +476,7 @@ |
2060 | Assert.areEqual( |
2061 | error_message, form_node_text.match(error_message), |
2062 | "Failed to render the error message."); |
2063 | + cleanup_form_overlay(form_overlay); |
2064 | }, |
2065 | |
2066 | test_form_content_loaded_from_url_bind_submit: function() { |
2067 | @@ -511,18 +506,11 @@ |
2068 | "input[type=submit]", |
2069 | 'click'); |
2070 | Assert.isTrue(callback_called, "Submit button didn't get hooked up."); |
2071 | + cleanup_form_overlay(form_overlay); |
2072 | } |
2073 | })); |
2074 | |
2075 | -Y.Test.Runner.add(suite); |
2076 | - |
2077 | -var yconsole = new Y.Console({ |
2078 | - newestOnTop: false |
2079 | -}); |
2080 | -yconsole.render('#log'); |
2081 | - |
2082 | -Y.on('domready', function() { |
2083 | - Y.Test.Runner.run(); |
2084 | -}); |
2085 | +Y.lazr.testing.Runner.add(suite); |
2086 | +Y.lazr.testing.Runner.run(); |
2087 | |
2088 | }); |
2089 | |
2090 | === modified file 'src-js/lazrjs/inlineedit/editor.js' |
2091 | --- src-js/lazrjs/inlineedit/editor.js 2009-10-28 19:04:25 +0000 |
2092 | +++ src-js/lazrjs/inlineedit/editor.js 2009-10-30 17:01:14 +0000 |
2093 | @@ -158,7 +158,7 @@ |
2094 | */ |
2095 | submit_button: { |
2096 | value: null, |
2097 | - set: function(v) { return this._setNode(v); } |
2098 | + setter: function(v) { return this._setNode(v); } |
2099 | }, |
2100 | |
2101 | /** |
2102 | @@ -170,7 +170,7 @@ |
2103 | */ |
2104 | cancel_button: { |
2105 | value: null, |
2106 | - set: function(v) { return this._setNode(v); } |
2107 | + setter: function(v) { return this._setNode(v); } |
2108 | }, |
2109 | |
2110 | /** |
2111 | @@ -182,7 +182,7 @@ |
2112 | */ |
2113 | top_buttons: { |
2114 | value: null, |
2115 | - set: function(v) { return this._setNode(v); } |
2116 | + setter: function(v) { return this._setNode(v); } |
2117 | }, |
2118 | |
2119 | /** |
2120 | @@ -194,7 +194,7 @@ |
2121 | */ |
2122 | bottom_buttons: { |
2123 | value: null, |
2124 | - set: function(v) { return this._setNode(v); } |
2125 | + setter: function(v) { return this._setNode(v); } |
2126 | }, |
2127 | |
2128 | /** |
2129 | @@ -205,7 +205,7 @@ |
2130 | */ |
2131 | error_message: { |
2132 | value: null, |
2133 | - set: function(v) { return this._setNode(v); } |
2134 | + setter: function(v) { return this._setNode(v); } |
2135 | }, |
2136 | |
2137 | /** |
2138 | @@ -283,23 +283,6 @@ |
2139 | Y.extend(InlineEditor, Y.Widget, { |
2140 | |
2141 | /** |
2142 | - * An extra button box at the top, shown only in multi-line mode. |
2143 | - * |
2144 | - * @property top_buttons |
2145 | - * @type Node |
2146 | - */ |
2147 | - top_buttons: null, |
2148 | - |
2149 | - /** |
2150 | - * A reference to the button-box html element in single-line mode, and |
2151 | - * the bottom button box in multi-line mode. |
2152 | - * |
2153 | - * @property buttons |
2154 | - * @type Node |
2155 | - */ |
2156 | - buttons: null, |
2157 | - |
2158 | - /** |
2159 | * A convenience method for retrieving a Node value from a Node |
2160 | * instance, an HTMLElement, or a CSS string selector. |
2161 | * |
2162 | @@ -337,7 +320,6 @@ |
2163 | * @method save |
2164 | */ |
2165 | save: function() { |
2166 | - |
2167 | // We don't want to save any whitespace characters. |
2168 | var input = Y.Lang.trim(this.getInput()); |
2169 | |
2170 | @@ -1045,7 +1027,7 @@ |
2171 | * @type Node |
2172 | */ |
2173 | trigger: { |
2174 | - set: function(node) { |
2175 | + setter: function(node) { |
2176 | if (this.get(RENDERED)) { |
2177 | this._bindTrigger(node); |
2178 | } |
2179 | @@ -1061,7 +1043,7 @@ |
2180 | * @type Node |
2181 | */ |
2182 | text: { |
2183 | - set: function(v) { |
2184 | + setter: function(v) { |
2185 | return Y.Node.get(v); |
2186 | }, |
2187 | validator: function(v) { |
2188 | @@ -1081,10 +1063,10 @@ |
2189 | * @readOnly |
2190 | */ |
2191 | value: { |
2192 | - get: function() { |
2193 | + getter: function() { |
2194 | var text_node = this.get(TEXT); |
2195 | var ptags = text_node.queryAll('p'); |
2196 | - if (Y.Lang.isValue(ptags)) { |
2197 | + if (Y.Lang.isValue(ptags) && ptags.size()) { |
2198 | var lines = []; |
2199 | ptags.each(function(ptag) { |
2200 | lines = lines.concat([ptag.get('text'), '\n\n']); |
2201 | @@ -1106,7 +1088,7 @@ |
2202 | */ |
2203 | accept_empty: { |
2204 | value: false, |
2205 | - get: function() { |
2206 | + getter: function() { |
2207 | if (this.editor) { |
2208 | return this.editor.get(ACCEPT_EMPTY); |
2209 | } |
2210 | @@ -1431,7 +1413,7 @@ |
2211 | if (this._click_handler) { |
2212 | this._click_handler.detach(); |
2213 | } |
2214 | - this._click_handler = Y.on('click', this._triggerEdit, node, this); |
2215 | + this._click_handler = node.on('click', this._triggerEdit, this); |
2216 | }, |
2217 | |
2218 | |
2219 | @@ -1496,5 +1478,5 @@ |
2220 | |
2221 | //~ Y.log("Module loaded", 'info', 'lazr.editor'); |
2222 | |
2223 | -}, '0.2', {requires: |
2224 | - ['oop', 'event', 'node', 'widget', 'lazr.anim', 'lazr.base']}); |
2225 | +}, '0.2', {requires: ['oop', 'anim', 'event', 'node', 'widget', |
2226 | + 'lazr.anim', 'lazr.base']}); |
2227 | |
2228 | === modified file 'src-js/lazrjs/inlineedit/tests/index.html' |
2229 | --- src-js/lazrjs/inlineedit/tests/index.html 2009-05-14 18:21:37 +0000 |
2230 | +++ src-js/lazrjs/inlineedit/tests/index.html 2009-10-30 17:01:14 +0000 |
2231 | @@ -5,33 +5,23 @@ |
2232 | <title>Inline Edit</title> |
2233 | |
2234 | <!-- YUI 3.0 Setup --> |
2235 | - <script type="text/javascript" src="../../../lib/yui/current/build/yui/yui.js"></script> |
2236 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssreset/reset.css"/> |
2237 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssfonts/fonts.css"/> |
2238 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssbase/base.css"/> |
2239 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
2240 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
2241 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
2242 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
2243 | + <link rel="stylesheet" href="../../testing/assets/testlogger.css"/> |
2244 | |
2245 | <!-- The module under test --> |
2246 | - <script type="text/javascript" src="../../../build/inlineedit/editor.js"></script> |
2247 | - <script type="text/javascript" src="../../../build/anim/anim.js"></script> |
2248 | - <script type="text/javascript" src="../../../build/lazr/lazr.js"></script> |
2249 | + <script type="text/javascript" src="../../inlineedit/editor.js"></script> |
2250 | + <script type="text/javascript" src="../../anim/anim.js"></script> |
2251 | + <script type="text/javascript" src="../../lazr/lazr.js"></script> |
2252 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
2253 | |
2254 | <!-- The test suite --> |
2255 | <script type="text/javascript" src="inline_edit.js"></script> |
2256 | |
2257 | - <link rel="stylesheet" href="../../../src/testing/assets/testlogger.css"/> |
2258 | </head> |
2259 | <body class="yui-skin-sam"> |
2260 | - <h1>Single-line editing</h1> |
2261 | - <div id="editable_single_text"> |
2262 | - <span id="single_text" class="yui-editable_text-text">Some editable inline text.</span> |
2263 | - <button id="single_edit" class="yui-editable_text-trigger">Edit this</button> |
2264 | - </div> |
2265 | - <hr /> |
2266 | - <h1>Multi-line editing</h1> |
2267 | - <div id="editable_multi_text"> |
2268 | - <button id="multi_edit" class="yui-editable_text-trigger">Edit this</button> |
2269 | - <span id="multi_text" class="yui-editable_text-text">Some editable multi-line text.</span> |
2270 | - </div> |
2271 | <div id="log"></div> |
2272 | </body> |
2273 | </html> |
2274 | |
2275 | === modified file 'src-js/lazrjs/inlineedit/tests/inline_edit.js' |
2276 | --- src-js/lazrjs/inlineedit/tests/inline_edit.js 2009-08-13 08:54:56 +0000 |
2277 | +++ src-js/lazrjs/inlineedit/tests/inline_edit.js 2009-10-30 17:01:14 +0000 |
2278 | @@ -1,10 +1,24 @@ |
2279 | /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
2280 | |
2281 | YUI({ |
2282 | - base: '../../../lib/yui/current/build/', |
2283 | + base: '../../yui/current/build/', |
2284 | filter: 'raw', |
2285 | combine: false |
2286 | - }).use('lazr.editor', 'node', 'event', 'yuitest', 'console', function(Y) { |
2287 | + }).use('lazr.editor', 'lazr.testing.runner', 'node', 'event', 'console', function(Y) { |
2288 | + |
2289 | +var SAMPLE_HTML = " \ |
2290 | + <h1>Single-line editing</h1> \ |
2291 | + <div id='editable_single_text'> \ |
2292 | + <span id='single_text' class='yui-editable_text-text'>Some editable inline text.</span> \ |
2293 | + <button id='single_edit' class='yui-editable_text-trigger'>Edit this</button> \ |
2294 | + </div> \ |
2295 | + <hr /> \ |
2296 | + <h1>Multi-line editing</h1> \ |
2297 | + <div id='editable_multi_text'> \ |
2298 | + <button id='multi_edit' class='yui-editable_text-trigger'>Edit this</button> \ |
2299 | + <span id='multi_text' class='yui-editable_text-text'>Some editable multi-line text.</span> \ |
2300 | + </div> \ |
2301 | +"; |
2302 | |
2303 | var Assert = Y.Assert; // For easy access to isTrue(), etc. |
2304 | |
2305 | @@ -46,6 +60,15 @@ |
2306 | widget.destroy(); |
2307 | } |
2308 | |
2309 | +function setup_sample_html() { |
2310 | + if (! Y.get("#scaffolding")) { |
2311 | + Y.get(document.body).appendChild( |
2312 | + Y.Node.create("<div id='scaffolding'></div>")); |
2313 | + } |
2314 | + |
2315 | + Y.get("#scaffolding").set("innerHTML", SAMPLE_HTML); |
2316 | +} |
2317 | + |
2318 | function make_editable_text(cfg) { |
2319 | // For the editor |
2320 | // TODO: fix this ugly hack |
2321 | @@ -396,6 +419,7 @@ |
2322 | name: 'Editable text initial values', |
2323 | |
2324 | setUp: function() { |
2325 | + setup_sample_html(); |
2326 | this.etext = make_editable_text( |
2327 | {initial_value_override: 'Initial value'}); |
2328 | }, |
2329 | @@ -621,6 +645,7 @@ |
2330 | name: 'editable_text', |
2331 | |
2332 | setUp: function() { |
2333 | + setup_sample_html(); |
2334 | this.etext = make_editable_text(); |
2335 | }, |
2336 | |
2337 | @@ -704,6 +729,7 @@ |
2338 | this.etext.editor |
2339 | .get('input_field') |
2340 | .set('value', expected_value); |
2341 | + |
2342 | this.etext.editor.save(); |
2343 | |
2344 | Assert.areEqual( |
2345 | @@ -801,6 +827,7 @@ |
2346 | name: "EditableText single-line/multi-line modes", |
2347 | |
2348 | setUp: function() { |
2349 | + setup_sample_html(); |
2350 | this.single = make_editable_text({ |
2351 | contentBox: '#editable_single_text', |
2352 | multiline: false |
2353 | @@ -843,7 +870,7 @@ |
2354 | }, |
2355 | |
2356 | test_single_line_top_button_box: function() { |
2357 | - var box = this.single.editor.top_buttons; |
2358 | + var box = this.single.editor.get("top_buttons"); |
2359 | Assert.areEqual( |
2360 | null, |
2361 | box, |
2362 | @@ -851,12 +878,12 @@ |
2363 | }, |
2364 | |
2365 | test_multi_line_top_button_box: function() { |
2366 | - var box = this.multi.editor.top_buttons; |
2367 | + var box = this.multi.editor.get("top_buttons"); |
2368 | Assert.areNotEqual( |
2369 | null, |
2370 | box, |
2371 | "Multi-line editor should have a top button box."); |
2372 | - } |
2373 | + }, |
2374 | |
2375 | })); |
2376 | |
2377 | @@ -1116,15 +1143,7 @@ |
2378 | } |
2379 | })); |
2380 | |
2381 | -Y.Test.Runner.add(suite); |
2382 | - |
2383 | -var yconsole = new Y.Console({ |
2384 | - newestOnTop: false |
2385 | -}); |
2386 | -yconsole.render('#log'); |
2387 | - |
2388 | -Y.on('domready', function() { |
2389 | - Y.Test.Runner.run(); |
2390 | -}); |
2391 | +Y.lazr.testing.Runner.add(suite); |
2392 | +Y.lazr.testing.Runner.run(); |
2393 | |
2394 | }); |
2395 | |
2396 | === modified file 'src-js/lazrjs/overlay/overlay.js' |
2397 | --- src-js/lazrjs/overlay/overlay.js 2009-04-19 22:48:09 +0000 |
2398 | +++ src-js/lazrjs/overlay/overlay.js 2009-10-30 17:01:14 +0000 |
2399 | @@ -11,7 +11,9 @@ |
2400 | var ESCAPE = 27, |
2401 | CANCEL = 'cancel', |
2402 | BOUNDING_BOX = 'boundingBox', |
2403 | - CONTENT_BOX = 'contentBox'; |
2404 | + CONTENT_BOX = 'contentBox', |
2405 | + BINDUI = "bindUI"; |
2406 | + |
2407 | |
2408 | /** |
2409 | * An Overlay subclass which draws a rounded-corner, drop-shadow |
2410 | @@ -36,6 +38,8 @@ |
2411 | arguments[0].zIndex = 1000; |
2412 | } |
2413 | PrettyOverlay.superclass.constructor.apply(this, arguments); |
2414 | + Y.after(this._bindUIPrettyOverlay, this, BINDUI); |
2415 | + |
2416 | }; |
2417 | |
2418 | PrettyOverlay.NAME = 'pretty-overlay'; |
2419 | @@ -221,8 +225,14 @@ |
2420 | * @method _removeBlockingDiv |
2421 | */ |
2422 | _removeBlockingDiv: function() { |
2423 | - if (Y.get('.blocking-div')) { |
2424 | - Y.get('body').removeChild(this._blocking_div); |
2425 | + if (this._blocking_div) { |
2426 | + var blocking_div = Y.get(this._blocking_div); |
2427 | + if (blocking_div) { |
2428 | + var parent = blocking_div.get('parentNode'); |
2429 | + if (parent) { |
2430 | + parent.removeChild(this._blocking_div); |
2431 | + } |
2432 | + } |
2433 | } |
2434 | }, |
2435 | |
2436 | @@ -236,13 +246,16 @@ |
2437 | }, |
2438 | |
2439 | /** |
2440 | - * Bind UI events. Subclasses must call this function using |
2441 | - * <code>this.constructor.superclass.bindUI.call(this)</code>. |
2442 | + * Bind UI events. |
2443 | + * <p> |
2444 | + * This method is invoked after bindUI is invoked for the Widget class |
2445 | + * using YUI's aop infrastructure. |
2446 | + * </p> |
2447 | * |
2448 | + * @method _bindUIPrettyOverlay |
2449 | * @protected |
2450 | - * @method bindUI |
2451 | */ |
2452 | - bindUI: function() { |
2453 | + _bindUIPrettyOverlay: function() { |
2454 | var self = this; |
2455 | var close_button = this.get(BOUNDING_BOX).query('.close a'); |
2456 | close_button.on('click', function(e) { |
2457 | @@ -352,4 +365,4 @@ |
2458 | |
2459 | Y.lazr.PrettyOverlay = PrettyOverlay; |
2460 | |
2461 | -}, '0.1', {requires: ['oop', 'overlay', 'event']}); |
2462 | +}, '0.1', {requires: ['oop', 'overlay', 'event', 'widget-position']}); |
2463 | |
2464 | === modified file 'src-js/lazrjs/overlay/tests/overlay.html' |
2465 | --- src-js/lazrjs/overlay/tests/overlay.html 2009-02-20 17:41:32 +0000 |
2466 | +++ src-js/lazrjs/overlay/tests/overlay.html 2009-10-30 17:01:14 +0000 |
2467 | @@ -5,14 +5,15 @@ |
2468 | <title>Pretty Overlay</title> |
2469 | |
2470 | <!-- YUI 3.0 Setup --> |
2471 | - <script type="text/javascript" src="../../../lib/yui/current/build/yui/yui.js"></script> |
2472 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssreset/reset.css"/> |
2473 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssfonts/fonts.css"/> |
2474 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssbase/base.css"/> |
2475 | - <link rel="stylesheet" href="../../../src/testing/assets/testlogger.css"/> |
2476 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
2477 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
2478 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
2479 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
2480 | + <link rel="stylesheet" href="../../testing/assets/testlogger.css"/> |
2481 | |
2482 | <!-- The module under test --> |
2483 | - <script type="text/javascript" src="../../../build/overlay/overlay.js"></script> |
2484 | + <script type="text/javascript" src="../../overlay/overlay.js"></script> |
2485 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
2486 | |
2487 | <!-- The test suite --> |
2488 | <script type="text/javascript" src="overlay.js"></script> |
2489 | |
2490 | === modified file 'src-js/lazrjs/overlay/tests/overlay.js' |
2491 | --- src-js/lazrjs/overlay/tests/overlay.js 2009-02-20 18:05:48 +0000 |
2492 | +++ src-js/lazrjs/overlay/tests/overlay.js 2009-10-30 17:01:14 +0000 |
2493 | @@ -1,10 +1,11 @@ |
2494 | /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
2495 | |
2496 | YUI({ |
2497 | - base: '../../../lib/yui/current/build/', |
2498 | + base: '../../yui/current/build/', |
2499 | filter: 'raw', |
2500 | combine: false |
2501 | - }).use('lazr.overlay', 'node', 'event', 'yuitest', 'widget-stack', 'console', function(Y) { |
2502 | + }).use('lazr.overlay', 'lazr.testing.runner', 'node', |
2503 | + 'event', 'widget-stack', 'console', function(Y) { |
2504 | |
2505 | // KeyCode for escape |
2506 | var ESCAPE = 27; |
2507 | @@ -85,8 +86,8 @@ |
2508 | }, |
2509 | |
2510 | test_overlay_can_hide_progressbar: function() { |
2511 | - this.overlay = new Y.lazr.PrettyOverlay(); |
2512 | - this.overlay.render({progressbar: false}); |
2513 | + this.overlay = new Y.lazr.PrettyOverlay({progressbar: false}); |
2514 | + this.overlay.render(); |
2515 | var bb = this.overlay.get('boundingBox'); |
2516 | bb.set('headerContent', 'ALL HAIL DISCORDIA!'); |
2517 | Assert.isNull( |
2518 | @@ -106,8 +107,8 @@ |
2519 | }, |
2520 | |
2521 | test_overlay_can_hide_steptitle: function() { |
2522 | - this.overlay = new Y.lazr.PrettyOverlay(); |
2523 | - this.overlay.render({progressbar: false}); |
2524 | + this.overlay = new Y.lazr.PrettyOverlay({progressbar: false}); |
2525 | + this.overlay.render(); |
2526 | var bb = this.overlay.get('boundingBox'); |
2527 | bb.set('headerContent', 'ALL HAIL DISCORDIA!'); |
2528 | Assert.isNull( |
2529 | @@ -230,15 +231,7 @@ |
2530 | |
2531 | })); |
2532 | |
2533 | -Y.Test.Runner.add(suite); |
2534 | - |
2535 | -var yconsole = new Y.Console({ |
2536 | - newestOnTop: false |
2537 | -}); |
2538 | -yconsole.render('#log'); |
2539 | - |
2540 | -Y.on('domready', function() { |
2541 | - Y.Test.Runner.run(); |
2542 | -}); |
2543 | +Y.lazr.testing.Runner.add(suite); |
2544 | +Y.lazr.testing.Runner.run(); |
2545 | |
2546 | }); |
2547 | |
2548 | === modified file 'src-js/lazrjs/picker/picker.js' |
2549 | --- src-js/lazrjs/picker/picker.js 2009-07-06 16:18:36 +0000 |
2550 | +++ src-js/lazrjs/picker/picker.js 2009-10-30 17:01:14 +0000 |
2551 | @@ -54,10 +54,18 @@ |
2552 | FOOTER_SLOT = 'footer_slot', |
2553 | SELECTED_BATCH = 'selected_batch', |
2554 | SEARCH_MODE = 'search_mode', |
2555 | - NO_RESULTS_SEARCH_MESSAGE = 'no_results_search_message'; |
2556 | + NO_RESULTS_SEARCH_MESSAGE = 'no_results_search_message', |
2557 | + RENDERUI = "renderUI", |
2558 | + BINDUI = "bindUI", |
2559 | + SYNCUI = "syncUI"; |
2560 | + |
2561 | |
2562 | var Picker = function () { |
2563 | Picker.superclass.constructor.apply(this, arguments); |
2564 | + |
2565 | + Y.after(this._renderUIPicker, this, RENDERUI); |
2566 | + Y.after(this._bindUIPicker, this, BINDUI); |
2567 | + Y.after(this._syncUIPicker, this, BINDUI); |
2568 | }; |
2569 | |
2570 | Y.extend(Picker, Y.lazr.PrettyOverlay, { |
2571 | @@ -204,7 +212,7 @@ |
2572 | var options = this.get(BATCHES); |
2573 | |
2574 | // Clear previous batches. |
2575 | - Y.Event.purgeElement(this.batches_box, true); |
2576 | + Y.Event.purgeElement(this._batches_box, true); |
2577 | this._batches_box.set('innerHTML', ''); |
2578 | |
2579 | if (options.length === 0) { |
2580 | @@ -232,7 +240,7 @@ |
2581 | this._batches_box.appendChild(batch_item); |
2582 | |
2583 | batch_item.on('click', function (e) { |
2584 | - this.set('selected_batch', i); |
2585 | + this.set(SELECTED_BATCH, i); |
2586 | this.fire( |
2587 | SEARCH, this.get(CURRENT_SEARCH_STRING), data.value); |
2588 | }, this); |
2589 | @@ -259,7 +267,7 @@ |
2590 | var idx = this.get(SELECTED_BATCH); |
2591 | |
2592 | var items = this._batches_box.queryAll('span'); |
2593 | - if (items) { |
2594 | + if (items.size()) { |
2595 | this._prev_button.set('disabled', idx === 0); |
2596 | items.removeClass(C_SELECTED_BATCH); |
2597 | items.item(idx).addClass(C_SELECTED_BATCH); |
2598 | @@ -377,12 +385,15 @@ |
2599 | |
2600 | /** |
2601 | * Create the widget's HTML components. |
2602 | + * <p> |
2603 | + * This method is invoked after renderUI is invoked for the Widget class |
2604 | + * using YUI's aop infrastructure. |
2605 | + * </p> |
2606 | * |
2607 | - * @method renderUI |
2608 | + * @method _renderUIPicker |
2609 | * @protected |
2610 | */ |
2611 | - renderUI: function() { |
2612 | - Picker.superclass.renderUI.apply(this, arguments); |
2613 | + _renderUIPicker: function() { |
2614 | this._search_button = Y.Node.create(Y.lazr.ui.SEARCH_BUTTON); |
2615 | |
2616 | var search_box = Y.Node.create([ |
2617 | @@ -415,26 +426,27 @@ |
2618 | this._footer_slot_box = Y.Node.create('<div></div'); |
2619 | this._footer_slot_box.addClass(C_FOOTER_SLOT); |
2620 | |
2621 | - //We cannot set the bodyContent element here, because |
2622 | - //YUI screwed it up. So fake it. |
2623 | var body = Y.Node.create('<div></div>'); |
2624 | body.appendChild(search_box); |
2625 | body.appendChild(this._batches_box); |
2626 | body.appendChild(this._results_box); |
2627 | body.appendChild(this._footer_slot_box); |
2628 | body.addClass('yui-widget-bd'); |
2629 | - this.get(CONTENT_BOX).appendChild(body); |
2630 | + |
2631 | + this.setStdModContent(Y.WidgetStdMod.BODY, body, Y.WidgetStdMod.APPEND); |
2632 | }, |
2633 | |
2634 | /** |
2635 | * Bind the widget's DOM elements to their event handlers. |
2636 | + * <p> |
2637 | + * This method is invoked after bindUI is invoked for the Widget class |
2638 | + * using YUI's aop infrastructure. |
2639 | + * </p> |
2640 | * |
2641 | - * @method bindUI |
2642 | + * @method _bindUIPicker |
2643 | * @protected |
2644 | */ |
2645 | - bindUI: function() { |
2646 | - Picker.superclass.bindUI.apply(this, arguments); |
2647 | - |
2648 | + _bindUIPicker: function() { |
2649 | Y.on('click', this._defaultSearchUserAction, this._search_button, |
2650 | this); |
2651 | |
2652 | @@ -445,8 +457,10 @@ |
2653 | |
2654 | // Give the focus to the search input. |
2655 | Y.on('focus', function (e) { |
2656 | - e.halt(); |
2657 | - this._search_input.focus(); |
2658 | + if (e.target !== this._search_input){ |
2659 | + e.halt(); |
2660 | + this._search_input.focus(); |
2661 | + } |
2662 | }, this.get(BOUNDING_BOX), this); |
2663 | |
2664 | // Focus search box when the widget is first displayed. |
2665 | @@ -485,7 +499,14 @@ |
2666 | // is changed, and reset the selected one to the first one. |
2667 | this.after('batchesChange', function (e) { |
2668 | this._syncBatchesUI(); |
2669 | - this.set(SELECTED_BATCH, 0); |
2670 | + if (this.get(SELECTED_BATCH) == 0){ |
2671 | + // If the attribute is already set to the same value, |
2672 | + // the 'after' events won't be triggered, so we have |
2673 | + // to trigger it manually. |
2674 | + this._syncSelectedBatchUI(); |
2675 | + } else { |
2676 | + this.set(SELECTED_BATCH, 0); |
2677 | + } |
2678 | }, this); |
2679 | |
2680 | // Keep the UI in sync with the currently selected batch. |
2681 | @@ -512,12 +533,15 @@ |
2682 | |
2683 | /** |
2684 | * Synchronize the search box, error message and results with the UI. |
2685 | + * <p> |
2686 | + * This method is invoked after syncUI is invoked for the Widget class |
2687 | + * using YUI's aop infrastructure. |
2688 | + * </p> |
2689 | * |
2690 | - * @method syncUI |
2691 | + * @method _syncUIPicker |
2692 | * @protected |
2693 | */ |
2694 | - syncUI: function() { |
2695 | - Picker.superclass.syncUI.apply(this, arguments); |
2696 | + _syncUIPicker: function() { |
2697 | this._syncResultsUI(); |
2698 | this._syncSearchModeUI(); |
2699 | this._syncBatchesUI(); |
2700 | @@ -686,7 +710,7 @@ |
2701 | */ |
2702 | selected_batch: { |
2703 | value: 0, |
2704 | - get: function (value) { |
2705 | + getter: function (value) { |
2706 | return value || 0; |
2707 | }, |
2708 | validator: function (value) { |
2709 | @@ -728,8 +752,7 @@ |
2710 | |
2711 | Y.Picker = Picker; |
2712 | |
2713 | -}, '0.1', { |
2714 | - requires: [ |
2715 | - 'oop', 'event', 'node', 'substitute', 'lazr.overlay', 'lazr.anim', |
2716 | - 'lazr.base'] |
2717 | +}, '0.1', {requires: ['oop', 'event', 'event-focus', 'node', |
2718 | + 'substitute', 'widget', 'widget-stdmod', |
2719 | + 'lazr.overlay', 'lazr.anim', 'lazr.base'] |
2720 | }); |
2721 | |
2722 | === modified file 'src-js/lazrjs/picker/tests/picker.html' |
2723 | --- src-js/lazrjs/picker/tests/picker.html 2009-02-20 17:19:40 +0000 |
2724 | +++ src-js/lazrjs/picker/tests/picker.html 2009-10-30 17:01:14 +0000 |
2725 | @@ -1,50 +1,25 @@ |
2726 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
2727 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
2728 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
2729 | <html> |
2730 | <head> |
2731 | <title>Picker</title> |
2732 | |
2733 | <!-- YUI 3.0 Setup --> |
2734 | - <script type="text/javascript" src="../../../lib/yui/current/build/yui/yui.js"></script> |
2735 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssreset/reset.css"/> |
2736 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssfonts/fonts.css"/> |
2737 | - <link rel="stylesheet" href="../../../lib/yui/current/build/cssbase/base.css"/> |
2738 | + <script type="text/javascript" src="../../yui/current/build/yui/yui.js"></script> |
2739 | + <link rel="stylesheet" href="../../yui/current/build/cssreset/reset.css"/> |
2740 | + <link rel="stylesheet" href="../../yui/current/build/cssfonts/fonts.css"/> |
2741 | + <link rel="stylesheet" href="../../yui/current/build/cssbase/base.css"/> |
2742 | + <link rel="stylesheet" href="../../testing/assets/testlogger.css"/> |
2743 | |
2744 | <!-- The module under test --> |
2745 | - <script type="text/javascript" src="../../../build/overlay/overlay.js"></script> |
2746 | - <script type="text/javascript" src="../../../build/picker/picker.js"></script> |
2747 | - <script type="text/javascript" src="../../../build/anim/anim.js"></script> |
2748 | - <script type="text/javascript" src="../../../build/lazr/lazr.js"></script> |
2749 | + <script type="text/javascript" src="../../overlay/overlay.js"></script> |
2750 | + <script type="text/javascript" src="../../picker/picker.js"></script> |
2751 | + <script type="text/javascript" src="../../anim/anim.js"></script> |
2752 | + <script type="text/javascript" src="../../lazr/lazr.js"></script> |
2753 | + <script type="text/javascript" src="../../testing/testing.js"></script> |
2754 | |
2755 | <!-- The test suite --> |
2756 | <script type="text/javascript" src="picker.js"></script> |
2757 | - |
2758 | - <style> |
2759 | - /* Taken and customized from testlogger.css */ |
2760 | - #log .yui-console-content { width:44em } |
2761 | - #log .yui-console .yui-console-bd { height:30em } |
2762 | - #log .yui-console .yui-console-controls { display:none; } |
2763 | - #log .yui-console .yui-console-hd { display:none; } |
2764 | - #log .yui-console .yui-console-ft { position:absolute;top:0em; } |
2765 | - |
2766 | - #log .yui-console-entry-src { display:none; } |
2767 | - |
2768 | - #log .yui-console-entry-pass .yui-console-entry-cat { |
2769 | - background-color: green; |
2770 | - font-weight: bold; |
2771 | - color: white; |
2772 | - } |
2773 | - #log .yui-console-entry-fail .yui-console-entry-cat { |
2774 | - background-color: red; |
2775 | - font-weight: bold; |
2776 | - color: white; |
2777 | - } |
2778 | - #log .yui-console-entry-ignore .yui-console-entry-cat { |
2779 | - background-color: #666; |
2780 | - font-weight: bold; |
2781 | - color: white; |
2782 | - } |
2783 | - </style> |
2784 | </head> |
2785 | <body class="yui-skin-sam"> |
2786 | <div id="log"></div> |
2787 | |
2788 | === modified file 'src-js/lazrjs/picker/tests/picker.js' |
2789 | --- src-js/lazrjs/picker/tests/picker.js 2009-07-07 09:38:20 +0000 |
2790 | +++ src-js/lazrjs/picker/tests/picker.js 2009-10-30 17:01:14 +0000 |
2791 | @@ -1,10 +1,11 @@ |
2792 | /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
2793 | |
2794 | YUI({ |
2795 | - base: '../../../lib/yui/current/build/', |
2796 | + base: '../../yui/current/build/', |
2797 | filter: 'raw', |
2798 | combine: false |
2799 | - }).use('lazr.picker', 'node', 'event', 'yuitest', 'console', 'dump', |
2800 | + }).use('lazr.picker', 'lazr.testing.runner', 'node', |
2801 | + 'event', 'event-focus', 'console', 'dump', |
2802 | function(Y) { |
2803 | |
2804 | // Local aliases |
2805 | @@ -487,7 +488,7 @@ |
2806 | bb.query('.yui-picker-batches span'), |
2807 | "Container for batches not found."); |
2808 | var batches = bb.queryAll('.yui-picker-batches span'); |
2809 | - Assert.isNotNull(batches, "Batches not found"); |
2810 | + Assert.isNotNull(batches, "Batches not found"); |
2811 | Assert.areEqual(2, batches.size()); |
2812 | ArrayAssert.itemsAreEqual( |
2813 | ['New', 'Assigned'], |
2814 | @@ -782,15 +783,7 @@ |
2815 | |
2816 | })); |
2817 | |
2818 | -Y.Test.Runner.add(suite); |
2819 | - |
2820 | -var yconsole = new Y.Console({ |
2821 | - newestOnTop: false |
2822 | -}); |
2823 | -yconsole.render('#log'); |
2824 | - |
2825 | -Y.on('domready', function() { |
2826 | - Y.Test.Runner.run(); |
2827 | -}); |
2828 | +Y.lazr.testing.Runner.add(suite); |
2829 | +Y.lazr.testing.Runner.run(); |
2830 | |
2831 | }); |
2832 | |
2833 | === modified file 'src-js/lazrjs/testing/assets/testlogger.css' |
2834 | --- src-js/lazrjs/testing/assets/testlogger.css 2009-02-20 17:41:32 +0000 |
2835 | +++ src-js/lazrjs/testing/assets/testlogger.css 2009-10-30 17:01:14 +0000 |
2836 | @@ -1,6 +1,6 @@ |
2837 | /* Taken and customized from testlogger.css */ |
2838 | -#log .yui-console-content { width: 44em } |
2839 | -#log .yui-console .yui-console-bd { height: 30em } |
2840 | +/*#log .yui-console-content { width: 44em }*/ |
2841 | +/*#log .yui-console .yui-console-bd { height: 30em }*/ |
2842 | #log .yui-console .yui-console-controls { display: none; } |
2843 | #log .yui-console .yui-console-hd { display: none; } |
2844 | #log .yui-console .yui-console-ft { position: absolute; top: 0; } |
2845 | |
2846 | === added file 'src-js/lazrjs/testing/jsUnitMockTimeout.js' |
2847 | --- src-js/lazrjs/testing/jsUnitMockTimeout.js 1970-01-01 00:00:00 +0000 |
2848 | +++ src-js/lazrjs/testing/jsUnitMockTimeout.js 2009-10-30 17:01:14 +0000 |
2849 | @@ -0,0 +1,120 @@ |
2850 | +/* |
2851 | + Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
2852 | + |
2853 | + The contents of this file are subject to the Mozilla Public License Version |
2854 | + 1.1 (the "License"); you may not use this file except in compliance with |
2855 | + the License. You may obtain a copy of the License at |
2856 | + http://www.mozilla.org/MPL/ |
2857 | + |
2858 | + Software distributed under the License is distributed on an "AS IS" basis, |
2859 | + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
2860 | + for the specific language governing rights and limitations under the |
2861 | + License. |
2862 | + |
2863 | + The Original Code is Edward Hieatt code. |
2864 | + |
2865 | + The Initial Developer of the Original Code is |
2866 | + Edward Hieatt, edward@jsunit.net. |
2867 | + Portions created by the Initial Developer are Copyright (C) 2003 |
2868 | + the Initial Developer. All Rights Reserved. |
2869 | + |
2870 | + Author Edward Hieatt, edward@jsunit.net |
2871 | + |
2872 | + Alternatively, the contents of this file may be used under the terms of |
2873 | + either the GNU General Public License Version 2 or later (the "GPL"), or |
2874 | + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
2875 | + in which case the provisions of the GPL or the LGPL are applicable instead |
2876 | + of those above. If you wish to allow use of your version of this file only |
2877 | + under the terms of either the GPL or the LGPL, and not to allow others to |
2878 | + use your version of this file under the terms of the MPL, indicate your |
2879 | + decision by deleting the provisions above and replace them with the notice |
2880 | + and other provisions required by the LGPL or the GPL. If you do not delete |
2881 | + the provisions above, a recipient may use your version of this file under |
2882 | + the terms of any one of the MPL, the GPL or the LGPL. |
2883 | +*/ |
2884 | + |
2885 | +// Mock setTimeout, clearTimeout |
2886 | +// Contributed by Pivotal Computer Systems, www.pivotalsf.com |
2887 | +// |
2888 | +// Copied from the JsUnit 2.2alpha1 release, made in Mar 24 2006 |
2889 | +// (http://www.jsunit.net/) |
2890 | + |
2891 | +var Clock = { |
2892 | + timeoutsMade: 0, |
2893 | + scheduledFunctions: {}, |
2894 | + nowMillis: 0, |
2895 | + reset: function() { |
2896 | + this.scheduledFunctions = {}; |
2897 | + this.nowMillis = 0; |
2898 | + this.timeoutsMade = 0; |
2899 | + }, |
2900 | + tick: function(millis) { |
2901 | + var oldMillis = this.nowMillis; |
2902 | + var newMillis = oldMillis + millis; |
2903 | + this.runFunctionsWithinRange(oldMillis, newMillis); |
2904 | + this.nowMillis = newMillis; |
2905 | + }, |
2906 | + runFunctionsWithinRange: function(oldMillis, nowMillis) { |
2907 | + var scheduledFunc; |
2908 | + var funcsToRun = []; |
2909 | + for (var timeoutKey in this.scheduledFunctions) { |
2910 | + scheduledFunc = this.scheduledFunctions[timeoutKey]; |
2911 | + if (scheduledFunc != undefined && |
2912 | + scheduledFunc.runAtMillis >= oldMillis && |
2913 | + scheduledFunc.runAtMillis <= nowMillis) { |
2914 | + funcsToRun.push(scheduledFunc); |
2915 | + this.scheduledFunctions[timeoutKey] = undefined; |
2916 | + } |
2917 | + } |
2918 | + |
2919 | + if (funcsToRun.length > 0) { |
2920 | + funcsToRun.sort(function(a, b) { |
2921 | + return a.runAtMillis - b.runAtMillis; |
2922 | + }); |
2923 | + for (var i = 0; i < funcsToRun.length; ++i) { |
2924 | + try { |
2925 | + this.nowMillis = funcsToRun[i].runAtMillis; |
2926 | + funcsToRun[i].funcToCall(); |
2927 | + if (funcsToRun[i].recurring) { |
2928 | + Clock.scheduleFunction(funcsToRun[i].timeoutKey, |
2929 | + funcsToRun[i].funcToCall, |
2930 | + funcsToRun[i].millis, |
2931 | + true); |
2932 | + } |
2933 | + } catch(e) { |
2934 | + console.log(e); |
2935 | + } |
2936 | + } |
2937 | + this.runFunctionsWithinRange(oldMillis, nowMillis); |
2938 | + } |
2939 | + }, |
2940 | + scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { |
2941 | + Clock.scheduledFunctions[timeoutKey] = { |
2942 | + runAtMillis: Clock.nowMillis + millis, |
2943 | + funcToCall: funcToCall, |
2944 | + recurring: recurring, |
2945 | + timeoutKey: timeoutKey, |
2946 | + millis: millis |
2947 | + }; |
2948 | + } |
2949 | +}; |
2950 | + |
2951 | +function setTimeout(funcToCall, millis) { |
2952 | + Clock.timeoutsMade = Clock.timeoutsMade + 1; |
2953 | + Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, false); |
2954 | + return Clock.timeoutsMade; |
2955 | +} |
2956 | + |
2957 | +function setInterval(funcToCall, millis) { |
2958 | + Clock.timeoutsMade = Clock.timeoutsMade + 1; |
2959 | + Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, true); |
2960 | + return Clock.timeoutsMade; |
2961 | +} |
2962 | + |
2963 | +function clearTimeout(timeoutKey) { |
2964 | + Clock.scheduledFunctions[timeoutKey] = undefined; |
2965 | +} |
2966 | + |
2967 | +function clearInterval(timeoutKey) { |
2968 | + Clock.scheduledFunctions[timeoutKey] = undefined; |
2969 | +} |
2970 | |
2971 | === modified file 'src-js/lazrjs/testing/mockio.js' |
2972 | --- src-js/lazrjs/testing/mockio.js 2009-08-13 12:17:44 +0000 |
2973 | +++ src-js/lazrjs/testing/mockio.js 2009-10-30 17:01:14 +0000 |
2974 | @@ -1,6 +1,6 @@ |
2975 | /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
2976 | |
2977 | -YUI.add('lazr.testing', function(Y) { |
2978 | +YUI.add('lazr.testing.mockio', function(Y) { |
2979 | /** |
2980 | * A utility module for use in YUI unit-tests with a helper for mocking Y.io. |
2981 | * |
2982 | @@ -63,9 +63,7 @@ |
2983 | }; |
2984 | }; |
2985 | |
2986 | -if (Y.lazr.testing === undefined) { |
2987 | - Y.lazr.testing = {}; |
2988 | -} |
2989 | +Y.namespace("lazr.testing"); |
2990 | Y.lazr.testing.MockIo = MockIo; |
2991 | |
2992 | }, '0.1', {}); |
2993 | |
2994 | === added file 'src-js/lazrjs/testing/testing.js' |
2995 | --- src-js/lazrjs/testing/testing.js 1970-01-01 00:00:00 +0000 |
2996 | +++ src-js/lazrjs/testing/testing.js 2009-10-30 17:01:14 +0000 |
2997 | @@ -0,0 +1,123 @@ |
2998 | +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
2999 | + |
3000 | +YUI.add("lazr.testing.runner", function(Y) { |
3001 | + |
3002 | +/** |
3003 | + * Testing utilities. |
3004 | + * |
3005 | + * @module lazr.testing |
3006 | + * @namespace lazr |
3007 | + */ |
3008 | + |
3009 | +Runner = Y.namespace("lazr.testing.Runner"); |
3010 | + |
3011 | +Runner.add = function(suite) { |
3012 | + if ((typeof jstestdriver === "undefined")) { |
3013 | + // If we are not running under JsTestDriver, then |
3014 | + // register the suite with Y.Test.Runner and run it. |
3015 | + Y.Test.Runner.add(suite); |
3016 | + } else { |
3017 | + // If ``jstestdriver`` is defined, that means we are |
3018 | + // running under JsTestDriver, so instead register each |
3019 | + // test case from the suite as a separate TestCase() with |
3020 | + // JsTestDriver. |
3021 | + var tests = []; |
3022 | + |
3023 | + for (var idx in suite.items) { |
3024 | + var suiteName = suite.name; |
3025 | + var testCase = suite.items[idx]; |
3026 | + var testCaseName = testCase.name; |
3027 | + |
3028 | + var clone = {}; |
3029 | + for (var prop in testCase){ |
3030 | + // Clone everything that is not a test method. |
3031 | + if (prop.indexOf("test") === -1){ |
3032 | + clone[prop] = testCase[prop]; |
3033 | + } |
3034 | + } |
3035 | + |
3036 | + // Now for each test method, create a JsTestDriver |
3037 | + // TestCase that wraps a single YUI TestSuite, that wraps |
3038 | + // a clone of the original TestCase but with only the |
3039 | + // single test method that we are interested in. |
3040 | + for (var prop in testCase){ |
3041 | + if (prop.indexOf("test") === 0 && |
3042 | + Y.Lang.isFunction(testCase[prop])){ |
3043 | + tests.push({"suiteName": suiteName, |
3044 | + "caseName": testCaseName, |
3045 | + "case": clone, |
3046 | + "methodName": prop, |
3047 | + "method": testCase[prop]}); |
3048 | + } |
3049 | + } |
3050 | + } |
3051 | + |
3052 | + for (var i=0; i<tests.length; i++){ |
3053 | + testObject = tests[i]; |
3054 | + |
3055 | + var fakeTestCase = { |
3056 | + "setUp": Y.bind(function(testObject){ |
3057 | + var testSuite = new Y.Test.Suite(testObject["suiteName"]); |
3058 | + var testCase = new Y.Test.Case(testObject["case"]); |
3059 | + testCase[testObject["methodName"]] = testObject["method"]; |
3060 | + testSuite.add(testCase); |
3061 | + Y.Test.Runner.clear(); |
3062 | + Y.Test.Runner.add(testSuite); |
3063 | + }, this, testObject), |
3064 | + "tearDown": function(){ |
3065 | + Y.Test.Runner.clear(); |
3066 | + }, |
3067 | + }; |
3068 | + |
3069 | + fakeTestCase[testObject["methodName"]] = Y.bind(function (testObject) { |
3070 | + var results = []; |
3071 | + |
3072 | + var onComplete = function (caseName, methodName, results, e) { |
3073 | + Y.Test.Runner.unsubscribe("testsuitecomplete"); |
3074 | + results.push(e.results[caseName][methodName]); |
3075 | + }; |
3076 | + |
3077 | + Y.Test.Runner.subscribe( |
3078 | + "testsuitecomplete", |
3079 | + Y.bind(onComplete, this, testObject["caseName"], |
3080 | + testObject["methodName"], results), |
3081 | + Y.Test.Runner); |
3082 | + |
3083 | + Clock.reset(); |
3084 | + Y.Test.Runner.run(); |
3085 | + for (var i=0;i<100 && !results.length; i++){ |
3086 | + Clock.tick(100); |
3087 | + } |
3088 | + |
3089 | + var result = results.pop(); |
3090 | + if (result === undefined) { |
3091 | + fail("Test did not finish after 100 iterations."); |
3092 | + } else { |
3093 | + if (result["result"] == "fail"){ |
3094 | + fail(result["message"]); |
3095 | + } |
3096 | + } |
3097 | + |
3098 | + }, this, testObject); |
3099 | + |
3100 | + TestCase(testObject["caseName"] + "." + testObject["methodName"], |
3101 | + fakeTestCase); |
3102 | + } |
3103 | + } |
3104 | +}; |
3105 | + |
3106 | +Runner.run = function(suite) { |
3107 | + Y.on("domready", function() { |
3108 | + if ((typeof jstestdriver === "undefined")) { |
3109 | + // If we are not running under JsTestDriver, then run all |
3110 | + // the registered test suites with Y.Test.Runner. |
3111 | + var yconsole = new Y.Console({ |
3112 | + newestOnTop: false |
3113 | + }); |
3114 | + yconsole.render("#log"); |
3115 | + Y.Test.Runner.run(); |
3116 | + } |
3117 | + }); |
3118 | +}; |
3119 | + |
3120 | +}, "0.1", {requires: ["oop", "test", "console"]}); |
3121 | |
3122 | === added file 'src-js/lazrjs/testing/yui-patch.js' |
3123 | --- src-js/lazrjs/testing/yui-patch.js 1970-01-01 00:00:00 +0000 |
3124 | +++ src-js/lazrjs/testing/yui-patch.js 2009-10-30 17:01:14 +0000 |
3125 | @@ -0,0 +1,2137 @@ |
3126 | +/* |
3127 | +Copyright (c) 2009, Yahoo! Inc. All rights reserved. |
3128 | +Code licensed under the BSD License: |
3129 | +http://developer.yahoo.net/yui/license.txt |
3130 | +version: 3.0.0 |
3131 | +build: 1549 |
3132 | +*/ |
3133 | + |
3134 | +/* |
3135 | +Copied from yui/loader/loader.js |
3136 | + |
3137 | +Patched by the JsTestDriver team to avoid trying to load files, since |
3138 | +JsTestDriver itself will load the files for you. |
3139 | +*/ |
3140 | + |
3141 | +YUI.add('loader', function(Y) { |
3142 | + |
3143 | +(function() { |
3144 | +/** |
3145 | + * Loader dynamically loads script and css files. It includes the dependency |
3146 | + * info for the version of the library in use, and will automatically pull in |
3147 | + * dependencies for the modules requested. It supports rollup files and will |
3148 | + * automatically use these when appropriate in order to minimize the number of |
3149 | + * http connections required to load all of the dependencies. It can load the |
3150 | + * files from the Yahoo! CDN, and it can utilize the combo service provided on |
3151 | + * this network to reduce the number of http connections required to download |
3152 | + * YUI files. |
3153 | + * |
3154 | + * @module loader |
3155 | + */ |
3156 | + |
3157 | +/** |
3158 | + * Loader dynamically loads script and css files. It includes the dependency |
3159 | + * info for the version of the library in use, and will automatically pull in |
3160 | + * dependencies for the modules requested. It supports rollup files and will |
3161 | + * automatically use these when appropriate in order to minimize the number of |
3162 | + * http connections required to load all of the dependencies. It can load the |
3163 | + * files from the Yahoo! CDN, and it can utilize the combo service provided on |
3164 | + * this network to reduce the number of http connections required to download |
3165 | + * YUI files. |
3166 | + * |
3167 | + * While the loader can be instantiated by the end user, it normally is not. |
3168 | + * @see YUI.use for the normal use case. The use function automatically will |
3169 | + * pull in missing dependencies. |
3170 | + * |
3171 | + * @class Loader |
3172 | + * @constructor |
3173 | + * @param o an optional set of configuration options. Valid options: |
3174 | + * <ul> |
3175 | + * <li>base: |
3176 | + * The base dir</li> |
3177 | + * <li>secureBase: |
3178 | + * The secure base dir (not implemented)</li> |
3179 | + * <li>comboBase: |
3180 | + * The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li> |
3181 | + * <li>root: |
3182 | + * The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li> |
3183 | + * <li>filter: |
3184 | + * |
3185 | + * A filter to apply to result urls. This filter will modify the default |
3186 | + * path for all modules. The default path for the YUI library is the |
3187 | + * minified version of the files (e.g., event-min.js). The filter property |
3188 | + * can be a predefined filter or a custom filter. The valid predefined |
3189 | + * filters are: |
3190 | + * <dl> |
3191 | + * <dt>DEBUG</dt> |
3192 | + * <dd>Selects the debug versions of the library (e.g., event-debug.js). |
3193 | + * This option will automatically include the Logger widget</dd> |
3194 | + * <dt>RAW</dt> |
3195 | + * <dd>Selects the non-minified version of the library (e.g., event.js).</dd> |
3196 | + * </dl> |
3197 | + * You can also define a custom filter, which must be an object literal |
3198 | + * containing a search expression and a replace string: |
3199 | + * <pre> |
3200 | + * myFilter: { |
3201 | + * 'searchExp': "-min\\.js", |
3202 | + * 'replaceStr': "-debug.js" |
3203 | + * } |
3204 | + * </pre> |
3205 | + * |
3206 | + * </li> |
3207 | + * <li>filters: per-component filter specification. If specified for a given component, this overrides the filter config</li> |
3208 | + * <li>combine: |
3209 | + * Use the YUI combo service to reduce the number of http connections required to load your dependencies</li> |
3210 | + * <li>ignore: |
3211 | + * A list of modules that should never be dynamically loaded</li> |
3212 | + * <li>force: |
3213 | + * A list of modules that should always be loaded when required, even if already present on the page</li> |
3214 | + * <li>insertBefore: |
3215 | + * Node or id for a node that should be used as the insertion point for new nodes</li> |
3216 | + * <li>charset: |
3217 | + * charset for dynamic nodes (deprecated, use jsAttributes or cssAttributes)</li> |
3218 | + * <li>jsAttributes: object literal containing attributes to add to script nodes</li> |
3219 | + * <li>cssAttributes: object literal containing attributes to add to link nodes</li> |
3220 | + * <li>timeout: |
3221 | + * number of milliseconds before a timeout occurs when dynamically loading nodes. in not set, there is no timeout</li> |
3222 | + * <li>context: |
3223 | + * execution context for all callbacks</li> |
3224 | + * <li>onSuccess: |
3225 | + * callback for the 'success' event</li> |
3226 | + * <li>onFailure: callback for the 'failure' event</li> |
3227 | + * <li>onCSS: callback for the 'CSSComplete' event. When loading YUI components with CSS |
3228 | + * the CSS is loaded first, then the script. This provides a moment you can tie into to improve |
3229 | + * the presentation of the page while the script is loading.</li> |
3230 | + * <li>onTimeout: |
3231 | + * callback for the 'timeout' event</li> |
3232 | + * <li>onProgress: |
3233 | + * callback executed each time a script or css file is loaded</li> |
3234 | + * <li>modules: |
3235 | + * A list of module definitions. See Loader.addModule for the supported module metadata</li> |
3236 | + * </ul> |
3237 | + */ |
3238 | + |
3239 | +/* |
3240 | + * Global loader queue |
3241 | + * @property _loaderQueue |
3242 | + * @type Queue |
3243 | + * @private |
3244 | + */ |
3245 | +YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Y.Queue(); |
3246 | + |
3247 | +var NOT_FOUND = {}, |
3248 | + GLOBAL_ENV = YUI.Env, |
3249 | + GLOBAL_LOADED, |
3250 | + BASE = 'base', |
3251 | + CSS = 'css', |
3252 | + JS = 'js', |
3253 | + CSSRESET = 'cssreset', |
3254 | + CSSFONTS = 'cssfonts', |
3255 | + CSSGRIDS = 'cssgrids', |
3256 | + CSSBASE = 'cssbase', |
3257 | + CSS_AFTER = [CSSRESET, CSSFONTS, CSSGRIDS, |
3258 | + 'cssreset-context', 'cssfonts-context', 'cssgrids-context'], |
3259 | + YUI_CSS = ['reset', 'fonts', 'grids', BASE], |
3260 | + VERSION = Y.version, |
3261 | + ROOT = VERSION + '/build/', |
3262 | + CONTEXT = '-context', |
3263 | + |
3264 | + ANIMBASE = 'anim-base', |
3265 | + ATTRIBUTE = 'attribute', |
3266 | + ATTRIBUTEBASE = ATTRIBUTE + '-base', |
3267 | + BASEBASE = 'base-base', |
3268 | + DDDRAG = 'dd-drag', |
3269 | + DOM = 'dom', |
3270 | + DATASCHEMABASE = 'dataschema-base', |
3271 | + DATASOURCELOCAL = 'datasource-local', |
3272 | + DOMBASE = 'dom-base', |
3273 | + DOMSTYLE = 'dom-style', |
3274 | + DOMSCREEN = 'dom-screen', |
3275 | + DUMP = 'dump', |
3276 | + GET = 'get', |
3277 | + EVENTBASE = 'event-base', |
3278 | + EVENTCUSTOM = 'event-custom', |
3279 | + EVENTCUSTOMBASE = 'event-custom-base', |
3280 | + IOBASE = 'io-base', |
3281 | + NODE = 'node', |
3282 | + NODEBASE = 'node-base', |
3283 | + NODESTYLE = 'node-style', |
3284 | + NODESCREEN = 'node-screen', |
3285 | + OOP = 'oop', |
3286 | + PLUGINHOST = 'pluginhost', |
3287 | + SELECTORCSS2 = 'selector-css2', |
3288 | + SUBSTITUTE = 'substitute', |
3289 | + WIDGET = 'widget', |
3290 | + WIDGETPOSITION = 'widget-position', |
3291 | + YUIBASE = 'yui-base', |
3292 | + |
3293 | + PLUGIN = 'plugin', |
3294 | + |
3295 | + META = { |
3296 | + |
3297 | + version: VERSION, |
3298 | + |
3299 | + root: ROOT, |
3300 | + |
3301 | + base: 'http://yui.yahooapis.com/' + ROOT, |
3302 | + |
3303 | + comboBase: 'http://yui.yahooapis.com/combo?', |
3304 | + |
3305 | + skin: { |
3306 | + defaultSkin: 'sam', |
3307 | + base: 'assets/skins/', |
3308 | + path: 'skin.css', |
3309 | + after: CSS_AFTER |
3310 | + //rollup: 3 |
3311 | + }, |
3312 | + |
3313 | + modules: { |
3314 | + |
3315 | + dom: { |
3316 | + requires: [OOP], |
3317 | + submodules: { |
3318 | + |
3319 | + 'dom-base': { |
3320 | + requires: [OOP] |
3321 | + }, |
3322 | + |
3323 | + 'dom-style': { |
3324 | + requires: [DOMBASE] |
3325 | + }, |
3326 | + |
3327 | + 'dom-screen': { |
3328 | + requires: [DOMBASE, DOMSTYLE] |
3329 | + }, |
3330 | + |
3331 | + 'selector-native': { |
3332 | + requires: [DOMBASE] |
3333 | + }, |
3334 | + |
3335 | + 'selector-css2': { |
3336 | + requires: ['selector-native'] |
3337 | + }, |
3338 | + |
3339 | + 'selector': { |
3340 | + requires: [DOMBASE] |
3341 | + } |
3342 | + |
3343 | + }, |
3344 | + |
3345 | + plugins: { |
3346 | + 'selector-css3': { |
3347 | + requires: [SELECTORCSS2] |
3348 | + } |
3349 | + } |
3350 | + }, |
3351 | + |
3352 | + node: { |
3353 | + requires: [DOM, EVENTBASE], |
3354 | + // expound: EVENT, |
3355 | + |
3356 | + submodules: { |
3357 | + 'node-base': { |
3358 | + requires: [DOMBASE, SELECTORCSS2, EVENTBASE] |
3359 | + }, |
3360 | + |
3361 | + 'node-style': { |
3362 | + requires: [DOMSTYLE, NODEBASE] |
3363 | + }, |
3364 | + |
3365 | + 'node-screen': { |
3366 | + requires: [DOMSCREEN, NODEBASE] |
3367 | + }, |
3368 | + |
3369 | + 'node-pluginhost': { |
3370 | + requires: [NODEBASE, PLUGINHOST] |
3371 | + }, |
3372 | + |
3373 | + |
3374 | + 'node-event-delegate': { |
3375 | + requires: [NODEBASE, 'event-delegate'] |
3376 | + } |
3377 | + }, |
3378 | + |
3379 | + plugins: { |
3380 | + 'node-event-simulate': { |
3381 | + requires: [NODEBASE, 'event-simulate'] |
3382 | + } |
3383 | + } |
3384 | + }, |
3385 | + |
3386 | + anim: { |
3387 | + submodules: { |
3388 | + |
3389 | + 'anim-base': { |
3390 | + requires: [BASEBASE, NODESTYLE] |
3391 | + }, |
3392 | + |
3393 | + 'anim-color': { |
3394 | + requires: [ANIMBASE] |
3395 | + }, |
3396 | + |
3397 | + 'anim-easing': { |
3398 | + requires: [ANIMBASE] |
3399 | + }, |
3400 | + |
3401 | + 'anim-scroll': { |
3402 | + requires: [ANIMBASE] |
3403 | + }, |
3404 | + |
3405 | + 'anim-xy': { |
3406 | + requires: [ANIMBASE, NODESCREEN] |
3407 | + }, |
3408 | + |
3409 | + 'anim-curve': { |
3410 | + requires: ['anim-xy'] |
3411 | + }, |
3412 | + |
3413 | + 'anim-node-plugin': { |
3414 | + requires: ['node-pluginhost', ANIMBASE] |
3415 | + } |
3416 | + } |
3417 | + }, |
3418 | + |
3419 | + attribute: { |
3420 | + submodules: { |
3421 | + 'attribute-base': { |
3422 | + requires: [EVENTCUSTOM] |
3423 | + }, |
3424 | + |
3425 | + 'attribute-complex': { |
3426 | + requires: [ATTRIBUTEBASE] |
3427 | + } |
3428 | + } |
3429 | + }, |
3430 | + |
3431 | + base: { |
3432 | + submodules: { |
3433 | + 'base-base': { |
3434 | + requires: [ATTRIBUTEBASE] |
3435 | + }, |
3436 | + |
3437 | + 'base-build': { |
3438 | + requires: [BASEBASE] |
3439 | + }, |
3440 | + |
3441 | + 'base-pluginhost': { |
3442 | + requires: [BASEBASE, PLUGINHOST] |
3443 | + } |
3444 | + } |
3445 | + }, |
3446 | + |
3447 | + cache: { |
3448 | + requires: [PLUGIN] |
3449 | + }, |
3450 | + |
3451 | + compat: { |
3452 | + requires: [NODE, DUMP, SUBSTITUTE] |
3453 | + }, |
3454 | + |
3455 | + classnamemanager: { |
3456 | + requires: [YUIBASE] |
3457 | + }, |
3458 | + |
3459 | + collection: { |
3460 | + requires: [OOP] |
3461 | + }, |
3462 | + |
3463 | + console: { |
3464 | + requires: ['yui-log', WIDGET, SUBSTITUTE], |
3465 | + skinnable: true, |
3466 | + plugins: { |
3467 | + 'console-filters': { |
3468 | + requires: [PLUGIN, 'console'], |
3469 | + skinnable: true |
3470 | + } |
3471 | + } |
3472 | + }, |
3473 | + |
3474 | + cookie: { |
3475 | + requires: [YUIBASE] |
3476 | + }, |
3477 | + |
3478 | + dataschema:{ |
3479 | + submodules: { |
3480 | + 'dataschema-base': { |
3481 | + requires: [BASE] |
3482 | + }, |
3483 | + 'dataschema-array': { |
3484 | + requires: [DATASCHEMABASE] |
3485 | + }, |
3486 | + 'dataschema-json': { |
3487 | + requires: [DATASCHEMABASE, 'json'] |
3488 | + }, |
3489 | + 'dataschema-text': { |
3490 | + requires: [DATASCHEMABASE] |
3491 | + }, |
3492 | + 'dataschema-xml': { |
3493 | + requires: [DATASCHEMABASE] |
3494 | + } |
3495 | + } |
3496 | + }, |
3497 | + |
3498 | + datasource:{ |
3499 | + submodules: { |
3500 | + 'datasource-local': { |
3501 | + requires: [BASE] |
3502 | + }, |
3503 | + 'datasource-arrayschema': { |
3504 | + requires: [DATASOURCELOCAL, PLUGIN, 'dataschema-array'] |
3505 | + }, |
3506 | + 'datasource-cache': { |
3507 | + requires: [DATASOURCELOCAL, 'cache'] |
3508 | + }, |
3509 | + 'datasource-function': { |
3510 | + requires: [DATASOURCELOCAL] |
3511 | + }, |
3512 | + 'datasource-jsonschema': { |
3513 | + requires: [DATASOURCELOCAL, PLUGIN, 'dataschema-json'] |
3514 | + }, |
3515 | + 'datasource-polling': { |
3516 | + requires: [DATASOURCELOCAL] |
3517 | + }, |
3518 | + 'datasource-get': { |
3519 | + requires: [DATASOURCELOCAL, GET] |
3520 | + }, |
3521 | + 'datasource-textschema': { |
3522 | + requires: [DATASOURCELOCAL, PLUGIN, 'dataschema-text'] |
3523 | + }, |
3524 | + 'datasource-io': { |
3525 | + requires: [DATASOURCELOCAL, IOBASE] |
3526 | + }, |
3527 | + 'datasource-xmlschema': { |
3528 | + requires: [DATASOURCELOCAL, PLUGIN, 'dataschema-xml'] |
3529 | + } |
3530 | + } |
3531 | + }, |
3532 | + |
3533 | + datatype:{ |
3534 | + submodules: { |
3535 | + 'datatype-date': { |
3536 | + requires: [YUIBASE] |
3537 | + }, |
3538 | + 'datatype-number': { |
3539 | + requires: [YUIBASE] |
3540 | + }, |
3541 | + 'datatype-xml': { |
3542 | + requires: [YUIBASE] |
3543 | + } |
3544 | + } |
3545 | + }, |
3546 | + |
3547 | + dd:{ |
3548 | + submodules: { |
3549 | + 'dd-ddm-base': { |
3550 | + requires: [NODE, BASE] |
3551 | + }, |
3552 | + 'dd-ddm':{ |
3553 | + requires: ['dd-ddm-base', 'event-resize'] |
3554 | + }, |
3555 | + 'dd-ddm-drop':{ |
3556 | + requires: ['dd-ddm'] |
3557 | + }, |
3558 | + 'dd-drag':{ |
3559 | + requires: ['dd-ddm-base'] |
3560 | + }, |
3561 | + 'dd-drop':{ |
3562 | + requires: ['dd-ddm-drop'] |
3563 | + }, |
3564 | + 'dd-proxy':{ |
3565 | + requires: [DDDRAG] |
3566 | + }, |
3567 | + 'dd-constrain':{ |
3568 | + requires: [DDDRAG] |
3569 | + }, |
3570 | + 'dd-scroll':{ |
3571 | + requires: [DDDRAG] |
3572 | + }, |
3573 | + 'dd-plugin':{ |
3574 | + requires: [DDDRAG], |
3575 | + optional: ['dd-constrain', 'dd-proxy'] |
3576 | + }, |
3577 | + 'dd-drop-plugin':{ |
3578 | + requires: ['dd-drop'] |
3579 | + } |
3580 | + } |
3581 | + }, |
3582 | + |
3583 | + dump: { |
3584 | + requires: [YUIBASE] |
3585 | + }, |
3586 | + |
3587 | + event: { |
3588 | + expound: NODEBASE, |
3589 | + submodules: { |
3590 | + 'event-base': { |
3591 | + expound: NODEBASE, |
3592 | + requires: [EVENTCUSTOMBASE] |
3593 | + }, |
3594 | + 'event-delegate': { |
3595 | + requires: [NODEBASE] |
3596 | + }, |
3597 | + 'event-focus': { |
3598 | + requires: [NODEBASE] |
3599 | + }, |
3600 | + 'event-key': { |
3601 | + requires: [NODEBASE] |
3602 | + }, |
3603 | + 'event-mouseenter': { |
3604 | + requires: [NODEBASE] |
3605 | + }, |
3606 | + 'event-mousewheel': { |
3607 | + requires: [NODEBASE] |
3608 | + }, |
3609 | + 'event-resize': { |
3610 | + requires: [NODEBASE] |
3611 | + } |
3612 | + } |
3613 | + }, |
3614 | + |
3615 | + 'event-custom': { |
3616 | + submodules: { |
3617 | + 'event-custom-base': { |
3618 | + requires: [OOP, 'yui-later'] |
3619 | + }, |
3620 | + 'event-custom-complex': { |
3621 | + requires: [EVENTCUSTOMBASE] |
3622 | + } |
3623 | + } |
3624 | + }, |
3625 | + |
3626 | + 'event-simulate': { |
3627 | + requires: [EVENTBASE] |
3628 | + }, |
3629 | + |
3630 | + 'node-focusmanager': { |
3631 | + requires: [ATTRIBUTE, NODE, PLUGIN, 'node-event-simulate', 'event-key', 'event-focus'] |
3632 | + }, |
3633 | + |
3634 | + history: { |
3635 | + requires: [NODE] |
3636 | + }, |
3637 | + |
3638 | + imageloader: { |
3639 | + requires: [BASEBASE, NODESTYLE, NODESCREEN] |
3640 | + }, |
3641 | + |
3642 | + io:{ |
3643 | + submodules: { |
3644 | + |
3645 | + 'io-base': { |
3646 | + requires: [EVENTCUSTOMBASE] |
3647 | + }, |
3648 | + |
3649 | + 'io-xdr': { |
3650 | + requires: [IOBASE, 'datatype-xml'] |
3651 | + }, |
3652 | + |
3653 | + 'io-form': { |
3654 | + requires: [IOBASE, NODEBASE, NODESTYLE] |
3655 | + }, |
3656 | + |
3657 | + 'io-upload-iframe': { |
3658 | + requires: [IOBASE, NODEBASE] |
3659 | + }, |
3660 | + |
3661 | + 'io-queue': { |
3662 | + requires: [IOBASE, 'queue-promote'] |
3663 | + } |
3664 | + } |
3665 | + }, |
3666 | + |
3667 | + json: { |
3668 | + submodules: { |
3669 | + 'json-parse': { |
3670 | + requires: [YUIBASE] |
3671 | + }, |
3672 | + |
3673 | + 'json-stringify': { |
3674 | + requires: [YUIBASE] |
3675 | + } |
3676 | + } |
3677 | + }, |
3678 | + |
3679 | + loader: { |
3680 | + requires: [GET] |
3681 | + }, |
3682 | + |
3683 | + 'node-menunav': { |
3684 | + requires: [NODE, 'classnamemanager', PLUGIN, 'node-focusmanager'], |
3685 | + skinnable: true |
3686 | + }, |
3687 | + |
3688 | + oop: { |
3689 | + requires: [YUIBASE] |
3690 | + }, |
3691 | + |
3692 | + overlay: { |
3693 | + requires: [WIDGET, WIDGETPOSITION, 'widget-position-ext', 'widget-stack', 'widget-stdmod'], |
3694 | + skinnable: true |
3695 | + }, |
3696 | + |
3697 | + plugin: { |
3698 | + requires: [BASEBASE] |
3699 | + }, |
3700 | + |
3701 | + pluginhost: { |
3702 | + requires: [YUIBASE] |
3703 | + }, |
3704 | + |
3705 | + profiler: { |
3706 | + requires: [YUIBASE] |
3707 | + }, |
3708 | + |
3709 | + 'queue-promote': { |
3710 | + requires: [YUIBASE] |
3711 | + }, |
3712 | + |
3713 | + // deprecated package, replaced with async-queue |
3714 | + 'queue-run': { |
3715 | + requires: [EVENTCUSTOM], |
3716 | + path: 'async-queue/async-queue-min.js' |
3717 | + }, |
3718 | + |
3719 | + 'async-queue': { |
3720 | + requires: [EVENTCUSTOM], |
3721 | + supersedes: ['queue-run'] |
3722 | + }, |
3723 | + |
3724 | + slider: { |
3725 | + requires: [WIDGET, 'dd-constrain'], |
3726 | + skinnable: true |
3727 | + }, |
3728 | + |
3729 | + stylesheet: { |
3730 | + requires: [YUIBASE] |
3731 | + }, |
3732 | + |
3733 | + substitute: { |
3734 | + optional: [DUMP] |
3735 | + }, |
3736 | + |
3737 | + widget: { |
3738 | + requires: [ATTRIBUTE, 'event-focus', BASE, NODE, 'classnamemanager'], |
3739 | + plugins: { |
3740 | + 'widget-position': { }, |
3741 | + 'widget-position-ext': { |
3742 | + requires: [WIDGETPOSITION] |
3743 | + }, |
3744 | + 'widget-stack': { |
3745 | + skinnable: true |
3746 | + }, |
3747 | + 'widget-stdmod': { } |
3748 | + }, |
3749 | + skinnable: true |
3750 | + }, |
3751 | + |
3752 | + yui: { |
3753 | + submodules: { |
3754 | + 'yui-base': {}, |
3755 | + get: {}, |
3756 | + 'yui-log': {}, |
3757 | + 'yui-later': {} |
3758 | + } |
3759 | + }, |
3760 | + |
3761 | + test: { |
3762 | + requires: [SUBSTITUTE, NODE, 'json', 'event-simulate'] |
3763 | + } |
3764 | + |
3765 | + } |
3766 | +}, |
3767 | + |
3768 | +_path = Y.cached(function(dir, file, type) { |
3769 | + return dir + '/' + file + '-min.' + (type || CSS); |
3770 | +}), |
3771 | + |
3772 | +_queue = YUI.Env._loaderQueue, |
3773 | + |
3774 | +mods = META.modules, i, bname, mname, contextname, |
3775 | +L = Y.Lang; |
3776 | + |
3777 | +// Create the metadata for both the regular and context-aware |
3778 | +// versions of the YUI CSS foundation. |
3779 | +for (i=0; i<YUI_CSS.length; i=i+1) { |
3780 | + bname = YUI_CSS[i]; |
3781 | + mname = CSS + bname; |
3782 | + |
3783 | + mods[mname] = { |
3784 | + type: CSS, |
3785 | + path: _path(mname, bname) |
3786 | + }; |
3787 | + |
3788 | + // define -context module |
3789 | + contextname = mname + CONTEXT; |
3790 | + bname = bname + CONTEXT; |
3791 | + |
3792 | + mods[contextname] = { |
3793 | + type: CSS, |
3794 | + path: _path(mname, bname) |
3795 | + }; |
3796 | + |
3797 | + if (mname == CSSGRIDS) { |
3798 | + mods[mname].requires = [CSSFONTS]; |
3799 | + mods[mname].optional = [CSSRESET]; |
3800 | + mods[contextname].requires = [CSSFONTS + CONTEXT]; |
3801 | + mods[contextname].optional = [CSSRESET + CONTEXT]; |
3802 | + } else if (mname == CSSBASE) { |
3803 | + mods[mname].after = CSS_AFTER; |
3804 | + mods[contextname].after = CSS_AFTER; |
3805 | + } |
3806 | +} |
3807 | + |
3808 | +Y.Env.meta = META; |
3809 | + |
3810 | +GLOBAL_LOADED = GLOBAL_ENV._loaded; |
3811 | + |
3812 | +Y.Loader = function(o) { |
3813 | + |
3814 | + /** |
3815 | + * Internal callback to handle multiple internal insert() calls |
3816 | + * so that css is inserted prior to js |
3817 | + * @property _internalCallback |
3818 | + * @private |
3819 | + */ |
3820 | + // this._internalCallback = null; |
3821 | + |
3822 | + /** |
3823 | + * Callback that will be executed when the loader is finished |
3824 | + * with an insert |
3825 | + * @method onSuccess |
3826 | + * @type function |
3827 | + */ |
3828 | + // this.onSuccess = null; |
3829 | + |
3830 | + /** |
3831 | + * Callback that will be executed if there is a failure |
3832 | + * @method onFailure |
3833 | + * @type function |
3834 | + */ |
3835 | + // this.onFailure = null; |
3836 | + |
3837 | + /** |
3838 | + * Callback for the 'CSSComplete' event. When loading YUI components with CSS |
3839 | + * the CSS is loaded first, then the script. This provides a moment you can tie into to improve |
3840 | + * the presentation of the page while the script is loading. |
3841 | + * @method onCSS |
3842 | + * @type function |
3843 | + */ |
3844 | + // this.onCSS = null; |
3845 | + |
3846 | + /** |
3847 | + * Callback executed each time a script or css file is loaded |
3848 | + * @method onProgress |
3849 | + * @type function |
3850 | + */ |
3851 | + // this.onProgress = null; |
3852 | + |
3853 | + /** |
3854 | + * Callback that will be executed if a timeout occurs |
3855 | + * @method onTimeout |
3856 | + * @type function |
3857 | + */ |
3858 | + // this.onTimeout = null; |
3859 | + |
3860 | + /** |
3861 | + * The execution context for all callbacks |
3862 | + * @property context |
3863 | + * @default {YUI} the YUI instance |
3864 | + */ |
3865 | + this.context = Y; |
3866 | + |
3867 | + /** |
3868 | + * Data that is passed to all callbacks |
3869 | + * @property data |
3870 | + */ |
3871 | + // this.data = null; |
3872 | + |
3873 | + /** |
3874 | + * Node reference or id where new nodes should be inserted before |
3875 | + * @property insertBefore |
3876 | + * @type string|HTMLElement |
3877 | + */ |
3878 | + // this.insertBefore = null; |
3879 | + |
3880 | + /** |
3881 | + * The charset attribute for inserted nodes |
3882 | + * @property charset |
3883 | + * @type string |
3884 | + * @deprecated, use cssAttributes or jsAttributes |
3885 | + */ |
3886 | + // this.charset = null; |
3887 | + |
3888 | + /** |
3889 | + * An object literal containing attributes to add to link nodes |
3890 | + * @property cssAttributes |
3891 | + * @type object |
3892 | + */ |
3893 | + // this.cssAttributes = null; |
3894 | + |
3895 | + /** |
3896 | + * An object literal containing attributes to add to script nodes |
3897 | + * @property jsAttributes |
3898 | + * @type object |
3899 | + */ |
3900 | + // this.jsAttributes = null; |
3901 | + |
3902 | + /** |
3903 | + * The base directory. |
3904 | + * @property base |
3905 | + * @type string |
3906 | + * @default http://yui.yahooapis.com/[YUI VERSION]/build/ |
3907 | + */ |
3908 | + this.base = Y.Env.meta.base; |
3909 | + |
3910 | + /** |
3911 | + * Base path for the combo service |
3912 | + * @property comboBase |
3913 | + * @type string |
3914 | + * @default http://yui.yahooapis.com/combo? |
3915 | + */ |
3916 | + this.comboBase = Y.Env.meta.comboBase; |
3917 | + |
3918 | + /** |
3919 | + * If configured, YUI JS resources will use the combo |
3920 | + * handler |
3921 | + * @property combine |
3922 | + * @type boolean |
3923 | + * @default true if a base dir isn't in the config |
3924 | + */ |
3925 | + this.combine = o.base && (o.base.indexOf( this.comboBase.substr(0, 20)) > -1); |
3926 | + |
3927 | + /** |
3928 | + * Ignore modules registered on the YUI global |
3929 | + * @property ignoreRegistered |
3930 | + * @default false |
3931 | + */ |
3932 | + // this.ignoreRegistered = false; |
3933 | + |
3934 | + /** |
3935 | + * Root path to prepend to module path for the combo |
3936 | + * service |
3937 | + * @property root |
3938 | + * @type string |
3939 | + * @default [YUI VERSION]/build/ |
3940 | + */ |
3941 | + this.root = Y.Env.meta.root; |
3942 | + |
3943 | + /** |
3944 | + * Timeout value in milliseconds. If set, this value will be used by |
3945 | + * the get utility. the timeout event will fire if |
3946 | + * a timeout occurs. |
3947 | + * @property timeout |
3948 | + * @type int |
3949 | + */ |
3950 | + this.timeout = 0; |
3951 | + |
3952 | + /** |
3953 | + * A list of modules that should not be loaded, even if |
3954 | + * they turn up in the dependency tree |
3955 | + * @property ignore |
3956 | + * @type string[] |
3957 | + */ |
3958 | + // this.ignore = null; |
3959 | + |
3960 | + /** |
3961 | + * A list of modules that should always be loaded, even |
3962 | + * if they have already been inserted into the page. |
3963 | + * @property force |
3964 | + * @type string[] |
3965 | + */ |
3966 | + // this.force = null; |
3967 | + |
3968 | + this.forceMap = {}; |
3969 | + |
3970 | + /** |
3971 | + * Should we allow rollups |
3972 | + * @property allowRollup |
3973 | + * @type boolean |
3974 | + * @default true |
3975 | + */ |
3976 | + // this.allowRollup = true; |
3977 | + |
3978 | + /** |
3979 | + * A filter to apply to result urls. This filter will modify the default |
3980 | + * path for all modules. The default path for the YUI library is the |
3981 | + * minified version of the files (e.g., event-min.js). The filter property |
3982 | + * can be a predefined filter or a custom filter. The valid predefined |
3983 | + * filters are: |
3984 | + * <dl> |
3985 | + * <dt>DEBUG</dt> |
3986 | + * <dd>Selects the debug versions of the library (e.g., event-debug.js). |
3987 | + * This option will automatically include the Logger widget</dd> |
3988 | + * <dt>RAW</dt> |
3989 | + * <dd>Selects the non-minified version of the library (e.g., event.js).</dd> |
3990 | + * </dl> |
3991 | + * You can also define a custom filter, which must be an object literal |
3992 | + * containing a search expression and a replace string: |
3993 | + * <pre> |
3994 | + * myFilter: { |
3995 | + * 'searchExp': "-min\\.js", |
3996 | + * 'replaceStr': "-debug.js" |
3997 | + * } |
3998 | + * </pre> |
3999 | + * @property filter |
4000 | + * @type string|{searchExp: string, replaceStr: string} |
4001 | + */ |
4002 | + // this.filter = null; |
4003 | + |
4004 | + /** |
4005 | + * per-component filter specification. If specified for a given component, this |
4006 | + * overrides the filter config. |
4007 | + * @property filters |
4008 | + * @type object |
4009 | + */ |
4010 | + this.filters = {}; |
4011 | + |
4012 | + /** |
4013 | + * The list of requested modules |
4014 | + * @property required |
4015 | + * @type {string: boolean} |
4016 | + */ |
4017 | + this.required = {}; |
4018 | + |
4019 | + /** |
4020 | + * The library metadata |
4021 | + * @property moduleInfo |
4022 | + */ |
4023 | + // this.moduleInfo = Y.merge(Y.Env.meta.moduleInfo); |
4024 | + this.moduleInfo = {}; |
4025 | + |
4026 | + /** |
4027 | + * Provides the information used to skin the skinnable components. |
4028 | + * The following skin definition would result in 'skin1' and 'skin2' |
4029 | + * being loaded for calendar (if calendar was requested), and |
4030 | + * 'sam' for all other skinnable components: |
4031 | + * |
4032 | + * <code> |
4033 | + * skin: { |
4034 | + * |
4035 | + * // The default skin, which is automatically applied if not |
4036 | + * // overriden by a component-specific skin definition. |
4037 | + * // Change this in to apply a different skin globally |
4038 | + * defaultSkin: 'sam', |
4039 | + * |
4040 | + * // This is combined with the loader base property to get |
4041 | + * // the default root directory for a skin. ex: |
4042 | + * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ |
4043 | + * base: 'assets/skins/', |
4044 | + * |
4045 | + * // The name of the rollup css file for the skin |
4046 | + * path: 'skin.css', |
4047 | + * |
4048 | + * // The number of skinnable components requested that are |
4049 | + * // required before using the rollup file rather than the |
4050 | + * // individual component css files |
4051 | + * rollup: 3, |
4052 | + * |
4053 | + * // Any component-specific overrides can be specified here, |
4054 | + * // making it possible to load different skins for different |
4055 | + * // components. It is possible to load more than one skin |
4056 | + * // for a given component as well. |
4057 | + * overrides: { |
4058 | + * calendar: ['skin1', 'skin2'] |
4059 | + * } |
4060 | + * } |
4061 | + * </code> |
4062 | + * @property skin |
4063 | + */ |
4064 | + this.skin = Y.merge(Y.Env.meta.skin); |
4065 | + |
4066 | + var defaults = Y.Env.meta.modules, i, onPage = YUI.Env.mods; |
4067 | + |
4068 | + this._internal = true; |
4069 | + for (i in defaults) { |
4070 | + if (defaults.hasOwnProperty(i)) { |
4071 | + this.addModule(defaults[i], i); |
4072 | + } |
4073 | + } |
4074 | + |
4075 | + for (i in onPage) { |
4076 | + if (onPage.hasOwnProperty(i) && !this.moduleInfo[i] && onPage[i].details) { |
4077 | + this.addModule(onPage[i].details, i); |
4078 | + } |
4079 | + } |
4080 | + this._internal = false; |
4081 | + |
4082 | + /** |
4083 | + * List of rollup files found in the library metadata |
4084 | + * @property rollups |
4085 | + */ |
4086 | + // this.rollups = null; |
4087 | + |
4088 | + /** |
4089 | + * Whether or not to load optional dependencies for |
4090 | + * the requested modules |
4091 | + * @property loadOptional |
4092 | + * @type boolean |
4093 | + * @default false |
4094 | + */ |
4095 | + // this.loadOptional = false; |
4096 | + |
4097 | + /** |
4098 | + * All of the derived dependencies in sorted order, which |
4099 | + * will be populated when either calculate() or insert() |
4100 | + * is called |
4101 | + * @property sorted |
4102 | + * @type string[] |
4103 | + */ |
4104 | + this.sorted = []; |
4105 | + |
4106 | + /** |
4107 | + * Set when beginning to compute the dependency tree. |
4108 | + * Composed of what YUI reports to be loaded combined |
4109 | + * with what has been loaded by any instance on the page |
4110 | + * with the version number specified in the metadata. |
4111 | + * @propery loaded |
4112 | + * @type {string: boolean} |
4113 | + */ |
4114 | + this.loaded = GLOBAL_LOADED[VERSION]; |
4115 | + |
4116 | + /** |
4117 | + * A list of modules to attach to the YUI instance when complete. |
4118 | + * If not supplied, the sorted list of dependencies are applied. |
4119 | + * @property attaching |
4120 | + */ |
4121 | + // this.attaching = null; |
4122 | + |
4123 | + /** |
4124 | + * Flag to indicate the dependency tree needs to be recomputed |
4125 | + * if insert is called again. |
4126 | + * @property dirty |
4127 | + * @type boolean |
4128 | + * @default true |
4129 | + */ |
4130 | + this.dirty = true; |
4131 | + |
4132 | + /** |
4133 | + * List of modules inserted by the utility |
4134 | + * @property inserted |
4135 | + * @type {string: boolean} |
4136 | + */ |
4137 | + this.inserted = {}; |
4138 | + |
4139 | + /** |
4140 | + * List of skipped modules during insert() because the module |
4141 | + * was not defined |
4142 | + * @property skipped |
4143 | + */ |
4144 | + this.skipped = {}; |
4145 | + |
4146 | + |
4147 | + // Y.on('yui:load', this.loadNext, this); |
4148 | + |
4149 | + this._config(o); |
4150 | + |
4151 | +}; |
4152 | + |
4153 | +Y.Loader.prototype = { |
4154 | + |
4155 | + FILTER_DEFS: { |
4156 | + RAW: { |
4157 | + 'searchExp': "-min\\.js", |
4158 | + 'replaceStr': ".js" |
4159 | + }, |
4160 | + DEBUG: { |
4161 | + 'searchExp': "-min\\.js", |
4162 | + 'replaceStr': "-debug.js" |
4163 | + } |
4164 | + }, |
4165 | + |
4166 | + SKIN_PREFIX: "skin-", |
4167 | + |
4168 | + _config: function(o) { |
4169 | + |
4170 | + var i, j, val, f; |
4171 | + |
4172 | + // apply config values |
4173 | + if (o) { |
4174 | + for (i in o) { |
4175 | + if (o.hasOwnProperty(i)) { |
4176 | + val = o[i]; |
4177 | + if (i == 'require') { |
4178 | + this.require(val); |
4179 | + } else if (i == 'modules') { |
4180 | + |
4181 | + // add a hash of module definitions |
4182 | + for (j in val) { |
4183 | + if (val.hasOwnProperty(j)) { |
4184 | + this.addModule(val[j], j); |
4185 | + } |
4186 | + } |
4187 | + |
4188 | + } else { |
4189 | + this[i] = val; |
4190 | + } |
4191 | + } |
4192 | + } |
4193 | + } |
4194 | + |
4195 | + // fix filter |
4196 | + f = this.filter; |
4197 | + |
4198 | + if (L.isString(f)) { |
4199 | + f = f.toUpperCase(); |
4200 | + this.filterName = f; |
4201 | + this.filter = this.FILTER_DEFS[f]; |
4202 | + if (f == 'DEBUG') { |
4203 | + this.require('yui-log', 'dump'); |
4204 | + } |
4205 | + } |
4206 | + |
4207 | + }, |
4208 | + |
4209 | + /** |
4210 | + * Returns the skin module name for the specified skin name. If a |
4211 | + * module name is supplied, the returned skin module name is |
4212 | + * specific to the module passed in. |
4213 | + * @method formatSkin |
4214 | + * @param skin {string} the name of the skin |
4215 | + * @param mod {string} optional: the name of a module to skin |
4216 | + * @return {string} the full skin module name |
4217 | + */ |
4218 | + formatSkin: function(skin, mod) { |
4219 | + var s = this.SKIN_PREFIX + skin; |
4220 | + if (mod) { |
4221 | + s = s + "-" + mod; |
4222 | + } |
4223 | + |
4224 | + return s; |
4225 | + }, |
4226 | + |
4227 | + /* |
4228 | + * Reverses <code>formatSkin</code>, providing the skin name and |
4229 | + * module name if the string matches the pattern for skins. |
4230 | + * @method parseSkin |
4231 | + * @param mod {string} the module name to parse |
4232 | + * @return {skin: string, module: string} the parsed skin name |
4233 | + * and module name, or null if the supplied string does not match |
4234 | + * the skin pattern |
4235 | + * |
4236 | + * This isn't being used at the moment |
4237 | + * |
4238 | + */ |
4239 | + // parseSkin: function(mod) { |
4240 | + // |
4241 | + // if (mod.indexOf(this.SKIN_PREFIX) === 0) { |
4242 | + // var a = mod.split("-"); |
4243 | + // return {skin: a[1], module: a[2]}; |
4244 | + // } |
4245 | + // return null; |
4246 | + // }, |
4247 | + |
4248 | + /** |
4249 | + * Adds the skin def to the module info |
4250 | + * @method _addSkin |
4251 | + * @param skin {string} the name of the skin |
4252 | + * @param mod {string} the name of the module |
4253 | + * @param parent {string} parent module if this is a skin of a |
4254 | + * submodule or plugin |
4255 | + * @return {string} the module name for the skin |
4256 | + * @private |
4257 | + */ |
4258 | + _addSkin: function(skin, mod, parent) { |
4259 | + |
4260 | + var name = this.formatSkin(skin), |
4261 | + info = this.moduleInfo, |
4262 | + sinf = this.skin, |
4263 | + ext = info[mod] && info[mod].ext, |
4264 | + mdef, pkg; |
4265 | + |
4266 | + /* |
4267 | + // Add a module definition for the skin rollup css |
4268 | + if (!info[name]) { |
4269 | + this.addModule({ |
4270 | + 'name': name, |
4271 | + 'type': 'css', |
4272 | + 'path': sinf.base + skin + '/' + sinf.path, |
4273 | + //'supersedes': '*', |
4274 | + 'after': sinf.after, |
4275 | + 'rollup': sinf.rollup, |
4276 | + 'ext': ext |
4277 | + }); |
4278 | + } |
4279 | + */ |
4280 | + |
4281 | + // Add a module definition for the module-specific skin css |
4282 | + if (mod) { |
4283 | + name = this.formatSkin(skin, mod); |
4284 | + if (!info[name]) { |
4285 | + mdef = info[mod]; |
4286 | + pkg = mdef.pkg || mod; |
4287 | + this.addModule({ |
4288 | + 'name': name, |
4289 | + 'type': 'css', |
4290 | + 'after': sinf.after, |
4291 | + 'path': (parent || pkg) + '/' + sinf.base + skin + '/' + mod + '.css', |
4292 | + 'ext': ext |
4293 | + }); |
4294 | + } |
4295 | + } |
4296 | + |
4297 | + return name; |
4298 | + }, |
4299 | + |
4300 | + /** Add a new module to the component metadata. |
4301 | + * <dl> |
4302 | + * <dt>name:</dt> <dd>required, the component name</dd> |
4303 | + * <dt>type:</dt> <dd>required, the component type (js or css)</dd> |
4304 | + * <dt>path:</dt> <dd>required, the path to the script from "base"</dd> |
4305 | + * <dt>requires:</dt> <dd>array of modules required by this component</dd> |
4306 | + * <dt>optional:</dt> <dd>array of optional modules for this component</dd> |
4307 | + * <dt>supersedes:</dt> <dd>array of the modules this component replaces</dd> |
4308 | + * <dt>after:</dt> <dd>array of modules the components which, if present, should be sorted above this one</dd> |
4309 | + * <dt>rollup:</dt> <dd>the number of superseded modules required for automatic rollup</dd> |
4310 | + * <dt>fullpath:</dt> <dd>If fullpath is specified, this is used instead of the configured base + path</dd> |
4311 | + * <dt>skinnable:</dt> <dd>flag to determine if skin assets should automatically be pulled in</dd> |
4312 | + * <dt>submodules:</dt> <dd>a has of submodules</dd> |
4313 | + * </dl> |
4314 | + * @method addModule |
4315 | + * @param o An object containing the module data |
4316 | + * @param name the module name (optional), required if not in the module data |
4317 | + * @return {boolean} true if the module was added, false if |
4318 | + * the object passed in did not provide all required attributes |
4319 | + */ |
4320 | + addModule: function(o, name) { |
4321 | + |
4322 | + name = name || o.name; |
4323 | + o.name = name; |
4324 | + |
4325 | + if (!o || !o.name) { |
4326 | + return false; |
4327 | + } |
4328 | + |
4329 | + if (!o.type) { |
4330 | + o.type = JS; |
4331 | + } |
4332 | + |
4333 | + if (!o.path && !o.fullpath) { |
4334 | + // o.path = name + "/" + name + "-min." + o.type; |
4335 | + o.path = _path(name, name, o.type); |
4336 | + } |
4337 | + |
4338 | + o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; |
4339 | + o.requires = o.requires || []; |
4340 | + |
4341 | + |
4342 | + this.moduleInfo[name] = o; |
4343 | + |
4344 | + // Handle submodule logic |
4345 | + var subs = o.submodules, i, l, sup, s, smod, plugins, plug; |
4346 | + if (subs) { |
4347 | + sup = []; |
4348 | + l = 0; |
4349 | + |
4350 | + for (i in subs) { |
4351 | + if (subs.hasOwnProperty(i)) { |
4352 | + s = subs[i]; |
4353 | + s.path = _path(name, i, o.type); |
4354 | + this.addModule(s, i); |
4355 | + sup.push(i); |
4356 | + |
4357 | + if (o.skinnable) { |
4358 | + smod = this._addSkin(this.skin.defaultSkin, i, name); |
4359 | + sup.push(smod.name); |
4360 | + } |
4361 | + |
4362 | + l++; |
4363 | + } |
4364 | + } |
4365 | + |
4366 | + o.supersedes = sup; |
4367 | + o.rollup = (l<4) ? l : Math.min(l-1, 4); |
4368 | + } |
4369 | + |
4370 | + plugins = o.plugins; |
4371 | + if (plugins) { |
4372 | + for (i in plugins) { |
4373 | + if (plugins.hasOwnProperty(i)) { |
4374 | + plug = plugins[i]; |
4375 | + plug.path = _path(name, i, o.type); |
4376 | + plug.requires = plug.requires || []; |
4377 | + // plug.requires.push(name); |
4378 | + this.addModule(plug, i); |
4379 | + if (o.skinnable) { |
4380 | + this._addSkin(this.skin.defaultSkin, i, name); |
4381 | + } |
4382 | + } |
4383 | + } |
4384 | + } |
4385 | + |
4386 | + this.dirty = true; |
4387 | + |
4388 | + return o; |
4389 | + }, |
4390 | + |
4391 | + /** |
4392 | + * Add a requirement for one or more module |
4393 | + * @method require |
4394 | + * @param what {string[] | string*} the modules to load |
4395 | + */ |
4396 | + require: function(what) { |
4397 | + var a = (typeof what === "string") ? arguments : what; |
4398 | + this.dirty = true; |
4399 | + Y.mix(this.required, Y.Array.hash(a)); |
4400 | + }, |
4401 | + |
4402 | + /** |
4403 | + * Returns an object containing properties for all modules required |
4404 | + * in order to load the requested module |
4405 | + * @method getRequires |
4406 | + * @param mod The module definition from moduleInfo |
4407 | + */ |
4408 | + getRequires: function(mod) { |
4409 | + |
4410 | + if (!mod) { |
4411 | + return []; |
4412 | + } |
4413 | + |
4414 | + if (!this.dirty && mod.expanded) { |
4415 | + return mod.expanded; |
4416 | + } |
4417 | + |
4418 | + var i, d=[], r=mod.requires, o=mod.optional, |
4419 | + info=this.moduleInfo, m, j, add; |
4420 | + |
4421 | + for (i=0; i<r.length; i=i+1) { |
4422 | + d.push(r[i]); |
4423 | + m = this.getModule(r[i]); |
4424 | + add = this.getRequires(m); |
4425 | + for (j=0;j<add.length;j=j+1) { |
4426 | + d.push(add[j]); |
4427 | + } |
4428 | + } |
4429 | + |
4430 | + // get the requirements from superseded modules, if any |
4431 | + r=mod.supersedes; |
4432 | + if (r) { |
4433 | + for (i=0; i<r.length; i=i+1) { |
4434 | + d.push(r[i]); |
4435 | + m = this.getModule(r[i]); |
4436 | + add = this.getRequires(m); |
4437 | + for (j=0;j<add.length;j=j+1) { |
4438 | + d.push(add[j]); |
4439 | + } |
4440 | + } |
4441 | + } |
4442 | + |
4443 | + if (o && this.loadOptional) { |
4444 | + for (i=0; i<o.length; i=i+1) { |
4445 | + d.push(o[i]); |
4446 | + add = this.getRequires(info[o[i]]); |
4447 | + for (j=0;j<add.length;j=j+1) { |
4448 | + d.push(add[j]); |
4449 | + } |
4450 | + } |
4451 | + } |
4452 | + |
4453 | + mod.expanded = Y.Object.keys(Y.Array.hash(d)); |
4454 | + return mod.expanded; |
4455 | + }, |
4456 | + |
4457 | + |
4458 | + /** |
4459 | + * Returns a hash of module names the supplied module satisfies. |
4460 | + * @method getProvides |
4461 | + * @param name {string} The name of the module |
4462 | + * @return what this module provides |
4463 | + */ |
4464 | + getProvides: function(name) { |
4465 | + var m = this.getModule(name), o, s; |
4466 | + |
4467 | + if (!m) { |
4468 | + return NOT_FOUND; |
4469 | + } |
4470 | + |
4471 | + if (m && !m.provides) { |
4472 | + o = {}; |
4473 | + s = m.supersedes; |
4474 | + |
4475 | + if (s) { |
4476 | + Y.Array.each(s, function(v) { |
4477 | + Y.mix(o, this.getProvides(v)); |
4478 | + }, this); |
4479 | + } |
4480 | + |
4481 | + o[name] = true; |
4482 | + m.provides = o; |
4483 | + } |
4484 | + |
4485 | + return m.provides; |
4486 | + }, |
4487 | + |
4488 | + |
4489 | + /** |
4490 | + * Calculates the dependency tree, the result is stored in the sorted |
4491 | + * property |
4492 | + * @method calculate |
4493 | + * @param o optional options object |
4494 | + * @param type optional argument to prune modules |
4495 | + */ |
4496 | + calculate: function(o, type) { |
4497 | + if (o || type || this.dirty) { |
4498 | + this._config(o); |
4499 | + this._setup(); |
4500 | + this._explode(); |
4501 | + if (this.allowRollup && !this.combine) { |
4502 | + this._rollup(); |
4503 | + } |
4504 | + this._reduce(); |
4505 | + this._sort(); |
4506 | + |
4507 | + |
4508 | + this.dirty = false; |
4509 | + } |
4510 | + }, |
4511 | + |
4512 | + /** |
4513 | + * Investigates the current YUI configuration on the page. By default, |
4514 | + * modules already detected will not be loaded again unless a force |
4515 | + * option is encountered. Called by calculate() |
4516 | + * @method _setup |
4517 | + * @private |
4518 | + */ |
4519 | + _setup: function() { |
4520 | + |
4521 | + var info = this.moduleInfo, name, i, j, m, o, l, smod; |
4522 | + |
4523 | + // Create skin modules |
4524 | + for (name in info) { |
4525 | + if (info.hasOwnProperty(name)) { |
4526 | + m = info[name]; |
4527 | + if (m && m.skinnable) { |
4528 | + o = this.skin.overrides; |
4529 | + if (o && o[name]) { |
4530 | + for (i=0; i<o[name].length; i=i+1) { |
4531 | + smod = this._addSkin(o[name][i], name); |
4532 | + } |
4533 | + } else { |
4534 | + smod = this._addSkin(this.skin.defaultSkin, name); |
4535 | + } |
4536 | + |
4537 | + m.requires.push(smod); |
4538 | + } |
4539 | + } |
4540 | + } |
4541 | + |
4542 | + l = Y.merge(this.inserted); // shallow clone |
4543 | + |
4544 | + // available modules |
4545 | + if (!this.ignoreRegistered) { |
4546 | + Y.mix(l, GLOBAL_ENV.mods); |
4547 | + } |
4548 | + |
4549 | + |
4550 | + // add the ignore list to the list of loaded packages |
4551 | + if (this.ignore) { |
4552 | + // OU.appendArray(l, this.ignore); |
4553 | + Y.mix(l, Y.Array.hash(this.ignore)); |
4554 | + } |
4555 | + |
4556 | + // expand the list to include superseded modules |
4557 | + for (j in l) { |
4558 | + if (l.hasOwnProperty(j)) { |
4559 | + Y.mix(l, this.getProvides(j)); |
4560 | + } |
4561 | + } |
4562 | + |
4563 | + // remove modules on the force list from the loaded list |
4564 | + if (this.force) { |
4565 | + for (i=0; i<this.force.length; i=i+1) { |
4566 | + if (this.force[i] in l) { |
4567 | + delete l[this.force[i]]; |
4568 | + } |
4569 | + } |
4570 | + } |
4571 | + |
4572 | + |
4573 | + Y.mix(this.loaded, l); |
4574 | + |
4575 | + // this.loaded = l; |
4576 | + |
4577 | + }, |
4578 | + |
4579 | + |
4580 | + /** |
4581 | + * Inspects the required modules list looking for additional |
4582 | + * dependencies. Expands the required list to include all |
4583 | + * required modules. Called by calculate() |
4584 | + * @method _explode |
4585 | + * @private |
4586 | + */ |
4587 | + _explode: function() { |
4588 | + |
4589 | + var r = this.required, m, reqs; |
4590 | + |
4591 | + Y.Object.each(r, function(v, name) { |
4592 | + |
4593 | + m = this.getModule(name); |
4594 | + |
4595 | + var expound = m && m.expound; |
4596 | + |
4597 | + if (m) { |
4598 | + |
4599 | + if (expound) { |
4600 | + r[expound] = this.getModule(expound); |
4601 | + reqs = this.getRequires(r[expound]); |
4602 | + Y.mix(r, Y.Array.hash(reqs)); |
4603 | + } |
4604 | + |
4605 | + reqs = this.getRequires(m); |
4606 | + |
4607 | + Y.mix(r, Y.Array.hash(reqs)); |
4608 | + } |
4609 | + |
4610 | + }, this); |
4611 | + }, |
4612 | + |
4613 | + getModule: function(name) { |
4614 | + |
4615 | + var m = this.moduleInfo[name]; |
4616 | + |
4617 | + // create the default module |
4618 | + // if (!m) { |
4619 | + // m = this.addModule({ext: false}, name); |
4620 | + // } |
4621 | + |
4622 | + return m; |
4623 | + }, |
4624 | + |
4625 | + /** |
4626 | + * Look for rollup packages to determine if all of the modules a |
4627 | + * rollup supersedes are required. If so, include the rollup to |
4628 | + * help reduce the total number of connections required. Called |
4629 | + * by calculate() |
4630 | + * @method _rollup |
4631 | + * @private |
4632 | + */ |
4633 | + _rollup: function() { |
4634 | + var i, j, m, s, rollups={}, r=this.required, roll, |
4635 | + info = this.moduleInfo, rolled, c; |
4636 | + |
4637 | + // find and cache rollup modules |
4638 | + if (this.dirty || !this.rollups) { |
4639 | + for (i in info) { |
4640 | + if (info.hasOwnProperty(i)) { |
4641 | + m = this.getModule(i); |
4642 | + // if (m && m.rollup && m.supersedes) { |
4643 | + if (m && m.rollup) { |
4644 | + rollups[i] = m; |
4645 | + } |
4646 | + } |
4647 | + } |
4648 | + |
4649 | + this.rollups = rollups; |
4650 | + this.forceMap = (this.force) ? Y.Array.hash(this.force) : {}; |
4651 | + } |
4652 | + |
4653 | + // make as many passes as needed to pick up rollup rollups |
4654 | + for (;;) { |
4655 | + rolled = false; |
4656 | + |
4657 | + // go through the rollup candidates |
4658 | + for (i in rollups) { |
4659 | + |
4660 | + if (rollups.hasOwnProperty(i)) { |
4661 | + |
4662 | + // there can be only one, unless forced |
4663 | + if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { |
4664 | + m = this.getModule(i); |
4665 | + s = m.supersedes || []; |
4666 | + roll = false; |
4667 | + |
4668 | + // @TODO remove continue |
4669 | + if (!m.rollup) { |
4670 | + continue; |
4671 | + } |
4672 | + |
4673 | + c = 0; |
4674 | + |
4675 | + // check the threshold |
4676 | + for (j=0;j<s.length;j=j+1) { |
4677 | + |
4678 | + |
4679 | + // if the superseded module is loaded, we can't load the rollup |
4680 | + // unless it has been forced |
4681 | + if (this.loaded[s[j]] && !this.forceMap[s[j]]) { |
4682 | + roll = false; |
4683 | + break; |
4684 | + // increment the counter if this module is required. if we are |
4685 | + // beyond the rollup threshold, we will use the rollup module |
4686 | + } else if (r[s[j]]) { |
4687 | + c++; |
4688 | + roll = (c >= m.rollup); |
4689 | + if (roll) { |
4690 | + break; |
4691 | + } |
4692 | + } |
4693 | + } |
4694 | + |
4695 | + if (roll) { |
4696 | + // add the rollup |
4697 | + r[i] = true; |
4698 | + rolled = true; |
4699 | + |
4700 | + // expand the rollup's dependencies |
4701 | + this.getRequires(m); |
4702 | + } |
4703 | + } |
4704 | + } |
4705 | + } |
4706 | + |
4707 | + // if we made it here w/o rolling up something, we are done |
4708 | + if (!rolled) { |
4709 | + break; |
4710 | + } |
4711 | + } |
4712 | + }, |
4713 | + |
4714 | + /** |
4715 | + * Remove superceded modules and loaded modules. Called by |
4716 | + * calculate() after we have the mega list of all dependencies |
4717 | + * @method _reduce |
4718 | + * @private |
4719 | + */ |
4720 | + _reduce: function() { |
4721 | + var i, j, s, m, r=this.required, type = this.loadType; |
4722 | + for (i in r) { |
4723 | + if (r.hasOwnProperty(i)) { |
4724 | + m = this.getModule(i); |
4725 | + // remove if already loaded |
4726 | + if ((this.loaded[i] && (!this.forceMap[i]) && !this.ignoreRegistered) || (type && m && m.type != type)) { |
4727 | + delete r[i]; |
4728 | + // remove anything this module supersedes |
4729 | + } else { |
4730 | + |
4731 | + s = m && m.supersedes; |
4732 | + if (s) { |
4733 | + for (j=0; j<s.length; j=j+1) { |
4734 | + if (s[j] in r) { |
4735 | + delete r[s[j]]; |
4736 | + } |
4737 | + } |
4738 | + } |
4739 | + } |
4740 | + } |
4741 | + } |
4742 | + }, |
4743 | + |
4744 | + _attach: function() { |
4745 | + // this is the full list of items the YUI needs attached, |
4746 | + // which is needed if some dependencies are already on |
4747 | + // the page without their dependencies. |
4748 | + if (this.attaching) { |
4749 | + Y._attach(this.attaching); |
4750 | + } else { |
4751 | + Y._attach(this.sorted); |
4752 | + } |
4753 | + |
4754 | + // this._pushEvents(); |
4755 | + |
4756 | + }, |
4757 | + |
4758 | + _finish: function() { |
4759 | + _queue.running = false; |
4760 | + this._continue(); |
4761 | + }, |
4762 | + |
4763 | + _onSuccess: function() { |
4764 | + |
4765 | + |
4766 | + this._attach(); |
4767 | + |
4768 | + var skipped = this.skipped, i, f; |
4769 | + |
4770 | + for (i in skipped) { |
4771 | + if (skipped.hasOwnProperty(i)) { |
4772 | + delete this.inserted[i]; |
4773 | + } |
4774 | + } |
4775 | + |
4776 | + this.skipped = {}; |
4777 | + |
4778 | + f = this.onSuccess; |
4779 | + |
4780 | + if (f) { |
4781 | + f.call(this.context, { |
4782 | + msg: 'success', |
4783 | + data: this.data, |
4784 | + success: true |
4785 | + }); |
4786 | + } |
4787 | + |
4788 | + this._finish(); |
4789 | + |
4790 | + }, |
4791 | + |
4792 | + _onFailure: function(o) { |
4793 | + |
4794 | + |
4795 | + this._attach(); |
4796 | + |
4797 | + var f = this.onFailure; |
4798 | + if (f) { |
4799 | + f.call(this.context, { |
4800 | + msg: 'failure: ' + o.msg, |
4801 | + data: this.data, |
4802 | + success: false |
4803 | + }); |
4804 | + } |
4805 | + |
4806 | + this._finish(); |
4807 | + }, |
4808 | + |
4809 | + _onTimeout: function() { |
4810 | + |
4811 | + |
4812 | + this._attach(); |
4813 | + |
4814 | + var f = this.onTimeout; |
4815 | + if (f) { |
4816 | + f.call(this.context, { |
4817 | + msg: 'timeout', |
4818 | + data: this.data, |
4819 | + success: false |
4820 | + }); |
4821 | + } |
4822 | + |
4823 | + this._finish(); |
4824 | + }, |
4825 | + |
4826 | + /** |
4827 | + * Sorts the dependency tree. The last step of calculate() |
4828 | + * @method _sort |
4829 | + * @private |
4830 | + */ |
4831 | + _sort: function() { |
4832 | + |
4833 | + // create an indexed list |
4834 | + var s = Y.Object.keys(this.required), |
4835 | + info = this.moduleInfo, |
4836 | + loaded = this.loaded, |
4837 | + done = {}, |
4838 | + p=0, l, a, b, j, k, moved, doneKey, |
4839 | + |
4840 | + // returns true if b is not loaded, and is required |
4841 | + // directly or by means of modules it supersedes. |
4842 | + requires = Y.cached(function(mod1, mod2) { |
4843 | + |
4844 | + var m = info[mod1], i, r, after, other = info[mod2], s; |
4845 | + |
4846 | + if (loaded[mod2] || !m || !other) { |
4847 | + return false; |
4848 | + } |
4849 | + |
4850 | + r = m.expanded; |
4851 | + after = m.after; |
4852 | + |
4853 | + // check if this module requires the other directly |
4854 | + if (r && Y.Array.indexOf(r, mod2) > -1) { |
4855 | + return true; |
4856 | + } |
4857 | + |
4858 | + // check if this module should be sorted after the other |
4859 | + if (after && Y.Array.indexOf(after, mod2) > -1) { |
4860 | + return true; |
4861 | + } |
4862 | + |
4863 | + // check if this module requires one the other supersedes |
4864 | + s = info[mod2] && info[mod2].supersedes; |
4865 | + if (s) { |
4866 | + for (i=0; i<s.length; i=i+1) { |
4867 | + if (requires(mod1, s[i])) { |
4868 | + return true; |
4869 | + } |
4870 | + } |
4871 | + } |
4872 | + |
4873 | + // external css files should be sorted below yui css |
4874 | + if (m.ext && m.type == CSS && !other.ext && other.type == CSS) { |
4875 | + return true; |
4876 | + } |
4877 | + |
4878 | + return false; |
4879 | + }); |
4880 | + |
4881 | + // keep going until we make a pass without moving anything |
4882 | + for (;;) { |
4883 | + |
4884 | + l = s.length; |
4885 | + moved = false; |
4886 | + |
4887 | + // start the loop after items that are already sorted |
4888 | + for (j=p; j<l; j=j+1) { |
4889 | + |
4890 | + // check the next module on the list to see if its |
4891 | + // dependencies have been met |
4892 | + a = s[j]; |
4893 | + |
4894 | + // check everything below current item and move if we |
4895 | + // find a requirement for the current item |
4896 | + for (k=j+1; k<l; k=k+1) { |
4897 | + doneKey = a + s[k]; |
4898 | + if (!done[doneKey] && requires(a, s[k])) { |
4899 | + |
4900 | + // extract the dependency so we can move it up |
4901 | + b = s.splice(k, 1); |
4902 | + |
4903 | + // insert the dependency above the item that |
4904 | + // requires it |
4905 | + s.splice(j, 0, b[0]); |
4906 | + |
4907 | + // only swap two dependencies once to short circut |
4908 | + // circular dependencies |
4909 | + done[doneKey] = true; |
4910 | + |
4911 | + // keep working |
4912 | + moved = true; |
4913 | + |
4914 | + break; |
4915 | + } |
4916 | + } |
4917 | + |
4918 | + // jump out of loop if we moved something |
4919 | + if (moved) { |
4920 | + break; |
4921 | + // this item is sorted, move our pointer and keep going |
4922 | + } else { |
4923 | + p = p + 1; |
4924 | + } |
4925 | + } |
4926 | + |
4927 | + // when we make it here and moved is false, we are |
4928 | + // finished sorting |
4929 | + if (!moved) { |
4930 | + break; |
4931 | + } |
4932 | + |
4933 | + } |
4934 | + |
4935 | + this.sorted = s; |
4936 | + }, |
4937 | + |
4938 | + _insert: function(source, o, type) { |
4939 | + |
4940 | + |
4941 | + // restore the state at the time of the request |
4942 | + if (source) { |
4943 | + this._config(source); |
4944 | + } |
4945 | + |
4946 | + // build the dependency list |
4947 | + this.calculate(o); // don't include type so we can process CSS and script in |
4948 | + // one pass when the type is not specified. |
4949 | + this.loadType = "js"; |
4950 | + |
4951 | + // if (!type) { |
4952 | + |
4953 | + // var self = this; |
4954 | + |
4955 | + // this._internalCallback = function() { |
4956 | + // var f = self.onCSS; |
4957 | + // if (f) { |
4958 | + // f.call(self.context, Y); |
4959 | + // } |
4960 | + // self._internalCallback = null; |
4961 | + // self._insert(null, null, JS); |
4962 | + // }; |
4963 | + |
4964 | + // // _queue.running = false; |
4965 | + // this._insert(null, null, CSS); |
4966 | + |
4967 | + // return; |
4968 | + // } |
4969 | + |
4970 | + |
4971 | + // set a flag to indicate the load has started |
4972 | + this._loading = true; |
4973 | + |
4974 | + // flag to indicate we are done with the combo service |
4975 | + // and any additional files will need to be loaded |
4976 | + // individually |
4977 | + this._combineComplete = {}; |
4978 | + |
4979 | + |
4980 | + // start the load |
4981 | + this.loadNext(); |
4982 | + |
4983 | + }, |
4984 | + |
4985 | + _continue: function() { |
4986 | + if (!(_queue.running) && _queue.size() > 0) { |
4987 | + _queue.running = true; |
4988 | + _queue.next()(); |
4989 | + } |
4990 | + }, |
4991 | + |
4992 | + /** |
4993 | + * inserts the requested modules and their dependencies. |
4994 | + * <code>type</code> can be "js" or "css". Both script and |
4995 | + * css are inserted if type is not provided. |
4996 | + * @method insert |
4997 | + * @param o optional options object |
4998 | + * @param type {string} the type of dependency to insert |
4999 | + */ |
5000 | + insert: function(o, type) { |
- Updates YUI to 3.0.0
- Some cleanup in FormOverlay