Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix for Issue #2230 #2346

Open
wants to merge 25 commits into from

5 participants

@kentaromiura
Collaborator

had to check if every result is element, otherwise it will break Element.toQueryString

I checked, using Array.forEachMethod, if other methods return typeOf 'array'
and found two other methods other than map, splice and slice.
With this patch I address the clone() but not the flatten() method, because i think the latter should correctly return an array.

@kentaromiura kentaromiura fix for mootools#2230
had to check if every result is element, otherwise it will break Element.toQueryString 

I checked, using Array.forEachMethod, if other methods return typeOf 'array'
and found two other methods other than map, splice and slice.
With this patch I address the clone() but not the flatten() method, because i think the latter should correctly return an array.
6567fa2
Source/Element/Element.js
@@ -198,7 +198,19 @@ if (object[1] == 1) Elements.implement('splice', function(){
}.protect());
Array.forEachMethod(function(method, name){
- Elements.implement(name, method);
+ var wrap;
+
+ if(name in {map:1,splice:1,slice:1,clone:1}){
+ wrap = function(){
+ var result = method.apply(this, arguments);
+ if(typeOf(result) == 'array' && result.every(function(el){return typeOf(el) == 'element';})){
@arian Owner
arian added a note

In which cases do splice, slice and clone not return an array of elements? In that case you can skip this check (which could slow things down).

@arian Owner
arian added a note

when doesn't it return an array with those methods?

@kentaromiura Collaborator

my fault, that checks were to let me test the other Array methods, they can safely be removed now

@arian Owner
arian added a note

For map however you do need it, not for the others :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Source/Element/Element.js
@@ -198,7 +198,19 @@ if (object[1] == 1) Elements.implement('splice', function(){
}.protect());
Array.forEachMethod(function(method, name){
- Elements.implement(name, method);
+ var wrap;
+
+ if(name in {map:1,splice:1,slice:1,clone:1}){
@arian Owner
arian added a note

I'd prefer ({map: 1, …})[name].

@kentaromiura Collaborator

normally I use the in form because on IE, with external object (ActiveX) sometimes just accessing a property or a method can throw an error, since in just check for existence without really access the object it doesn't throw any error, and is just a little faster, in this case I can safely switch to your notation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@arian
Owner

checkout the code standards: https://github.com/mootools/mootools-core/wiki/Syntax-and-Coding-Style-Conventions
Basically:

if (x){

}

var obj = {a: 1, b: 2};
kentaromiura added some commits
@kentaromiura kentaromiura changed the way of checking for the method to apply, using Arian style
added flatten to the list of the method to fix
removed useless always-true checking 
using short-circuit to avoid looking for all the elements if not on map
changed coding standard to adhere to mootools standards (i hope so :P)
96f7bfd
@kentaromiura kentaromiura using a variable to keep track of which method need every element che…
…cked (right now is only map)
f753135
@kentaromiura kentaromiura Saving few bytes b873bee
@arian
Owner

@kentaromiura what's the status on this? Perhaps a few tests?

Cristian Car... added some commits
@kentaromiura
Collaborator

I should add @ibolmo to the discussion, since he was the one opening the ticket #2230
#2230

@ibolmo
Owner

The only special case is map right?

map: possible to return non-elements
slice: all elements
splice: all elements
clone: all elements
flatten: all elements

Then we can reduce the problem to:

['slice', 'splice', 'clone', 'flatten'].forEach(function(method){
    var fn = Array.prototype[method];
    Elements.implement(method, function(){
        return new Elements(fn.apply(this, arguments));
    });
});

Elements.implement('map', function(fn, bind){
    var result = Array.map(this, fn, bind);
    return result.every(Type.isElement)) ? new Elements(result) : result;
});

And add a note in Element.md about map.

@kentaromiura
Collaborator

I just noticed that by using splice you can break the elements collection, passing something else:
http://jsfiddle.net/kentaromiura/YzRkk/
this is obviously a wrong use of Elements.splice, but probably should be taken into consideration.

@ibolmo
Owner

Agreed, but then it'd be another special case to override after map.

@kentaromiura
Collaborator

tested on IE6, it works but it fails on the
expect(typeOf($$('div').splice(1, 2))).toEqual('elements');
test, which returns 'array' instead.
So it needs more works.

@ibolmo
Owner

lol nice.

@ibolmo
Owner

@kentaromiura when you get the chance. can you rebase your commit, and I can review this again

@kentaromiura
Collaborator

This has to be redone properly in a branch, I was a git n00b back then and I used master which has been later pulled and pushed improperly (as I didn't knew git pushes on all branches if you don't specify the correct one).
Should be as simple as to reset to 961d459 but I have to check When I have a chance. :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2012
  1. @kentaromiura

    fix for mootools#2230

    kentaromiura authored
    had to check if every result is element, otherwise it will break Element.toQueryString 
    
    I checked, using Array.forEachMethod, if other methods return typeOf 'array'
    and found two other methods other than map, splice and slice.
    With this patch I address the clone() but not the flatten() method, because i think the latter should correctly return an array.
Commits on Apr 10, 2012
  1. @kentaromiura

    changed the way of checking for the method to apply, using Arian style

    kentaromiura authored
    added flatten to the list of the method to fix
    removed useless always-true checking 
    using short-circuit to avoid looking for all the elements if not on map
    changed coding standard to adhere to mootools standards (i hope so :P)
  2. @kentaromiura

    using a variable to keep track of which method need every element che…

    kentaromiura authored
    …cked (right now is only map)
Commits on Apr 11, 2012
  1. @kentaromiura

    Saving few bytes

    kentaromiura authored
Commits on Aug 8, 2012
  1. add some tests for issue 2230

    Cristian Carlesso authored
    add some tests for issue 2230
Commits on Aug 19, 2012
Commits on Aug 20, 2012
  1. @gonchuki
  2. @ibolmo

    Merge pull request #2410 from gonchuki/small_element_style_optimization

    ibolmo authored
    get rid of useless for..in loop in getStyle
Commits on Aug 21, 2012
  1. @arian
  2. @arian

    Trailing whitepace police

    arian authored
Commits on Aug 22, 2012
  1. @arian

    Merge pull request #2411 from gonchuki/fix_2336

    arian authored
    opacity 1 should not have a nulling effect in oldIE, fixes #2336
Commits on Sep 2, 2012
Commits on Oct 25, 2012
  1. @thatmarvin @kentaromiura

    Add Fx.isPaused() method

    thatmarvin authored kentaromiura committed
  2. @thatmarvin @kentaromiura

    fix #2159: specs for Fx.isPaused()

    thatmarvin authored kentaromiura committed
  3. @thatmarvin @kentaromiura

    fix #2159: whoops extra dot

    thatmarvin authored kentaromiura committed
  4. @ibolmo @kentaromiura

    Moved Fx.isPaused from 1.3 to 1.5 specs.

    ibolmo authored kentaromiura committed
    Updated and created configuration for 1.5 specs.
  5. @ibolmo @kentaromiura

    Hello 1.5.0 dev.

    ibolmo authored kentaromiura committed
  6. @kentaromiura

    adding support for backgroundSize

    Cristian Carlesso authored kentaromiura committed
    adding support for backgroundSize
  7. @kentaromiura

    added test for background size pixel get and set

    Cristian Carlesso authored kentaromiura committed
    added test for background size pixel get and set
  8. @arian @kentaromiura

    Fixes #2327 - Move the Flash Detection to 1.4compat

    arian authored kentaromiura committed
  9. @arian @kentaromiura

    Move Swiff to MooTools More

    arian authored kentaromiura committed
  10. @kentaromiura

    saving a ref in order to remove the unload method

    Cristian Carlesso authored kentaromiura committed
    saving a ref in order to remove the unload method
    add some test
  11. @kentaromiura

    adding a further check

    Cristian Carlesso authored kentaromiura committed
    adding a further check
  12. @arian @kentaromiura

    Better fix for #2296 and #2423 - doesn't wrap onunload functions in a…

    arian authored kentaromiura committed
    …ddListener anymore.
This page is out of date. Refresh to see the latest.
Showing with 302 additions and 379 deletions.
  1. +3 −3 Docs/Element/Element.md
  2. +15 −0 Docs/Fx/Fx.md
  3. +1 −1  Docs/Request/Request.HTML.md
  4. +2 −2 Docs/Slick/Slick.md
  5. +1 −1  Docs/Types/String.md
  6. +0 −90 Docs/Utilities/Swiff.md
  7. +4 −0 Source/Browser/Browser.js
  8. +1 −1  Source/Core/Core.js
  9. +4 −5 Source/Element/Element.Style.js
  10. +24 −12 Source/Element/Element.js
  11. +5 −1 Source/Fx/Fx.js
  12. +0 −113 Source/Utilities/Swiff.js
  13. +1 −1  Specs/1.2/Core/Browser.js
  14. +4 −4 Specs/1.2/Core/Core.js
  15. +1 −1  Specs/1.2/Core/Native.js
  16. +19 −19 Specs/1.2/Element/Element.Dimensions.js
  17. +1 −1  Specs/1.2/Element/Element.Style.js
  18. +5 −5 Specs/1.2/Utilities/Cookie.js
  19. +2 −2 Specs/1.3base/Class/Class.js
  20. +11 −11 Specs/1.3base/Types/Array.js
  21. +1 −1  Specs/1.3base/Types/Object.js
  22. +1 −1  Specs/1.3base/package.yml
  23. +2 −2 Specs/1.3client/Browser/Browser.js
  24. +1 −1  Specs/1.3client/Class/Class.Extras.js
  25. +2 −2 Specs/1.3client/Core/Core.js
  26. +1 −1  Specs/1.3client/Element/Element.Dimensions.js
  27. +25 −25 Specs/1.3client/Element/NewElement.js
  28. +2 −2 Specs/1.3client/Fx/Fx.Morph.js
  29. +5 −5 Specs/1.3client/Fx/Fx.Tween.js
  30. +2 −2 Specs/1.3client/Utilities/Cookie.js
  31. +33 −33 Specs/1.3client/Utilities/DOMReady.php
  32. +1 −1  Specs/1.3client/package.yml
  33. +2 −2 Specs/1.4base/Types/Function-nocompat.js
  34. +1 −1  Specs/1.4client/Element/Element.Event.change.html
  35. +19 −5 Specs/1.4client/Element/Element.Style.js
  36. +8 −8 Specs/1.4client/Element/Element.appendHTML.js
  37. +42 −0 Specs/1.4client/Element/Element.js
  38. +3 −3 Specs/1.4client/Fx/Fx.Morph.js
  39. +1 −2  Specs/1.4client/Fx/Fx.html
  40. +30 −0 Specs/1.5base/Fx/Fx.js
  41. +11 −3 Specs/Configuration.js
  42. +5 −5 Specs/README.md
  43. +0 −1  package.yml
View
6 Docs/Element/Element.md
@@ -640,9 +640,9 @@ Inserts the passed element(s) inside the Element (which will then become the par
var mySecondElement = new Element('p#second');
var myThirdElement = new Element('ul#third');
var myFourthElement = new Element('a#fourth');
-
+
var myParentElement = new Element('div#parent');
-
+
myFirstElement.adopt(mySecondElement);
mySecondElement.adopt(myThirdElement, myFourthElement);
myParentElement.adopt([myFirstElement, new Element('span#another')]);
@@ -1427,7 +1427,7 @@ Sets an attribute or special property for this Element.
- use 'class', not 'className'
- use 'frameborder', not 'frameBorder'
- etc.
-- When setting the `src` property for an image file, be sure to remove the `width` and `height` attribute (use `Element.removeAttribute`). IE7, and less, set and freeze the `width` and `height` of an image if previously specified.
+- When setting the `src` property for an image file, be sure to remove the `width` and `height` attribute (use `Element.removeAttribute`). IE7, and less, set and freeze the `width` and `height` of an image if previously specified.
Element Method: setProperties {#Element:setProperties}
------------------------------------------------------
View
15 Docs/Fx/Fx.md
@@ -182,6 +182,21 @@ Returns true if the animation is running.
+Fx Method: isPaused {#Fx:isPaused}
+------------------------------------
+
+Returns true if the animation is paused. You can use this to check if you need to call [Fx:resume](#Fx:resume) to resume an animation instead of restarting it.
+
+### Syntax:
+
+ var isPaused = myFx.isPaused();
+
+### Returns:
+
+* (*boolean*) - If the animation is paused, returns true. Otherwise, returns false.
+
+
+
[Fx]: #Fx
[Fx.Transitions]: /core/Fx/Fx.Transitions
[Fx.Transitions:sine]: /core/Fx/Fx.Transitions#Fx-Transitions:sine
View
2  Docs/Request/Request.HTML.md
@@ -176,4 +176,4 @@ Updates the content of the Element with a Request.HTML GET request.
[Request]: /core/Request/Request
[$]: /core/Element/Element/#Window:dollar
[Element.Properties]: /core/Element/Element/#Element-Properties
-[Elements:filter]: /core/Element/Element#Elements:filter
+[Elements:filter]: /core/Element/Element#Elements:filter
View
4 Docs/Slick/Slick.md
@@ -240,7 +240,7 @@ Nth Expression:
* nExpression - (string) A nth expression for the "every" nth-child.
### Examples:
-
+
<span id="i1"></span>
<span id="i2"></span>
<span id="i3"></span>
@@ -252,7 +252,7 @@ Nth Expression:
$$(':nth-last-child(2n)'); //Returns Elements #i2 and #i4.
$$(':nth-last-child(2n+1)') //Returns Elements #i1, #i3 and #i5.
-
+
$$(':nth-last-child(3n+2)') //Returns Elements #i1 and #i4.
Every Odd Child (same as 2n+1):
View
2  Docs/Types/String.md
@@ -397,4 +397,4 @@ Strips the String of its *<script>* tags and anything in between them.
[MDC Array]: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array
[String:trim]: #String:trim
[Array:rgbToHex]: /core/Types/Array/#Array:rgbToHex
-[String:trim]: #String:trim
+[String:trim]: #String:trim
View
90 Docs/Utilities/Swiff.md
@@ -1,90 +0,0 @@
-# Class: Swiff {#Swiff}
-
-Creates and returns a Flash object using supplied parameters.
-
-### Syntax:
-
- var mySwiff = new Swiff(path[, options]);
-
-### Arguments:
-
-1. path - (*string*) The path to the SWF file.
-2. options - (*object*, optional) See Options below.
-
-### Options:
-
-* id - (*string*: defaults to 'Swiff\_' + unique id) The id of the SWF object.
-* width - (*number*: defaults to 1) The width of the SWF object.
-* height - (*number*: defaults to 1) The height of the SWF object.
-* container - (*element*) The container the SWF object gets injected in.
-* params - (*object*) Parameters to be passed to the SWF object (wmode, bgcolor, allowScriptAccess, loop, etc.).
- * allowScriptAccess - (*string*: defaults to always) The domain that the SWF object allows access to.
- * quality - (*string*: defaults to 'high') The render quality of the movie.
- * swLiveConnect - (*boolean*: defaults to true) the swLiveConnect parameter to allow remote scripting.
- * wMode - (*string*: defaults to 'window') Changes the way the SWF is displayed in the browser.
-* properties - (*object*) Additional attributes for the object element.
-* vars - (*object*) Vars will be passed to the SWF as query string in flashVars.
-* callBacks - (*object*) Functions to call from the SWF. These will be available globally in the movie, and bound to the object.
-
-### Returns:
-
-* (*element*) A new HTML object element.
-
-### Example:
-
- var obj = new Swiff('myMovie.swf', {
- id: 'myBeautifulMovie',
- width: 500,
- height: 400,
- params: {
- wMode: 'opaque',
- bgcolor: '#ff3300'
- },
- vars: {
- myVariable: myJsVar,
- myVariableString: 'hello'
- },
- callBacks: {
- load: myOnloadFunc
- }
- });
-
-### Note:
-
-1. Although Swiff returns the object, this element will NOT have any [Element][] methods applied to it.
-2. The $ function on an object/embed tag will only return its reference without further processing.
-
-## Swiff Function: remote {#Swiff:remote}
-
-Calls an ActionScript function from JavaScript.
-
-### Syntax:
-
- var result = Swiff.remote(obj, fn[, arg, arg, arg ...]);
-
-### Arguments:
-
-1. obj - (*element*) A Swiff instance (a HTML object element).
-2. fn - (*string*) The function name to execute in the SWF.
-3. arg - (*mixed*) Any number of arguments to pass to the named function.
-
-### Returns:
-
-* (*mixed*) The ActionScript function's result.
-
-### Example:
-
- var obj = new Swiff('myMovie.swf');
- alert(Swiff.remote(obj, 'myFlashFn')); // alerts "This is from the .swf file!".
-
-### Note:
-
-The SWF file must be compiled with the ExternalInterface component. See the Adobe documentation on [External Interface][] for more information.
-
-### Credits:
-
-- Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject][].
-
-[Element]: /core/Element/Element
-[External Interface]: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
-[SWFObject]: http://code.google.com/p/swfobject/
View
4 Source/Browser/Browser.js
@@ -82,6 +82,8 @@ Browser.Request = (function(){
Browser.Features.xhr = !!(Browser.Request);
+//<1.4compat>
+
// Flash detection
var version = (Function.attempt(function(){
@@ -95,6 +97,8 @@ Browser.Plugins.Flash = {
build: Number(version[2]) || 0
};
+//</1.4compat>
+
// String scripts
Browser.exec = function(text){
View
2  Source/Core/Core.js
@@ -23,7 +23,7 @@ provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
(function(){
this.MooTools = {
- version: '1.4.6dev',
+ version: '1.5.0dev',
build: '%build%'
};
View
9 Source/Element/Element.Style.js
@@ -123,10 +123,9 @@ Element.implement({
property = (property == 'float' ? floatName : property).camelCase();
var result = this.style[property];
if (!result || property == 'zIndex'){
- result = [];
- for (var style in Element.ShortStyles){
- if (property != style) continue;
- for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s));
+ if (Element.ShortStyles.hasOwnProperty(property)){
+ result = [];
+ for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
return result.join(' ');
}
result = this.getComputedStyle(property);
@@ -180,7 +179,7 @@ Element.implement({
Element.Styles = {
left: '@px', top: '@px', bottom: '@px', right: '@px',
width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
- backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
+ backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
View
36 Source/Element/Element.js
@@ -198,7 +198,21 @@ if (object[1] == 1) Elements.implement('splice', function(){
}.protect());
Array.forEachMethod(function(method, name){
- Elements.implement(name, method);
+ var wrap, kind = ({map: 2, splice: 1, slice: 1, clone: 1, flatten: 1})[name];
+
+ if (kind){
+ wrap = function(){
+ var result = method.apply(this, arguments);
+ if (kind == 1 || result.every(function(el){
+ return typeOf(el) == 'element';
+ })){
+ result = new Elements(result);
+ }
+ return result;
+ };
+ }
+
+ Elements.implement(name, wrap || method);
});
Array.mirror(Elements);
@@ -898,13 +912,7 @@ Element.implement({
[Element, Window, Document].invoke('implement', {
addListener: function(type, fn){
- if (type == 'unload'){
- var old = fn, self = this;
- fn = function(){
- self.removeListener('unload', fn);
- old();
- };
- } else if (window.attachEvent && !window.addEventListener){
+ if (window.attachEvent && !window.addEventListener){
collected[Slick.uidOf(this)] = this;
}
if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
@@ -939,10 +947,14 @@ Element.implement({
});
/*<ltIE9>*/
-if (window.attachEvent && !window.addEventListener) window.addListener('unload', function(){
- Object.each(collected, clean);
- if (window.CollectGarbage) CollectGarbage();
-});
+if (window.attachEvent && !window.addEventListener){
+ var gc = function(){
+ Object.each(collected, clean);
+ if (window.CollectGarbage) CollectGarbage();
+ window.removeListener('unload', gc);
+ }
+ window.addListener('unload', gc);
+}
/*</ltIE9>*/
Element.Properties = {};
View
6 Source/Fx/Fx.js
@@ -130,13 +130,17 @@ var Fx = this.Fx = new Class({
},
resume: function(){
- if ((this.frame < this.frames) && !this.isRunning()) pushInstance.call(this, this.options.fps);
+ if (this.isPaused()) pushInstance.call(this, this.options.fps);
return this;
},
isRunning: function(){
var list = instances[this.options.fps];
return list && list.contains(this);
+ },
+
+ isPaused: function(){
+ return (this.frame < this.frames) && !this.isRunning();
}
});
View
113 Source/Utilities/Swiff.js
@@ -1,113 +0,0 @@
-/*
----
-
-name: Swiff
-
-description: Wrapper for embedding SWF movies. Supports External Interface Communication.
-
-license: MIT-style license.
-
-credits:
- - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
-
-requires: [Options, Object, Element]
-
-provides: Swiff
-
-...
-*/
-
-(function(){
-
-var Swiff = this.Swiff = new Class({
-
- Implements: Options,
-
- options: {
- id: null,
- height: 1,
- width: 1,
- container: null,
- properties: {},
- params: {
- quality: 'high',
- allowScriptAccess: 'always',
- wMode: 'window',
- swLiveConnect: true
- },
- callBacks: {},
- vars: {}
- },
-
- toElement: function(){
- return this.object;
- },
-
- initialize: function(path, options){
- this.instance = 'Swiff_' + String.uniqueID();
-
- this.setOptions(options);
- options = this.options;
- var id = this.id = options.id || this.instance;
- var container = document.id(options.container);
-
- Swiff.CallBacks[this.instance] = {};
-
- var params = options.params, vars = options.vars, callBacks = options.callBacks;
- var properties = Object.append({height: options.height, width: options.width}, options.properties);
-
- var self = this;
-
- for (var callBack in callBacks){
- Swiff.CallBacks[this.instance][callBack] = (function(option){
- return function(){
- return option.apply(self.object, arguments);
- };
- })(callBacks[callBack]);
- vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
- }
-
- params.flashVars = Object.toQueryString(vars);
- if (Browser.ie){
- properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
- params.movie = path;
- } else {
- properties.type = 'application/x-shockwave-flash';
- }
- properties.data = path;
-
- var build = '<object id="' + id + '"';
- for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
- build += '>';
- for (var param in params){
- if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
- }
- build += '</object>';
- this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
- },
-
- replaces: function(element){
- element = document.id(element, true);
- element.parentNode.replaceChild(this.toElement(), element);
- return this;
- },
-
- inject: function(element){
- document.id(element, true).appendChild(this.toElement());
- return this;
- },
-
- remote: function(){
- return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
- }
-
-});
-
-Swiff.CallBacks = {};
-
-Swiff.remote = function(obj, fn){
- var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
- return eval(rs);
-};
-
-})();
View
2  Specs/1.2/Core/Browser.js
@@ -37,4 +37,4 @@ describe('Window', {
expect($defined(window.Element.prototype)).toBeTruthy();
}
-});
+});
View
8 Specs/1.2/Core/Core.js
@@ -240,7 +240,7 @@ describe('$time', {
'should return a timestamp': function(){
expect(Number.type($time())).toBeTruthy();
},
-
+
'should be within a reasonable range': function(){
expect($time() < 1e13 && $time() > 1e12).toBeTruthy();
}
@@ -318,7 +318,7 @@ describe('$type', {
expect(type == 'array' || type == 'arguments').toBeTruthy();
return;
}
-
+
expect($type(arguments)).toEqual('arguments');
},
@@ -338,11 +338,11 @@ describe('$type', {
var div = document.createElement('div');
expect($type(div)).toEqual('element');
},
-
+
"should return 'array' for Elements": function(){
expect($type(new Elements)).toEqual('array');
},
-
+
"should return 'window' for the window object": function(){
expect($type(window)).toEqual('window');
},
View
2  Specs/1.2/Core/Native.js
@@ -66,4 +66,4 @@ describe('Native (private)', {
});
-})();
+})();
View
38 Specs/1.2/Element/Element.Dimensions.js
@@ -28,7 +28,7 @@ describe('Element.Dimensions', function(){
zIndex: 1
}
}).inject($(document.body));
-
+
relDiv = new Element('div', {
styles: {
width: 50,
@@ -43,7 +43,7 @@ describe('Element.Dimensions', function(){
'display': 'inline'
}
}).inject(div);
-
+
absDiv = new Element('div', {
styles: {
width: 10,
@@ -58,7 +58,7 @@ describe('Element.Dimensions', function(){
overflow: 'hidden'
}
}).inject(relDiv);
-
+
scrollDiv = new Element('div', {
styles: {
width: 100,
@@ -70,7 +70,7 @@ describe('Element.Dimensions', function(){
left: 0
}
}).inject($(document.body));
-
+
tallDiv = new Element('div', {
styles: {
width: 200,
@@ -81,50 +81,50 @@ describe('Element.Dimensions', function(){
});
describe('Element.getSize', function(){
-
+
it('should measure the width and height of the element', function(){
expect(div.getSize().x).toEqual(108);
expect(div.getSize().y).toEqual(108);
});
-
+
});
-
+
describe('Element.getPosition', function(){
-
+
it('should measure the x and y position of the element', function(){
expect(div.getPosition()).toEqual({x: 102, y: 102});
});
-
+
it('should measure the x and y position of the element relative to another', function(){
expect(relDiv.getPosition(div)).toEqual({x: 8, y: 8});
});
-
+
});
describe('Element.getCoordinates', function(){
-
+
it('should return the coordinates relative to parent', function(){
expect(absDiv.getCoordinates(relDiv)).toEqual({left:15, top:15, width:22, height:22, right:37, bottom:37});
});
-
+
});
-
+
describe('Element.getScrollSize', function(){
-
+
it('should return the scrollSize', function(){
expect(scrollDiv.getScrollSize()).toEqual({x:200, y:200});
});
-
+
});
-
+
describe('Element.scrollTo', function(){
-
+
it('should scroll the element', function(){
expect(scrollDiv.scrollTo(20, 20).getScroll()).toEqual({x:20, y:20});
});
-
+
});
-
+
afterEach(function(){
[div, relDiv, absDiv, scrollDiv, tallDiv].each(function(el){
$(el).destroy();
View
2  Specs/1.2/Element/Element.Style.js
@@ -84,4 +84,4 @@ describe('Element.setStyles', {
expect(new Element('div').setStyles({'list-style-type':'square', 'color':'#00ff00'}).getStyles('list-style-type', 'color')).toEqual({'list-style-type':'square', color:'#00ff00'});
}
-});
+});
View
10 Specs/1.2/Utilities/Cookie.js
@@ -7,11 +7,11 @@ License:
*/
describe('Cookie', {
-
+
"should set a cookie": function(){
Cookie.write('test', 1);
-
-
+
+
}
-
-});
+
+});
View
4 Specs/1.3base/Class/Class.js
@@ -263,7 +263,7 @@ describe('Class toString', function(){
var Italian = new Class({
Extends: Person,
-
+
toString: function(){
return "It's me, " + this.name;
}
@@ -277,4 +277,4 @@ describe('Class toString', function(){
});
-})();
+})();
View
22 Specs/1.3base/Types/Array.js
@@ -7,7 +7,7 @@ provides: [Array.Specs]
...
*/
(function(){
-
+
var getTestArray = function(){
var a = [0, 1, 2, 3];
delete a[1];
@@ -41,14 +41,14 @@ describe("Array Methods 1.3", {
var arr = array.concat([false, null, 4]).filter(Type.isNumber);
expect(arr).toEqual(array.concat(4));
},
-
+
'filter should skip deleted elements': function(){
var i = 0;
getTestArray().filter(function(){
i++;
return true;
});
-
+
expect(i).toEqual(2);
},
@@ -75,10 +75,10 @@ describe("Array Methods 1.3", {
getTestArray().map(function(){
return i++;
});
-
+
expect(i).toEqual(2);
},
-
+
// Array.every
'should return true if every item matches the comparator, otherwise false': function(){
@@ -86,14 +86,14 @@ describe("Array Methods 1.3", {
expect(['1',2,3,0].every(Type.isNumber)).toBeFalsy();
},
-
+
'every should skip deleted elements': function(){
var i = 0;
getTestArray().every(function(){
i++;
return true;
});
-
+
expect(i).toEqual(2);
},
@@ -104,18 +104,18 @@ describe("Array Methods 1.3", {
expect([1,2,3,0,0,0].map(String).some(Type.isNumber)).toBeFalsy();
},
-
+
'some should skip deleted elements': function(){
var i = 0;
var a = getTestArray();
delete a[0];
-
+
// skips the first three elements
a.some(function(value, index){
i = index;
return true;
});
-
+
expect(i).toEqual(3);
},
@@ -268,4 +268,4 @@ describe('Array.pick', function(){
});
-})();
+})();
View
2  Specs/1.3base/Types/Object.js
@@ -125,4 +125,4 @@ describe('Object.getLength', function(){
});
-})();
+})();
View
2  Specs/1.3base/package.yml
@@ -12,4 +12,4 @@ sources:
- "Types/Function.js"
- "Types/Object.js"
- "Class/Class.js"
- - "Fx/Fx.js"
+ - "Fx/Fx.js"
View
4 Specs/1.3client/Browser/Browser.js
@@ -12,9 +12,9 @@ describe('Browser', {
'should think it is executed in a browser': function(){
expect(Browser.ie || Browser.safari || Browser.chrome || Browser.firefox || Browser.opera).toEqual(true);
},
-
+
'should assume the IE version is emulated by the documentMode (X-UA-Compatible)': function(){
if (Browser.ie && document.documentMode) expect(Browser.version).toEqual(document.documentMode);
}
-});
+});
View
2  Specs/1.3client/Class/Class.Extras.js
@@ -180,4 +180,4 @@ runEventSpecs('element', function(){
return new Element('div');
});
-})();
+})();
View
4 Specs/1.3client/Core/Core.js
@@ -44,7 +44,7 @@ describe('Array.from', function(){
var array = Array.from(div1.getElementsByTagName('*'));
expect(Type.isArray(array)).toEqual(true);
});
-
+
it('should return an array for an Options collection', function(){
var div = document.createElement('div');
div.innerHTML = '<select><option>a</option></select>';
@@ -53,4 +53,4 @@ describe('Array.from', function(){
expect(Type.isArray(array)).toEqual(true);
});
-});
+});
View
2  Specs/1.3client/Element/Element.Dimensions.js
@@ -28,7 +28,7 @@ describe('Element.getOffsetParent', function(){
td = new Element('td').inject(new Element('tr').inject(table));
container.inject(document.body);
-
+
});
it('Should return the right offsetParent', function(){
View
50 Specs/1.3client/Element/NewElement.js
@@ -8,105 +8,105 @@ provides: [NewElement.Specs]
*/
describe('new Element(expression)', function(){
-
+
it('should create a new div element', function(){
var div = new Element('div');
-
+
expect(div.tagName.toLowerCase()).toEqual('div');
expect(!div.className && div.className.length == 0).toBeTruthy();
expect(!div.id && div.id.length == 0).toBeTruthy();
expect(typeOf(div)).toEqual('element');
});
-
+
it('should create a new element with id and class', function(){
var p = new Element('p', {
id: 'myParagraph',
'class': 'test className'
});
-
+
expect(p.tagName.toLowerCase()).toEqual('p');
expect(p.className).toEqual('test className');
});
-
+
it('should create a new element with id and class from css expression', function(){
var p = new Element('p#myParagraph.test.className');
-
+
expect(p.tagName.toLowerCase()).toEqual('p');
expect(p.className).toEqual('test className');
});
-
+
it('should create attributes from css expression', function(){
var input = new Element('input[type=text][readonly=true][value=Some Text]');
-
+
expect(input.tagName.toLowerCase()).toEqual('input');
expect(input.type).toEqual('text');
expect(input.readOnly).toEqual(true);
expect(input.value).toEqual('Some Text');
});
-
+
it('should overwrite ids and classes', function(){
var div = new Element('div#myDiv.myClass', {
id: 'myOverwrittenId',
'class': 'overwrittenClass'
});
-
+
expect(div.tagName.toLowerCase()).toEqual('div');
expect(div.id).toEqual('myOverwrittenId');
expect(div.className).toEqual('overwrittenClass');
});
-
+
it('should overwrite attributes', function(){
var a = new Element('a[href=http://dojotoolkit.org/]', {
href: 'http://mootools.net/'
});
-
+
expect(a.tagName.toLowerCase()).toEqual('a');
expect(a.href).toEqual('http://mootools.net/');
});
-
+
it('should reset attributes and classes with empty string', function(){
var div = new Element('div#myDiv.myClass', {
id: '',
'class': ''
});
-
+
expect(div.tagName.toLowerCase()).toEqual('div');
expect(div.id).toEqual('');
expect(div.className).toEqual('');
});
-
+
it('should not reset attributes and classes with null', function(){
var div = new Element('div#myDiv.myClass', {
id: null,
'class': null
});
-
+
expect(div.tagName.toLowerCase()).toEqual('div');
expect(div.id).toEqual('myDiv');
expect(div.className).toEqual('myClass');
});
-
+
it('should not reset attributes and classes with undefined', function(){
var div = new Element('div#myDiv.myClass', {
id: undefined,
'class': undefined
});
-
+
expect(div.tagName.toLowerCase()).toEqual('div');
expect(div.id).toEqual('myDiv');
expect(div.className).toEqual('myClass');
});
-
+
it('should fall back to a div tag', function(){
var someElement = new Element('#myId');
-
+
expect(someElement.tagName.toLowerCase()).toEqual('div');
expect(someElement.id).toEqual('myId');
});
-
+
it('should allow zero (0) values', function(){
var table = new Element('table[cellpadding=0]');
-
+
expect(table.tagName.toLowerCase()).toEqual('table');
expect(table.cellPadding == 0).toBeTruthy();
});
@@ -121,8 +121,8 @@ describe('new Element(expression)', function(){
type: 'checkbox',
checked: false
});
-
+
expect(input.checked).toEqual(false);
});
-
-});
+
+});
View
4 Specs/1.3client/Fx/Fx.Morph.js
@@ -7,11 +7,11 @@ provides: [Fx.Morph.Specs]
...
*/
describe('Fx.Morph', function(){
-
+
beforeEach(function(){
this.clock = sinon.useFakeTimers();
});
-
+
afterEach(function(){
this.clock.reset();
this.clock.restore();
View
10 Specs/1.3client/Fx/Fx.Tween.js
@@ -7,11 +7,11 @@ provides: [Fx.Tween.Specs]
...
*/
describe('Fx.Tween', function(){
-
+
beforeEach(function(){
this.clock = sinon.useFakeTimers();
});
-
+
afterEach(function(){
this.clock.reset();
this.clock.restore();
@@ -29,9 +29,9 @@ describe('Fx.Tween', function(){
duration: 100,
property: 'height'
});
-
+
fx.start(10, 50);
-
+
this.clock.tick(200);
expect(element.offsetHeight).toEqual(50);
@@ -118,7 +118,7 @@ describe('Fx.Tween', function(){
element.highlight('#f00');
this.clock.tick(40);
-
+
expect(['#fff', '#ffffff']).toContain(element.getStyle('background-color').toLowerCase());
element.destroy();
View
4 Specs/1.3client/Utilities/Cookie.js
@@ -12,7 +12,7 @@ describe('Cookie', function(){
var options = {
duration: 1
};
-
+
Cookie.write('key', 'value', options);
expect(Cookie.read('key', options)).toBe('value');
@@ -22,4 +22,4 @@ describe('Cookie', function(){
expect(Cookie.read('key', options)).toBeNull();
});
-});
+});
View
66 Specs/1.3client/Utilities/DOMReady.php
@@ -4,17 +4,17 @@ function getCurrentURL(){
$pageURL = 'http' . (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? 's' : '');
$pageURL .= "://" . $_SERVER["SERVER_NAME"];
if ($_SERVER["SERVER_PORT"] != "80") $pageURL .= ":".$_SERVER["SERVER_PORT"];
-
+
return $pageURL.$_SERVER["REQUEST_URI"];
}
// http://forum.jquery.com/topic/implementation-of-domcontentloaded-failing-when-no-assets
// by andrea.giammarchi on 13-Jul-2008 10:21 PM
function flushPause($pause = 0){
- echo ob_get_clean();
- @ob_flush();
- flush();
- usleep($pause * 1000000);
+ echo ob_get_clean();
+ @ob_flush();
+ flush();
+ usleep($pause * 1000000);
}
ob_start();
@@ -36,17 +36,17 @@ function flushPause($pause = 0){
function somethingHappened(id, result){
if (window.ONLOAD) document.body.insertBefore(MESSAGES, document.body.firstChild)
-
+
if (typeof result == 'function') result = result()
if (result == null) result = ''
if (result === true) result = 'PASS'
if (result === false) result = 'FAIL'
-
+
if (thingsThatHappened[id] === result) return
thingsThatHappened[id] = result
-
+
log((+new Date - START_TIME) +' '+ id + ' ' + result)
-
+
MESSAGES.innerHTML
+= '<p id="' + id + '" class="' + result + '">'
+ '<b>' + (+new Date - START_TIME) + 'ms </b>'
@@ -109,7 +109,7 @@ function DomReady(fn){
window.addEvent('load', function(){
loadScript('load');
-
+
window.LOADED = true
somethingHappened('<i>MooTools load</i>', function(){
return !!window.READY
@@ -184,7 +184,7 @@ function DomReady(fn){
function pollDoScroll(){
if (!TEST_ELEMENT.doScroll) return
var PASS
-
+
try {
TEST_ELEMENT.doScroll('left')
PASS = true
@@ -192,17 +192,17 @@ function pollDoScroll(){
catch (e){
PASS = false
}
-
+
window.CANSCROLL = PASS
somethingHappened('TEST_ELEMENT.doScroll()', PASS)
-
+
if (!PASS) setTimeout(pollDoScroll, 10)
}
function pollDoScroll_body(){
if (!document.body.doScroll) return
var PASS
-
+
try {
document.body.doScroll('left')
PASS = true
@@ -210,9 +210,9 @@ function pollDoScroll_body(){
catch (e){
PASS = false
}
-
+
somethingHappened('document.body.doScroll()', PASS)
-
+
if (!PASS) setTimeout(pollDoScroll_body, 10)
}
@@ -228,7 +228,7 @@ function pollReadyState(){
function pollBodyExists(){
var PASS
-
+
try {
document.body.lastChild
PASS = true
@@ -245,7 +245,7 @@ function pollAugmentBody(){
, body = document.body
, root = body.parentNode
, sibling = body.nextSibling
-
+
try {
body.appendChild(document.createTextNode( new Date - START_TIME + 'ms:Body ') )
PASS = true
@@ -261,15 +261,15 @@ function pollAugmentBody(){
var readyTests = {
"document.readyState ==": function(){return document.readyState}
-
+
,'document.body exists?': function(){return document.body ?'Yes':'No'}
-
+
,"All page content loaded and parsed?": function(){return window.PARSED ?'Yes':'No'}
,"cached IMG onload fired?": function(){return window.IMG_ONLOAD ?'Yes':'No'}
,"uncached IMG onload fired?": function(){return window.IMG_ONLOAD_UNCACHED ?'Yes':'No'}
,"document ready?": function(){return !!window.READY ?'Yes':'No'}
,"onload fired?": function(){return !!window.ONLOAD ?'Yes':'No'}
-
+
,"el.doScroll()": function(){
try {
TEST_ELEMENT.doScroll()
@@ -279,7 +279,7 @@ function pollAugmentBody(){
return 'No'
}
}
-
+
,"body.doScroll('left')": function(){
try {
document.body.doScroll('left')
@@ -289,11 +289,11 @@ function pollAugmentBody(){
return 'No'
}
}
-
+
,'isFramed?': function(){
return isFramed() ?'Yes':'No'
}
-
+
,'Is top frame?': function(){
return window.window === window.top ?'Yes':'No'
}
@@ -318,29 +318,29 @@ function poll(){
var results = {}
, lastResults = readyTestResults[readyTestResults.length - 1] || {}
, hasDifferentResults = 0
-
+
results.ms = new Date - START_TIME
-
+
for (var id in readyTests){
results[id] = readyTests[id]()
if (results[id] == lastResults[id]) continue
-
+
++ hasDifferentResults
somethingHappened(id, results[id])
}
-
+
var shouldBeReady
-
+
if (window.CANSCROLL && !isFramed()) shouldBeReady = true
if ({loaded:1,complete:1}[document.readyState]) shouldBeReady = true
if (window.LOADED) shouldBeReady = true
if (window.IMG_ONLOAD_UNCACHED) shouldBeReady = true
-
+
if (shouldBeReady)
somethingHappened('Should be Ready!', function(){
return !!window.READY ?true:'Not yet...'
})
-
+
if (hasDifferentResults) readyTestResults.push(results)
if (!window.ONLOAD) setTimeout(poll, 10)
else report()
@@ -358,7 +358,7 @@ function isFramed(){
function report(){
var EL = document.createElement('div')
, HTML = '<table class=results>'
-
+
for (var i = 0; i < readyTestResults.length; ++i){
if (i == 0){
HTML += '<thead><tr>'
@@ -378,7 +378,7 @@ function report(){
}
HTML += '</tr>'
}
-
+
EL.innerHTML = HTML
document.body.insertBefore(EL, document.body.firstChild)
}
View
2  Specs/1.3client/package.yml
@@ -23,4 +23,4 @@ sources:
- "Request/Request.HTML.js"
- "Request/Request.JSON.js"
- "Utilities/Cookie.js"
- - "Utilities/JSON.js"
+ - "Utilities/JSON.js"
View
4 Specs/1.4base/Types/Function-nocompat.js
@@ -18,8 +18,8 @@ describe('Function.bind', function(){
var fn = function(){
return [this.foo].concat(Array.slice(arguments));
};
-
- expect(fn.bind({foo: 'bar'})()).toEqual(['bar'])
+
+ expect(fn.bind({foo: 'bar'})()).toEqual(['bar']);
expect(fn.bind({foo: 'bar'}, 'first').call({foo: 'yeah!'}, 'yooo')).toEqual(['bar', 'first', 'yooo']);
var bound = fn.bind({foo: 'bar'});
View
2  Specs/1.4client/Element/Element.Event.change.html
@@ -123,7 +123,7 @@
log('change bubbles', true);
});
</script>
-
+
</div>
</body>
View
24 Specs/1.4client/Element/Element.Style.js
@@ -155,7 +155,7 @@ describe('Element.Style', function(){
});
});
-
+
describe('getStyle border after setStyle', function(){
it('should have same order when getting a previously set border', function(){
@@ -172,7 +172,21 @@ describe('Element.Style', function(){
});
});
-
+
+ describe('set/getStyle background-size', function(){
+
+ it('should return the correct pixel size', function(){
+ var foo = new Element('div', {
+ styles: {
+ backgroundSize: '44px'
+ }
+ });
+ foo.setStyle('background-size', 20);​
+ expect(foo.getStyle('backgroundSize')).toEqual('20px');
+ });
+
+ });
+
describe('getStyle background-position', function(){
beforeEach(function(){
var className = 'getStyleBackgroundPosition';
@@ -201,17 +215,17 @@ describe('Element.Style', function(){
this.element.destroy();
this.element = null;
});
-
+
it('should have non-empty background-position shorthand', function(){
expect(this.element.getStyle('background-position')).not.toEqual(null);
expect(this.element.getStyle('background-position')).toMatch(/\w+/);
});
-
+
it('should not return a keyword-based background-position shorthand', function(){
expect(this.element.getStyle('background-position')).not.toMatch(/(top|right|bottom|left)/);
expect(this.element.getStyle('background-position')).toEqual('0% 100%');
});
-
+
it('should have non-empty background-position on an element with no set styles', function(){
var element = new Element('div');
expect(element.getStyle('background-position')).not.toEqual(null);
View
16 Specs/1.4client/Element/Element.appendHTML.js
@@ -42,7 +42,7 @@ describe('Element.appendHTML', function(){
expect(children.length).toBe(2);
children.each(function(child, i){
- expect(child.innerText).toBe('HI!');
+ expect(child.get('text')).toBe('HI!');
expect(child.nextSibling.getAttribute('rel')).toBe('' + i);
});
});
@@ -55,7 +55,7 @@ describe('Element.appendHTML', function(){
expect(children.length).toBe(2);
children.each(function(child, i){
- expect(child.innerText).toBe('HI!');
+ expect(child.get('text')).toBe('HI!');
expect(child.previousSibling.getAttribute('rel')).toBe('' + i);
});
});
@@ -68,9 +68,9 @@ describe('Element.appendHTML', function(){
expect(children.length).toBe(2);
expect(children.each(function(child, i){
- expect(child.innerText).toBe('HI!');
+ expect(child.get('text')).toBe('HI!');
expect(child.parentNode.getAttribute('rel')).toBe('' + i);
- expect(child.parentNode.innerText).toBe('contentHI!');
+ expect(child.parentNode.get('text')).toBe('contentHI!');
}));
});
@@ -82,9 +82,9 @@ describe('Element.appendHTML', function(){
expect(children.length).toBe(2);
children.each(function(child, i){
- expect(child.innerText).toBe('HI!');
+ expect(child.get('text')).toBe('HI!');
expect(child.parentNode.getAttribute('rel')).toBe('' + i);
- expect(child.parentNode.innerText).toBe('HI!content');
+ expect(child.parentNode.get('text')).toBe('HI!content');
});
});
@@ -96,9 +96,9 @@ describe('Element.appendHTML', function(){
expect(children.length).toBe(2);
children.each(function(child, i){
- expect(child.innerText).toBe('HI!');
+ expect(child.get('text')).toBe('HI!');
expect(child.parentNode.getAttribute('rel')).toBe('' + i);
- expect(child.parentNode.innerText).toBe('contentHI!');
+ expect(child.parentNode.get('text')).toBe('contentHI!');
});
});
View
42 Specs/1.4client/Element/Element.js
@@ -7,9 +7,51 @@ provides: [Element.Event.Specs]
...
*/
describe('Element', function(){
+ it('should returns an Elements instance on slice / splice / map methods', function(){
+ var div = new Element('div',{
+ html:[
+ '<div>1</div>',
+ '<div>2</div>',
+ '<div>3</div>',
+ '<div>4</div>',
+ '<div>5</div>',
+ '<span class="whatever"><b></b><b></b></span>',
+ '<span class="whatever"><b></b><b></b></span>',
+ '<span class="whatever"><b></b><b></b></span>',
+ '<span class="whatever"><b></b><b></b></span>'].join('')
+ });
+ div.inject(document.documentElement);
+
+ expect(typeOf($$('div').map(function(el){
+ return el;
+ }))).toEqual('elements');
+
+ /* map for anything else than Elements will return an array */
+ expect(typeOf($$('div').map(function(el){
+ return '';
+ }))).toEqual('array');
+
+ expect(typeOf($$('div').append($$('div')))).toEqual('elements');
+ expect(typeOf($$('div').combine($$('div')))).toEqual('elements');
+ expect(typeOf($$('div').slice(3, 2))).toEqual('elements');
+ expect(typeOf($$('div').splice(1, 2))).toEqual('elements');
+ expect(typeOf($$('div').flatten())).toEqual('elements');
+ expect(typeOf($$('.whatever').getElements('b').flatten())).toEqual('array');
+ expect(typeOf($$('.whatever')[0].getElements('b').flatten())).toEqual('elements');
+ div.destroy();
+ });
describe('Element.getProperty', function(){
+ it('should remove the onunload method', function(){
+ var text;
+ var handler = function(){ text = 'nope'; };
+ window.addEvent('unload', handler);
+ window.removeEvent('unload', handler);
+ window.fireEvent('unload');
+ expect(text).toBe(undefined);
+ });
+
it('should get the attrubte of a form when the form has an input with as ID the attribute name', function(){
var div = new Element('div');
div.innerHTML = '<form action="s"><input id="action"></form>';
View
6 Specs/1.4client/Fx/Fx.Morph.js
@@ -37,7 +37,7 @@ describe('Fx.Morph', function(){
expect(this.div.setStyle).toHaveBeenCalledWith('left', ['10%']);
expect(this.div.setStyle).toHaveBeenCalledWith('left', ['50%']);
});
-
+
it('it should morph when the unit option is set, but an empty value', function(){
this.div.set('morph', {
@@ -49,7 +49,7 @@ describe('Fx.Morph', function(){
});
this.clock.tick(150);
-
+
expect(this.div.getStyle('top')).toEqual('100px');
expect(this.div.getStyle('opacity')).toEqual(1);
@@ -69,7 +69,7 @@ describe('Fx.Morph', function(){
});
this.clock.tick(150);
-
+
expect(this.div.getStyle('top')).toEqual('100px');
expect(this.div.getStyle('opacity')).toEqual(1);
View
3  Specs/1.4client/Fx/Fx.html
@@ -164,7 +164,7 @@
<p>
<a href="#" id="fx-sun">start</a>
</p>
-
+
<div id="sun" class="box"></div>
<style>
@@ -262,4 +262,3 @@ <h1 id="fade2" class="box">test</h1>
</body>
</html>
-
View
30 Specs/1.5base/Fx/Fx.js
@@ -0,0 +1,30 @@
+
+describe('Fx', function(){
+
+ beforeEach(function(){
+ this.clock = sinon.useFakeTimers();
+ });
+
+ afterEach(function(){
+ this.clock.reset();
+ this.clock.restore();
+ });
+
+ it('should return the paused state', function(){
+ var fx = new Fx({
+ duration: 50
+ }).start();
+
+ expect(fx.isPaused()).toEqual(false);
+
+ this.clock.tick(30);
+ fx.pause();
+
+ expect(fx.isPaused()).toEqual(true);
+
+ fx.resume();
+ this.clock.tick(60);
+ expect(fx.isPaused()).toEqual(false);
+ });
+
+});
View
14 Specs/Configuration.js
@@ -33,6 +33,10 @@ Configuration.presets = {
sets: ['core-1.3-base', 'core-1.3-client', 'core-1.4-base-nocompat', 'core-1.4-client'],
source: ['1.4nocompat']
},
+ 'core-1.5': {
+ sets: ['1.2', 'core-1.3-base', 'core-1.3-client', 'core-1.4-base', 'core-1.4-client', 'core-1.5-base'],
+ source: ['core-1.4-base', 'core-1.4-client']
+ },
'core-2.0': {
sets: ['core-2.0-base', 'core-2.0-client'],
source: ['core-2.0-base', 'core-2.0-client']
@@ -117,6 +121,13 @@ Configuration.sets = {
]
},
+ 'core-1.5-base': {
+ path: '1.5base/',
+ files: [
+ 'Fx/Fx'
+ ]
+ },
+
'core-2.0-base': {
path: '2.0base/',
files: [
@@ -166,7 +177,6 @@ Configuration.source = {
'Utilities/DomReady',
'Utilities/JSON',
'Utilities/Cookie',
- 'Utilities/Swiff',
'Fx/Fx',
'Fx/Fx.CSS',
@@ -217,7 +227,6 @@ Configuration.source = {
'Utilities/DOMReady',
'Utilities/JSON',
'Utilities/Cookie',
- 'Utilities/Swiff',
'Fx/Fx.CSS',
'Fx/Fx.Tween',
@@ -267,7 +276,6 @@ Configuration.source = {
'Utilities/DOMReady',
'Utilities/JSON',
'Utilities/Cookie',
- 'Utilities/Swiff',
'Fx/Fx.CSS',
'Fx/Fx.Tween',
View
10 Specs/README.md
@@ -12,16 +12,16 @@ the browser, via JSTestDriver and via NodeJS.
# init all git submodules
git submodule update --init --recursive
-
+
**Run:**
-To run the tests, you could just open the file `Specs/Runner/runner.html` in a browser, however for
+To run the tests, you could just open the file `Specs/Runner/runner.html` in a browser, however for
some tests you you need some webserver, like apache or python SimpleServer:
python -m SimpleHTTPServer 8080
-Now you can open `http://localhost:8080/Specs/` in the browser to choose a preset or open
-`http://localhost:8080/Specs/Runner/runner.html?preset=core-1.4` to run the 1.4 tests.
+Now you can open `http://localhost:8080/Specs/` in the browser to choose a preset or open
+`http://localhost:8080/Specs/Runner/runner.html?preset=core-1.4` to run the 1.4 tests.
## JSTD
@@ -64,4 +64,4 @@ Example for NodeJS
Options
"path" - Only needs to be specified if the core-specs repository is being used outside of the MooTools Core repository
"specs" - The specs to run, see Sets.js
- "version" - The version of MooTools to be used for running the specs
+ "version" - The version of MooTools to be used for running the specs
View
1  package.yml
@@ -41,4 +41,3 @@ sources:
- "Source/Utilities/Cookie.js"
- "Source/Utilities/JSON.js"
- "Source/Utilities/DOMReady.js"
- - "Source/Utilities/Swiff.js"
Something went wrong with that request. Please try again.