998276643802ff9fb197fe220cbd9552da00a624Luke SmithYUI.add('event-hover-tests', function(Y) {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smithfunction setUp() {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith var testbed = Y.one('#testbed'),
998276643802ff9fb197fe220cbd9552da00a624Luke Smith body;
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith if (!testbed) {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith body = Y.one('body');
998276643802ff9fb197fe220cbd9552da00a624Luke Smith testbed = body.create('<div id="testbed"></div>');
998276643802ff9fb197fe220cbd9552da00a624Luke Smith body.prepend(testbed);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith }
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith testbed.setContent(
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<ul id="items">' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<li id="item1">' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<div id="div1"><p id="p1"># <em id="em1">1</em></p></div>' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '</li>' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<li id="item2">' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<div id="div2"><p id="p2"># <em id="em2">2</em></p></div>' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '</li>' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<li id="item3">' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '<div id="div3"><p id="p3"># <em id="em3">3</em></p></div>' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '</li>' +
998276643802ff9fb197fe220cbd9552da00a624Luke Smith '</ul>');
998276643802ff9fb197fe220cbd9552da00a624Luke Smith}
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smithfunction tearDown() {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith var testbed = Y.one('#testbed');
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith if (testbed) {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith testbed.remove().destroy(true);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith }
998276643802ff9fb197fe220cbd9552da00a624Luke Smith}
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smithfunction mouse(target, out) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith var eventname = (out) ? 'mouseout' : 'mouseover',
64436761af23a95069579e643c4ef13a252e330dLuke Smith testbed = Y.one('#testbed'),
64436761af23a95069579e643c4ef13a252e330dLuke Smith testbedReached = false,
64436761af23a95069579e643c4ef13a252e330dLuke Smith ancestors = Y.one(target).ancestors(function(node) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith if (node === testbed) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith testbedReached = true;
64436761af23a95069579e643c4ef13a252e330dLuke Smith }
64436761af23a95069579e643c4ef13a252e330dLuke Smith return !testbedReached;
64436761af23a95069579e643c4ef13a252e330dLuke Smith }, true),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith i, len;
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith if (out) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith for (i = ancestors.size() - 1; i >= 1; --i) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Event.simulate(
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith ancestors._nodes[i],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith eventname,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith { relatedTarget: ancestors._nodes[i - 1] });
64436761af23a95069579e643c4ef13a252e330dLuke Smith }
64436761af23a95069579e643c4ef13a252e330dLuke Smith } else {
64436761af23a95069579e643c4ef13a252e330dLuke Smith for (i = 1, len = ancestors.size(); i < len; ++i) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Event.simulate(
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith ancestors._nodes[i],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith eventname,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith { relatedTarget: ancestors._nodes[i - 1] });
64436761af23a95069579e643c4ef13a252e330dLuke Smith }
64436761af23a95069579e643c4ef13a252e330dLuke Smith }
64436761af23a95069579e643c4ef13a252e330dLuke Smith}
64436761af23a95069579e643c4ef13a252e330dLuke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smithvar suite = new Y.Test.Suite("event-hover"),
998276643802ff9fb197fe220cbd9552da00a624Luke Smith areSame = Y.Assert.areSame;
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smithsuite.add(new Y.Test.Case({
998276643802ff9fb197fe220cbd9552da00a624Luke Smith name: 'subscribe',
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith setUp: setUp,
998276643802ff9fb197fe220cbd9552da00a624Luke Smith tearDown: tearDown,
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('hover', over, out)": function () {
64436761af23a95069579e643c4ef13a252e330dLuke Smith var overCount = 0,
64436761af23a95069579e643c4ef13a252e330dLuke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
64436761af23a95069579e643c4ef13a252e330dLuke Smith target = Y.one('#em1'),
64436761af23a95069579e643c4ef13a252e330dLuke Smith overType, outType, overPhase, outPhase, overEType, outEType,
64436761af23a95069579e643c4ef13a252e330dLuke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
64436761af23a95069579e643c4ef13a252e330dLuke Smith overRelTarget, outRelTarget,
64436761af23a95069579e643c4ef13a252e330dLuke Smith overThisObj, outThisObj;
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith function over(e) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
64436761af23a95069579e643c4ef13a252e330dLuke Smith overType = e.type;
64436761af23a95069579e643c4ef13a252e330dLuke Smith overPhase = e.phase;
64436761af23a95069579e643c4ef13a252e330dLuke Smith overEType = e._event.type;
64436761af23a95069579e643c4ef13a252e330dLuke Smith overThisObj = this;
64436761af23a95069579e643c4ef13a252e330dLuke Smith overTarget = e.target;
64436761af23a95069579e643c4ef13a252e330dLuke Smith overCurrentTarget = e.currentTarget;
64436761af23a95069579e643c4ef13a252e330dLuke Smith }
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith function out(e) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
64436761af23a95069579e643c4ef13a252e330dLuke Smith outType = e.type;
64436761af23a95069579e643c4ef13a252e330dLuke Smith outPhase = e.phase;
64436761af23a95069579e643c4ef13a252e330dLuke Smith outEType = e._event.type;
64436761af23a95069579e643c4ef13a252e330dLuke Smith outThisObj = this;
64436761af23a95069579e643c4ef13a252e330dLuke Smith outTarget = e.target;
64436761af23a95069579e643c4ef13a252e330dLuke Smith outCurrentTarget = e.currentTarget;
64436761af23a95069579e643c4ef13a252e330dLuke Smith }
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith target.on('hover', over, out);
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith mouse('#em1');
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('hover', overType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('over', overPhase);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('mouseover', overEType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, overThisObj);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, overTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, overCurrentTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(0, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(0, outArgCount);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.isUndefined(outType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.isUndefined(outPhase);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.isUndefined(outEType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.isUndefined(outThisObj);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.isUndefined(outTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.isUndefined(outCurrentTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith mouse("#em1", true);
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('hover', overType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('over', overPhase);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('mouseover', overEType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, overThisObj);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, overTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, overCurrentTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('hover', outType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('out', outPhase);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame('mouseout', outEType);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, outThisObj);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, outTarget);
64436761af23a95069579e643c4ef13a252e330dLuke Smith Y.Assert.areSame(target, outCurrentTarget);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith "test container.on('hover', over, out)": function () {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var overCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith target = Y.one('#item1'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overRelTarget, outRelTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj, outThisObj;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function over(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget = e.currentTarget;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function out(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget = e.currentTarget;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith target.on('hover', over, out);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse('#em1');
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('over', overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseover', overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(0, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(0, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse("#em1", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('over', overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseover', overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('out', outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseout', outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith },
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test Y.on('hover', over, out, '#foo')": function () {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var overCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith target = Y.one('#item1'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overRelTarget, outRelTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj, outThisObj;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function over(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget = e.currentTarget;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function out(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget = e.currentTarget;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.on('hover', over, out, '#item1');
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse('#em1');
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('over', overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseover', overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(0, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(0, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.isUndefined(outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse("#em1", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('over', overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseover', overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('out', outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseout', outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outCurrentTarget);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test nodelist.on('hover', over, out)": function () {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var overCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith item1 = Y.one('#item1'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith item2 = Y.one('#item2'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith item3 = Y.one('#item3'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overRelTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outRelTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj = [];
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function over(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType.push(e.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase.push(e.phase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType.push(e._event.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj.push(this);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget.push(e.target);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget.push(e.currentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function out(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType.push(e.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase.push(e.phase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType.push(e._event.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj.push(this);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget.push(e.target);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget.push(e.currentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.all('#items li').on('hover', over, out);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse('#em1'); mouse("#em1", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['over'], overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover'], overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['out'], outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout'], outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse("#em2"); mouse("#em2", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse("#em3"); mouse("#em3", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(3, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['over','over','over'], overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover','mouseover','mouseover'], overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(3, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['out','out','out'], outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout','mouseout','mouseout'], outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith },
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith "test node.delegate('hover', over, out, filter)": function () {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var overCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith items = Y.one('#items'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith item1 = Y.one('#item1'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith item2 = Y.one('#item2'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith item3 = Y.one('#item3'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overRelTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outRelTarget = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overContainer = [],
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outContainer = [];
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function over(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType.push(e.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase.push(e.phase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType.push(e._event.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj.push(this);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget.push(e.target);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget.push(e.currentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overContainer.push(e.container);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function out(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType.push(e.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase.push(e.phase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType.push(e._event.type);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj.push(this);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget.push(e.target);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget.push(e.currentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outContainer.push(e.container);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith items.delegate('hover', over, out, 'li');
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse('#em1'); mouse("#em1", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['over'], overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover'], overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([items], overContainer);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['out'], outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout'], outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1], outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([items], overContainer);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse("#em2"); mouse("#em2", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse("#em3"); mouse("#em3", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(3, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['over','over','over'], overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover','mouseover','mouseover'], overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([items, items, items], overContainer);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(3, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['out','out','out'], outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout','mouseout','mouseout'], outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.ArrayAssert.itemsAreSame([items, items, items], outContainer);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('hover', over, out, thisObj)": function () {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var overCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith target = Y.one('#item1'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith obj = { foo: 'foo' },
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overRelTarget, outRelTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj, outThisObj, overFoo, outFoo;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function over(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo = this.foo;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function out(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo = this.foo;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith target.on('hover', over, out, obj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse('#em1'); mouse("#em1", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('over', overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseover', overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(obj, overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('foo', overFoo);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('out', outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseout', outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(obj, outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('foo', outFoo);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test Y.on('hover', over, out, '#foo', thisObj)": function () {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var overCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith target = Y.one('#item1'),
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith obj = { foo: 'foo' },
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overRelTarget, outRelTarget,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj, outThisObj, overFoo, outFoo;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function over(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith overCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo = this.foo;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith function out(e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outType = e.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outPhase = e.phase;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outEType = e._event.type;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outThisObj = this;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outTarget = e.target;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith outCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo = this.foo;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith }
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.on('hover', over, out, '#item1', obj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith mouse('#em1'); mouse("#em1", true);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', overType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('over', overPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseover', overEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(obj, overThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, overCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('foo', overFoo);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('hover', outType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('out', outPhase);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('mouseout', outEType);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(obj, outThisObj);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame(target, outCurrentTarget);
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Assert.areSame('foo', outFoo);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test nodelist.on('hover', over, out, thisObj)": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item1 = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item2 = Y.one('#item2'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item3 = Y.one('#item3'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith obj = { foo: 'foo' },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outRelTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo = [];
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType.push(e.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase.push(e.phase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType.push(e._event.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj.push(this);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget.push(e.target);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget.push(e.currentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo.push(this.foo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType.push(e.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase.push(e.phase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType.push(e._event.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj.push(this);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget.push(e.target);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget.push(e.currentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo.push(this.foo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.all('#items li').on('hover', over, out, obj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['over'], overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover'], overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj], overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['out'], outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout'], outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj], outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse("#em2"); mouse("#em2", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse("#em3"); mouse("#em3", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['over','over','over'], overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover','mouseover','mouseover'], overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj, obj, obj], overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(1, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['out','out','out'], outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout','mouseout','mouseout'], outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj, obj, obj], outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.on('hover', over, out, thisObj, arg)": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith obj = { foo: 'foo' },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget, outRelTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj, outThisObj, overFoo, outFoo, overArg, outArg;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo = this.foo;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo = this.foo;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.on('hover', over, out, obj, "arg!");
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('over', overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseover', overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(obj, overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('foo', overFoo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('out', outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseout', outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(obj, outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('foo', outFoo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', outArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test Y.on('hover', over, out, '#foo', thisObj, arg)": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith obj = { foo: 'foo' },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget, outRelTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj, outThisObj, overFoo, outFoo, overArg, outArg;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo = this.foo;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo = this.foo;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.on('hover', over, out, "#item1", obj, "arg!");
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('over', overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseover', overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(obj, overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('foo', overFoo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('out', outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseout', outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(obj, outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('foo', outFoo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', outArg);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test nodelist.on('hover', over, out, thisObj, arg)": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item1 = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item2 = Y.one('#item2'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item3 = Y.one('#item3'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith obj = { foo: 'foo' },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outRelTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg = [];
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType.push(e.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase.push(e.phase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType.push(e._event.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj.push(this);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget.push(e.target);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget.push(e.currentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overFoo.push(this.foo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg.push(x);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType.push(e.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase.push(e.phase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType.push(e._event.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj.push(this);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget.push(e.target);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget.push(e.currentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outFoo.push(this.foo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg.push(x);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.all('#items li').on('hover', over, out, obj, 'arg!');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['over'], overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover'], overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj], overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['foo'], overFoo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!'], overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['out'], outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout'], outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj], outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['foo'], outFoo);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!'], outArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse("#em2"); mouse("#em2", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse("#em3"); mouse("#em3", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['over','over','over'], overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover','mouseover','mouseover'], overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj, obj, obj], overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!', 'arg!', 'arg!'], overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['out','out','out'], outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout','mouseout','mouseout'], outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([obj, obj, obj], outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!', 'arg!', 'arg!'], outArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.on('hover', over, out, null, arg)": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget, outRelTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj, outThisObj, overArg, outArg;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.on('hover', over, out, null, "arg!");
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('over', overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseover', overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('out', outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseout', outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', outArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test Y.on('hover', over, out, '#foo', null, arg)": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType, outType, overPhase, outPhase, overEType, outEType,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget, outTarget, overCurrentTarget, outCurrentTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget, outRelTarget,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj, outThisObj, overArg, outArg;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = e.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = e.phase;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = e._event.type;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = this;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = e.target;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = e.currentTarget;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg = x;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.on('hover', over, out, '#item1', null, "arg!");
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('over', overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseover', overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('hover', outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('out', outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('mouseout', outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(target, outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame('arg!', outArg);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test nodelist.on('hover', over, out, null, arg": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = 0,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item1 = Y.one('#item1'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item2 = Y.one('#item2'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith item3 = Y.one('#item3'),
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overRelTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outRelTarget = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj = [],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg = [];
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith overArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overType.push(e.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overPhase.push(e.phase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overEType.push(e._event.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overThisObj.push(this);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overTarget.push(e.target);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overCurrentTarget.push(e.currentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith overArg.push(x);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out(e, x) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount++;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith outArgCount = arguments.length;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outType.push(e.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outPhase.push(e.phase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outEType.push(e._event.type);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outThisObj.push(this);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outTarget.push(e.target);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCurrentTarget.push(e.currentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outArg.push(x);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.all('#items li').on('hover', over, out, null, 'arg!');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#em1'); mouse("#em1", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['over'], overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover'], overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!'], overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover'], outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['out'], outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout'], outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1], outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!'], outArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse("#em2"); mouse("#em2", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse("#em3"); mouse("#em3", true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, overArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], overType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['over','over','over'], overPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseover','mouseover','mouseover'], overEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], overCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!', 'arg!', 'arg!'], overArg);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith Y.Assert.areSame(2, outArgCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['hover','hover','hover'], outType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['out','out','out'], outPhase);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['mouseout','mouseout','mouseout'], outEType);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outThisObj);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame([item1, item2, item3], outCurrentTarget);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.ArrayAssert.itemsAreSame(['arg!', 'arg!', 'arg!'], outArg);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith }
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith // node.delegate + thisObj + args
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith // Y.delegate + thisObj + args
998276643802ff9fb197fe220cbd9552da00a624Luke Smith}));
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smithsuite.add(new Y.Test.Case({
998276643802ff9fb197fe220cbd9552da00a624Luke Smith name: 'detach',
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith setUp: setUp,
998276643802ff9fb197fe220cbd9552da00a624Luke Smith tearDown: tearDown,
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('hover', over, out); node.detach('hover');": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.on('hover', over, out);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('hover');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('hover', over, out); node.detach('hover', over);": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.on('hover', over, out);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('hover', over);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('cat|hover', over, out); node.detach('cat|hover');": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.on('cat|hover', over, out);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('cat|hover');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('cat|hover', over, out); node.detach('cat|*');": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#item1');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.on('cat|hover', over, out);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('cat|*');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith },
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith "test node.on('hover', over, out); handle.detach();": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith over = function () { overCount++; },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith out = function () { outCount++; },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith handle = Y.one('#item1').on('cat|hover', over, out);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith handle.detach();
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(1, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.delegate('hover', over, out, filter); node.detach('hover');": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#items');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.delegate('hover', over, out, 'li');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('hover');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.delegate('hover', over, out, filter); node.detach('hover', over);": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#items');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.delegate('hover', over, out, 'li');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('hover', over);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.delegate('cat|hover', over, out, filter); node.detach('cat|hover');": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#items');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.delegate('cat|hover', over, out, 'li');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('cat|hover');
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.delegate('cat|hover', over, out, filter); node.detach('cat|*');": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target = Y.one('#items');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function over() { overCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith function out() { outCount++; }
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.delegate('cat|hover', over, out, 'li');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith target.detach('cat|*');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith "test node.delegate('hover', over, out, filter); handle.detach();": function () {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var overCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith outCount = 0,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith over = function () { overCount++; },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith out = function () { outCount++; },
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith handle = Y.one('#items').delegate('cat|hover', over, out, 'li');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith handle.detach();
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item1'); mouse('#item1', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item2'); mouse('#item2', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith mouse('#item3'); mouse('#item3', true);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, overCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith Y.Assert.areSame(3, outCount);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith }
998276643802ff9fb197fe220cbd9552da00a624Luke Smith}));
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke SmithY.Test.Runner.add(suite);
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
998276643802ff9fb197fe220cbd9552da00a624Luke Smith
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith}, '@VERSION@' ,{requires:['event-hover', 'test', 'event-simulate']});