Skip to content

Instantly share code, notes, and snippets.

@eerne
Created November 23, 2010 22:23
Show Gist options
  • Save eerne/712651 to your computer and use it in GitHub Desktop.
Save eerne/712651 to your computer and use it in GitHub Desktop.
// MooTools 1.3.0 Core Specs on Titanium Desktop 1.2.1
// Jasmine1.0.0.rc1 revision 1282853377
// 147 specs, 282 assertions, 40 failures in 5.619s
runshould return 'regexp' for RegExp objects
Expected 'RegExp' to equal 'regexp'.
function () {
expect(typeOf(/_/)).toEqual('regexp');
}
runshould return 'function' for Function objects
Expected 'Function' to equal 'function'.
function () {
expect(typeOf(function(){})).toEqual('function');
}
runshould return 'boolean' for Boolean objects
Expected 'Boolean' to equal 'boolean'.
function () {
expect(typeOf(true)).toEqual('boolean');
expect(typeOf(false)).toEqual('boolean');
}
Expected 'Boolean' to equal 'boolean'.
function () {
expect(typeOf(true)).toEqual('boolean');
expect(typeOf(false)).toEqual('boolean');
}
runif a function is passed in that function should be returned
Expected Function to equal Function.
function () {
var fn = function(a,b){ return a; };
expect(Function.from(fn)).toEqual(fn);
}
runshould allow generic calls
TypeError: Result of expression 'Car.method' [undefined] is not a function. in app://ch.mild.moo-core-specs/mootools-core/Specs/1.3base/Core/Core.js (line 275)
function () {
expect(Car.method({name: 'not so nice car'})).toEqual('driving a not so nice car');
}
runshould call the function for each item in Function arguments
TypeError: Result of expression 'Array.each' [undefined] is not a function. in app://ch.mild.moo-core-specs/mootools-core/Specs/1.3base/Core/Core.js (line 352)
function () {
var daysArr = [];
(function(){
Array.each(Array.from(arguments), function(value, key){
daysArr[key] = value;
});
})('Sun','Mon','Tue');
expect(daysArr).toEqual(['Sun','Mon','Tue']);
}
runshould call the function for each item in the array
TypeError: Result of expression 'Array.each' [undefined] is not a function. in app://ch.mild.moo-core-specs/mootools-core/Specs/1.3base/Core/Core.js (line 362)
function () {
var daysArr = [];
Array.each(['Sun','Mon','Tue'], function(value, i){
daysArr.push(value);
});
expect(daysArr).toEqual(['Sun','Mon','Tue']);
}
runshould recursively clone and dereference arrays and objects, while mantaining the primitive values
TypeError: Result of expression 'Array.clone' [undefined] is not a function. in app://ch.mild.moo-core-specs/mootools-core/Specs/1.3base/Core/Core.js (line 385)
function () {
var a = [1,2,3, [1,2,3, {a: [1,2,3]}]];
var b = Array.clone(a);
expect(a === b).toBeFalsy();
expect(a[3] === b[3]).toBeFalsy();
expect(a[3][3] === b[3][3]).toBeFalsy();
expect(a[3][3].a === b[3][3].a).toBeFalsy();
expect(a[3]).toEqual(b[3]);
expect(a[3][3]).toEqual(b[3][3]);
expect(a[3][3].a).toEqual(b[3][3].a);
}
runshould flatten a multidimensional array
TypeError: Result of expression 'Array.flatten' [undefined] is not a function. in app://ch.mild.moo-core-specs/mootools-core/Source/Types/Array.js (line 134)
function () {
var arr = [1,2,3,[4,5,[6,7,[8]]], [[[[[9]]]]]];
expect(arr.flatten()).toEqual([1,2,3,4,5,6,7,8,9]);
}
runshould flatten arguments
TypeError: Result of expression 'Array.flatten' [undefined] is not a function. in app://ch.mild.moo-core-specs/mootools-core/Specs/1.3base/Types/Array.js (line 30)
function () {
var test = function(){
return Array.flatten(arguments);
};
expect(test(1,2,3)).toEqual([1,2,3]);
expect(test([1,2,3])).toEqual([1,2,3]);
expect(test(1,2,[3])).toEqual([1,2,3]);
}
runshould use 'Extend' property to extend another class
Error: The method "parent" cannot be called. in app://ch.mild.moo-core-specs/mootools-core/Source/Class/Class.js (line 39)
function () {
var cat = new Cat('fluffy');
expect(cat.name).toEqual('fluffy');
expect(cat.sound).toEqual('miao');
expect(cat.ferocious).toBeFalsy();
expect(cat.say()).toEqual('animal:say:fluffy');
expect(cat.eat()).toEqual('cat:eat:fluffy');
expect(cat.play()).toEqual('cat:play:fluffy');
}
runshould use 'Extend' property to extend an extended class
Error: The method "parent" cannot be called. in app://ch.mild.moo-core-specs/mootools-core/Source/Class/Class.js (line 39)
function () {
var leo = new Lion('leo');
expect(leo.name).toEqual('leo');
expect(leo.sound).toEqual('rarr');
expect(leo.ferocious).toBeTruthy();
expect(leo.say()).toEqual('animal:say:leo');
expect(leo.eat()).toEqual('lion:eat:leo');
expect(leo.play()).toEqual('cat:play:leo');
}
runshould start a Fx and call the onComplete event with linear as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Pow as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Expo as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Circ as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Sine as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Back as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Bounce as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Elastic as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Quad as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Cubic as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Quart as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould start a Fx and call the onComplete event with Quint as timing function
Expected spy start to have been called.
timeout: timed out after 300 msec waiting for something to happen
runshould cancel a Fx
Expected spy unknown to have been called.
runshould chain the Fx
TypeError: Result of expression 'this.caller' [null] is not an object. in app://ch.mild.moo-core-specs/mootools-core/Source/Fx/Fx.js (line 79)
runshould cancel the Fx after a new Fx:start with the link = cancel option
Expected spy cancel to have been called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment