Permalink
Browse files

Add 1.4client Element.Event specs (private API).

  • Loading branch information...
cpojer committed Jul 24, 2011
1 parent 23c4341 commit 9090fb075b50418b03268feaf26f42a9504967ff
Showing with 143 additions and 7 deletions.
  1. +65 −0 1.4client/Element/Element.Event.js
  2. +10 −0 1.4client/package.yml
  3. +67 −6 Configuration.js
  4. +1 −1 Runner
@@ -0,0 +1,65 @@
+/*
+---
+name: Element.Event Specs
+description: n/a
+requires: [Core/Element.Event]
+provides: [Element.Event.Specs]
+...
+*/
+
+describe('Custom Event Extensions', function(){
+ // This is private API. Do not use.
+
+ it('should allow base to be a function', function(){
+ var called;
+ var callback = jasmine.createSpy();
+
+ Element.Events.myClick = {
+ base: function(){
+ return 'click';
+ }
+ };
+
+ var div = new Element('div').addEvent('myClick', callback).inject(document.body);
+
+ simulateEvent('click', [{}, div], function(){
+ expect(callback).toHaveBeenCalled();
+ div.destroy();
+ });
+ });
+
+ it('should pass the name of the custom event to the callbacks', function(){
+ var callbacks = 0;
+ var callback = jasmine.createSpy();
+
+ var fn = function(anything, type){
+ expect(type).toEqual('customEvent');
+ callbacks++;
+ }
+ Element.Events.customEvent = {
+
+ base: function(type){
+ expect(type).toEqual('customEvent');
+ return 'click';
+ },
+
+ condition: function(event, type){
+ fn(null, type);
+ return true;
+ },
+
+ onAdd: fn,
+ onRemove: fn
+
+ };
+
+ var div = new Element('div').addEvent('customEvent', callback).inject(document.body);
+
+ simulateEvent('click', [{}, div], function(){
+ expect(callback).toHaveBeenCalled();
+ div.removeEvent('customEvent', callback).destroy();
+ expect(callbacks).toEqual(3);
+ });
+ });
+
+});
View
@@ -0,0 +1,10 @@
+name: "Core-Specs-1.4client"
+
+license: "[MIT License](http://mootools.net/license.txt)"
+
+copyright: "© [MooTools](http://mootools.net)"
+
+authors: "[MooTools Development Team](http://mootools.net/developers)"
+
+sources:
+ - "Element/Element.Event.js"
View
@@ -25,10 +25,14 @@ Configuration.presets = {
sets: ['core-1.3-base', 'core-1.3-client'],
source: ['1.3mobile']
},
+ 'core-1.4': {
+ sets: ['1.2', 'core-1.3-base', 'core-1.3-client', 'core-1.4-client'],
+ 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']
- }
+ },
};
Configuration.defaultPresets = {
@@ -82,6 +86,13 @@ Configuration.sets = {
]
},
+ 'core-1.4-client': {
+ path: '1.4client/',
+ files: [
+ 'Element/Element.Event'
+ ]
+ },
+
'core-2.0-base': {
path: '2.0base/',
files: [
@@ -194,6 +205,56 @@ Configuration.source = {
]
},
+ 'core-1.4-base': {
+ path: '../Source/',
+ files: [
+ 'Core/Core',
+
+ 'Types/Array',
+ 'Types/Function',
+ 'Types/Number',
+ 'Types/String',
+ 'Types/Object',
+
+ 'Class/Class',
+ 'Class/Class.Extras',
+
+ 'Fx/Fx',
+ 'Fx/Fx.Transitions'
+ ]
+ },
+
+ 'core-1.4-client': {
+ path: '../Source/',
+ files: [
+ 'Types/Event',
+
+ 'Browser/Browser',
+
+ 'Slick/Slick.Parser',
+ 'Slick/Slick.Finder',
+
+ 'Element/Element',
+ 'Element/Element.Event',
+ 'Element/Element.Delegation',
+ 'Element/Element.Style',
+ 'Element/Element.Dimensions',
+
+ 'Utilities/DOMReady',
+ 'Utilities/JSON',
+ 'Utilities/Cookie',
+ 'Utilities/Swiff',
+
+ 'Fx/Fx.CSS',
+ 'Fx/Fx.Tween',
+ 'Fx/Fx.Morph',
+
+ 'Request/Request',
+ 'Request/Request.HTML',
+ 'Request/Request.JSON'
+ ]
+ },
+
'1.3mobile': {
path: './',
files: ['mootools-core-mobile']
@@ -214,13 +275,13 @@ Configuration.source = {
'Utilities/Color',
'Utilities/Table',
'Utilities/JSON',
-
+
'Class/Class',
'Class/Chain',
'Class/Events',
'Class/Options',
'Class/Store',
-
+
'Fx/Fx'
]
},
@@ -229,14 +290,14 @@ Configuration.source = {
path: '../Source/',
files: [
'Browser/Browser',
-
+
'Slick/Slick.Parser',
'Slick/Slick.Finder',
'Element/Element',
-
+
'Browser/Event',
-
+
'Element/Element.Style',
'Utilities/DOMReady',
2 Runner

0 comments on commit 9090fb0

Please sign in to comment.