1
YUI.add('flick-tests', function(Y) {
4
flick: Y.Node.DOM_EVENTS.flick.eventDef,
11
node = Y.one('#tester'),
26
suite = new Y.Test.Suite('Flick Event Suite');
28
suite.add(new Y.Test.Case({
32
this.handles.push(node.on('flick', noop));
33
this.handles.push(node.delegate('flick', noop));
35
tearDown: function() {
36
Y.Array.each(this.handles, function(h) {
40
'test: _onStart()': function() {
41
eventData.flick._onStart(event,node, {
48
Assert.areSame(event.target, e.target, 'Target not set properly');
49
Assert.areSame('flick', e.type, 'Event type is wrong');
50
Assert.areEqual(1, e.button, 'e.button is not set');
54
'test: _onMove()': function() {
55
var sub = { '_fs': { flick: { } } };
56
eventData.flick._onMove(event,node, sub);
57
Assert.isTrue((sub['_fs'].flick.time > 0), 'Flick time was not set on move');
59
'test: _onEnd()': function() {
61
en.changedTouches = en.touches;
64
eventData.flick._onEnd(en,node, {
67
time: ((new Date().getTime()) - 3000)
85
Assert.areSame('flick', e.type, 'Event type is incorrect');
86
Assert.isObject(e.flick, 'e.click is not an Object');
87
Assert.areSame('x', e.flick.axis, 'flick axis is not X');
88
Assert.areSame(95, e.flick.distance, 'Did not flick the proper distance');
89
Assert.isTrue((e.flick.time >- 3000), 'flick time is not set properly');
90
Assert.isTrue((e.flick.velocity >= 0.020), 'Failed to move in the proper velocity');
91
Assert.areSame(0, e.touches.length, 'e.touches.length should be 0');
92
Assert.areSame(1, e.changedTouches.length), 'e.changedTouches.length should be 1';
93
Assert.areSame(node, e.target, 'Event target is not set properly');
94
Assert.areSame(node, e.currentTarget, 'Event currentTarget is not set properly');
102
Y.Test.Runner.add(suite);