80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
cb4f4f79feb7498d1f3406b88fb62209e5f5a444Adam Moore<script type="text/javascript" src="/build/yui/yui.js"></script>
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>
03f9aefec605c500b64625110a955e65b900b100Adam Moore <a title="remove module" class="yui-remove"><em>x</em></a>
03f9aefec605c500b64625110a955e65b900b100Adam Moore <p>This an example of what you can do with the YUI Animation Utility.</p>
03f9aefec605c500b64625110a955e65b900b100Adam Moore <p><em>Follow the instructions above to see the animation in action.</em></p>
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore(function() {
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore var global_notified;
52671ce4f644d565b2acd71a8ce4f6d20829a67cAdam Moore //YUI.add("selector-native", function(){});
a4a12866ef14f142b1a799fc246a542d69af602bLuke Smith filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
a4a12866ef14f142b1a799fc246a542d69af602bLuke Smith allowRollup: false,
b46f3d670b654847b0ce60afdba1b461c492a5c9Adam Moore onCSS: function(Y) {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.log('CSS is done loading', 'info', 'testcase');
cb4f4f79feb7498d1f3406b88fb62209e5f5a444Adam Moore logExclude: { get: true, Dom: true, Selector: true, Node: true, attribute: true, event: true, base: true, widget: true },
9c42541e375e7bb70c53012b3012d70f1a380254Adam Moore base: 'raw',
0771d781138a507b3e657573703f511291640bf3Adam Moore // dom: null,
9c42541e375e7bb70c53012b3012d70f1a380254Adam Moore attribute: 'min'
03f9aefec605c500b64625110a955e65b900b100Adam Moore }).use("dump", "test", "anim", "console", function(Y) {
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore // Y.Global.on('yui:log', function(e) {
b238e52ac22e07b0798ae7b0f63f3fe0e8f9bf95Adam Moore var button = Y.one('#btnRun');
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore // Set up the page
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore button.set("disabled", false);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.on("click", function() {
fb49666327c2cb6ea5a7d2dea5160b649bc07c51Adam Moore var myConsole = new Y.Console().render();
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var testEventTarget = new Y.Test.Case({
21f450f4fd5fd60f951de44878aae015ed0342e3Adam Moore name: "Custom event tests",
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testStopFnOnceFromBubbleTarget: "ticket pending",
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testStopFnFromBubbleTarget: "ticket pending"
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore testAugment: function() {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var fired = false;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var O = function(id) {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.log('O constructor executed ' + id);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore oOo: function(ok) {
abdfe7cf11d34f89f17b26e4779bf6079d22a910Adam Moore // pass configuration info into EventTarget with the following
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore // construct
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore emitFacade: true
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore var o = new O(),
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore handle = o.on('testAugment', function(e, arg1, arg2) {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.Assert.isTrue(this instanceof O);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired = true;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore o.fire('testAugment', { foo: 'afoo' }, 1, 2);
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore // if the first argument is not an object, the
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore // event facade is moved in front of the args rather
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore // than overwriting existing object.
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore o.on('testAugment', function(e, arg1, arg2) {
eab87f0881fdf3e80c2a1af9224c50f0bf033644Adam Moore o.fire('testAugment', 1, 2);
03f9aefec605c500b64625110a955e65b900b100Adam Moore test_detach_by_signature: function() {
03f9aefec605c500b64625110a955e65b900b100Adam Moore var anim = new Y.Anim({
03f9aefec605c500b64625110a955e65b900b100Adam Moore node: '#demo',
03f9aefec605c500b64625110a955e65b900b100Adam Moore to: { opacity: 0 }
03f9aefec605c500b64625110a955e65b900b100Adam Moore tester = function() {
03f9aefec605c500b64625110a955e65b900b100Adam Moore Y.detach('foo', tester);
03f9aefec605c500b64625110a955e65b900b100Adam Moore Y.on('foo', tester);
03f9aefec605c500b64625110a955e65b900b100Adam Moore var onEnd = function() {
03f9aefec605c500b64625110a955e65b900b100Adam Moore // this.detach('anim:end', onEnd);
03f9aefec605c500b64625110a955e65b900b100Adam Moore this.detach('end', onEnd);
03f9aefec605c500b64625110a955e65b900b100Adam Moore to: { height: 1 },
03f9aefec605c500b64625110a955e65b900b100Adam Moore if (count > 2) {
03f9aefec605c500b64625110a955e65b900b100Adam Moore throw new Error('onEnd should only have happened once');
e809fe662b10fe7accafd6458c68ef95b307db6dAdam Moore // anim.on('end', onEnd);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore testExtend: function() {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var fired = false;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var Base = function() {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.log('Base constructor executed');
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore arguments.callee.superclass.constructor.apply(this, arguments);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore base: function() {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.log('all your base...');
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var b = new Base();
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore b.on('testExtend', function(arg1, arg2) {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.Assert.isTrue(this instanceof Base);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired = true;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore b.fire('testExtend', 1, 2);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore testPrefix: function() {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var fired1 = false,
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired2 = false;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var O = function(id) {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.log('O constructor executed ' + id);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore oOo: function(ok) {
abdfe7cf11d34f89f17b26e4779bf6079d22a910Adam Moore // pass configuration info into EventTarget with the following
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore // construct
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore emitFacade: true,
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore prefix: 'prefix'
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore var o = new O();
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore o.on('testPrefix', function(e, arg1, arg2) {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.Assert.isTrue(this instanceof O);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired1 = true;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore o.on('prefix:testPrefix', function(e, arg1, arg2) {
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.Assert.isTrue(this instanceof O);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired2 = true;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore o.fire('testPrefix', { foo: 'afoo' }, 1, 2);
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired1 = false;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore fired2 = false;
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore o.fire('prefix:testPrefix', { foo: 'afoo' }, 1, 2);
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore testDetachKey: function() {
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore var fired1 = false,
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired2 = false;
9c69eb57afb13ae0ffed8e442449f04922fe30adAdam Moore Y.on('handle|test:event', function() {
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired1 = true;
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore // one listener
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore Y.fire('test:event');
9c69eb57afb13ae0ffed8e442449f04922fe30adAdam Moore Y.detach('handle|test:event');
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired1 = false;
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired2 = false;
9c69eb57afb13ae0ffed8e442449f04922fe30adAdam Moore Y.on('handle|test:event', function() {
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired2 = true;
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore // first lisener detached, added a new listener
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore Y.fire('test:event');
9c69eb57afb13ae0ffed8e442449f04922fe30adAdam Moore Y.detach('handle|test:event');
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired1 = false;
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired2 = false;
7aa876bc6c31de0d6ada455f2125dd549aaa0ee0Adam Moore Y.after('handle|test:event', function(arg1) {
7aa876bc6c31de0d6ada455f2125dd549aaa0ee0Adam Moore Y.Assert.areEqual('orange', arg1);
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore fired2 = true;
8c73ff96cdb702124fb8ca87e9135cee38195253Adam Moore // comma or pipe
7aa876bc6c31de0d6ada455f2125dd549aaa0ee0Adam Moore Y.on('handle|test:event', function(arg1) {
7aa876bc6c31de0d6ada455f2125dd549aaa0ee0Adam Moore Y.Assert.areEqual('orange', arg1);
9bc9c1474a84983bd254adc2bc425c5b24d25526Adam Moore fired1 = true;
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore // testing on and after order
7aa876bc6c31de0d6ada455f2125dd549aaa0ee0Adam Moore Y.fire('test:event', 'orange');
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore fired1 = false;
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore fired2 = false;
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore // spaces after the comma or lack thereof should have
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore // no effect on the addition or removal of listeners
b51141cca8274097a520f6ead83a4c205b0502f1Adam Moore var ret = Y.detach('handle|test:event');
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore // added both an on listener and an after listener,
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore // then detached both
7aa876bc6c31de0d6ada455f2125dd549aaa0ee0Adam Moore Y.fire('test:event', 'orange');
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore testDetachAllByKey: function() {
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore var fired1 = false,
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore fired2 = false;
efa57736d44cf446f1661497a8645bd388b493fbAdam Moore Y.after('handle|event2', function() {
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore fired2 = true;
efa57736d44cf446f1661497a8645bd388b493fbAdam Moore Y.on('handle|event2', function() {
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore fired1 = true;
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore // detachAll
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore Y.Assert.isFalse(fired1, 'fired1, the after listener should not have fired.');
8aa0880cd494c951e0f4aa7d82d8bdac7692c7d0Adam Moore Y.Assert.isFalse(fired2, 'fired2, the on listener should not have fired.');
bd6676c46a56d23b5e6f4702054bbd52e3d6f05fAdam Moore testChain: function() {
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore var fired1 = false,
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired2 = false,
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired3 = false,
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired4 = false,
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired5 = false;
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // should be executed once, after f2
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore var f1 = function() {
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired1 = true;
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // should be executed once, before f1
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore var f2 = function() {
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired2 = true;
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // should be executed once, different event from f1 and f2
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore var f3 = function() {
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired3 = true;
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // detached before fired, should not executed
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore var f4 = function() {
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired4 = true;
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // should fire once, preserving the custom prefix rather
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // than using the configured event target prefix
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore var f5 = function() {
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore fired5 = true;
ba9518d6366a8c1c3a1d027fdc652d92759e101bAdam Moore // configure chaining via global default or on the event target
482388c306e346930994afd7e59b3af43c00aac6Adam Moore YUI({ /* chain: true */
0dca577a07715960da42d47787eecc25b285182fAdam Moore logInclude: {
e4377e1af34e57ac1ca97e67e81c53f6a4347e55Adam Moore }).use('event-custom', function(Y2) {
ba9518d6366a8c1c3a1d027fdc652d92759e101bAdam Moore prefix: 'foo',
ba9518d6366a8c1c3a1d027fdc652d92759e101bAdam Moore chain : true
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // without event target prefix manipulation (incomplete now)
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore // @TODO an error here is throwing an uncaught exception rather than failing the test
ed130182a3af03d1123fae83204a804c7a2ac0d3Adam Moore // Y2.after('p:e', f1).on('p:e', f2).on('p:e2', f3).on('detach, p:e', f4).detach('detach, p:e').fire('p:e').fire('p:e2');
482388c306e346930994afd7e59b3af43c00aac6Adam Moore // with event target prefix manipulation ('e' is the same event as 'foo:e',
ed130182a3af03d1123fae83204a804c7a2ac0d3Adam Moore // but 'pre:e' is a different event only accessible by using that exact name)
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Mooreo.after('e', f1).on('foo:e', f2).on('foo:e2', f3).on('detach, e', f4).detach('detach,e').fire('foo:e').fire('e2').on('pre:e', f5).fire('pre:e');
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore Y.Assert.isTrue(fired1); // verifies chaining, on/after order, and adding the event target prefix
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore Y.Assert.isTrue(fired2); // verifies chaining, on/after order, and accepting the prefix in the event name
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore Y.Assert.isTrue(fired3); // verifies no interaction between events, and prefix manipulation
ed130182a3af03d1123fae83204a804c7a2ac0d3Adam Moore Y.Assert.isFalse(fired4); // verifies detach works (regardless of spaces after comma)
2d71b4319c515f49ca328e3e00bb08d35ed5c161Adam Moore Y.Assert.isTrue(fired5); // verifies custom prefix
df5cf7dae3c20d8c50c036ea90987ec21f59614aAdam Moore testObjType: function() {
df5cf7dae3c20d8c50c036ea90987ec21f59614aAdam Moore 'y:click': function() {f1 = true},
df5cf7dae3c20d8c50c036ea90987ec21f59614aAdam Moore 'y:clack': function() {f2 = true}
4ed6c4c5fd18811cfc57f26a1c593307d1867746Adam Moore testBubble: function() {
4ed6c4c5fd18811cfc57f26a1c593307d1867746Adam Moore var count = 0,
4ed6c4c5fd18811cfc57f26a1c593307d1867746Adam Moore emitFacade: true,
4ed6c4c5fd18811cfc57f26a1c593307d1867746Adam Moore bubbles: true
482388c306e346930994afd7e59b3af43c00aac6Adam Moore a = new Y.EventTarget(config),
4ed6c4c5fd18811cfc57f26a1c593307d1867746Adam Moore b = new Y.EventTarget(config);
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore // this should not be necessary // fixed
bbcd1d0c70bd65221c0b025eb0a931fdbde1a45bAdam Moore // b.publish('test:foo');
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore a.on('test:foo', function(e) {
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore // we will fire this on the parent, so that should be the target
3f3aa287185afb5d48d7ef0717054a154c372dc9Adam Moore ret = b.fire('test:foo', {}, b);
4ed6c4c5fd18811cfc57f26a1c593307d1867746Adam Moore b.on('test:foo', function(e) {
3f3aa287185afb5d48d7ef0717054a154c372dc9Adam Moore ret = b.fire('test:foo', {}, b);
b3bd569e322a241dcb9aa531d7a7d9ed13766007Adam Moore testPreventFnOnce: function() {
b3bd569e322a241dcb9aa531d7a7d9ed13766007Adam Moore var count = 0;
b3bd569e322a241dcb9aa531d7a7d9ed13766007Adam Moore emitFacade: true,
b3bd569e322a241dcb9aa531d7a7d9ed13766007Adam Moore preventedFn: function() {
eaa291029af365353cfdc18d7cd1014a2f43bbe4Adam Moore Y.Assert.isTrue(this instanceof YUI);
eaa291029af365353cfdc18d7cd1014a2f43bbe4Adam Moore Y.on('y:foo1', function(e) {
eaa291029af365353cfdc18d7cd1014a2f43bbe4Adam Moore Y.on('y:foo1', function(e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testPreventFromBubbleTarget: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith var count = 0,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith target = new Y.EventTarget({ prefix: 'x' });
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith emitFacade: true,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith preventedFn: function() {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith Y.on('x:foo', function(e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testPreventedFnOnceFromBubbleTarget: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith var count = 0,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith target = new Y.EventTarget({ prefix: 'x' });
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith emitFacade: true,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith preventedFn: function() {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith Y.on('x:foo', function(e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith Y.on('x:foo', function(e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith target.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testStopFnOnce: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith var count = 0,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith target = new Y.EventTarget({ prefix: 'a' });
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith emitFacade: true,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith stoppedFn: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith target.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith target.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testStopFnFromBubbleTarget: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith var count = 0,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith origin = new Y.EventTarget({ prefix: 'a' }),
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetB = new Y.EventTarget({ prefix: 'b' });
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith emitFacade: true,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith stoppedFn: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetB.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith testStopFnOnceFromBubbleTarget: function () {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith var count = 0,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith origin = new Y.EventTarget({ prefix: 'a' }),
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetB = new Y.EventTarget({ prefix: 'b' }),
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetC = new Y.EventTarget({ prefix: 'c' });
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith emitFacade: true,
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith stoppedFn: function() {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetB.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetB.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith Y.Assert.areEqual(1, count, "stopProp called twice from bubble target resulted in stoppedFn called wrong number of times");
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith targetC.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith Y.Assert.areEqual(1, count, "stopProp called from intermediate bubble target didn't prevent stoppedFn call from subsequent bubble target");
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith origin.on('foo', function (e) {
e281a15571f07a6b4da34d2ffd674dbeb5dfd612Luke Smith Y.Assert.areEqual(1, count, "stopProp called from event origin subscription didn't prevent calls to stoppedFn from bubble target");
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore testDetachHandle: function() {
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore var count = 0, handle, handle2;
f21a4beaef1cd810a2ca714086ee81ef7753811fAdam Moore emitFacade: true
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore Y.on('y:foo', function(e) {
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore handle = Y.on('y:foo', function(e) {
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore count += 100;
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore handle2 = Y.on('y:foo', function(e) {
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore count += 1000;
5740f3112d19859eebaba7b3b8b95e6bc14beffbAdam Moore var handle3 = Y.on('y:click', function() {
fb49666327c2cb6ea5a7d2dea5160b649bc07c51Adam Moore var o = new Y.EventTarget();
fb49666327c2cb6ea5a7d2dea5160b649bc07c51Adam Moore o.on('foo', function(e) {
fb49666327c2cb6ea5a7d2dea5160b649bc07c51Adam Moore o.on('foo', function(e) {
fb49666327c2cb6ea5a7d2dea5160b649bc07c51Adam Moore var handle3 = Y.on('y:click', function() {
fb49666327c2cb6ea5a7d2dea5160b649bc07c51Adam Moore // detachAll can't be allowed to work on the YUI instance.
13060ea8e194930917f0243edd6ca469a91472e8Adam Moore testBroadcast: function() {
0f2f588af92633581627b768ccac61af079d87cfAdam Moore var o = new Y.EventTarget(), s1, s2, s3, s4;
0f2f588af92633581627b768ccac61af079d87cfAdam Moore emitFacade: true,
0f2f588af92633581627b768ccac61af079d87cfAdam Moore broadcast: 1
eaa291029af365353cfdc18d7cd1014a2f43bbe4Adam Moore Y.on('y:foo2', function() {
bec687aba7976035d86626c750ea65c65ce13733Adam Moore Y.log('Y foo2 executed');
eaa291029af365353cfdc18d7cd1014a2f43bbe4Adam Moore Y.Global.on('y:foo2', function() {
bec687aba7976035d86626c750ea65c65ce13733Adam Moore Y.log('GLOBAL foo2 executed');
0f2f588af92633581627b768ccac61af079d87cfAdam Moore emitFacade: true,
0f2f588af92633581627b768ccac61af079d87cfAdam Moore broadcast: 2
0f2f588af92633581627b768ccac61af079d87cfAdam Moore Y.on('y:bar', function() {
bec687aba7976035d86626c750ea65c65ce13733Adam Moore Y.log('Y bar executed');
0f2f588af92633581627b768ccac61af079d87cfAdam Moore Y.Global.on('y:bar', function() {
bec687aba7976035d86626c750ea65c65ce13733Adam Moore Y.log('GLOBAL bar executed');
ef53d6bba1a117c23e9ba697b08e15eee1ee9c06Adam Moore Y.Global.on('y:bar', function(e) {
ef53d6bba1a117c23e9ba697b08e15eee1ee9c06Adam Moore Y.log('GLOBAL bar executed');
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore test_fire_once: function() {
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore var notified = 0;
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.publish('fireonce', {
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore fireOnce: true
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.fire('fireonce', 'foo', 'bar');
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.on('fireonce', function(arg1, arg2) {
21f450f4fd5fd60f951de44878aae015ed0342e3Adam Moore Y.Assert.areEqual('foo', arg1, 'arg1 not correct for lazy fireOnce listener')
21f450f4fd5fd60f951de44878aae015ed0342e3Adam Moore Y.Assert.areEqual('bar', arg2, 'arg2 not correct for lazy fireOnce listener')
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.fire('fireonce', 'foo2', 'bar2');
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.fire('fireonce', 'foo3', 'bar3');
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore global_notified = false;
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.on('fireonce', function(arg1, arg2) {
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.log('the notification is asynchronous, so I need to wait for this test');
7135bc481c626e02f80b94c6d52cf9a13c3a38f7Adam Moore Y.Assert.areEqual(1, notified, 'listener notified more than once.');
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore global_notified = true;
51224f8f34c13fbf5c51c3bdb3220b37ae91b629Adam Moore // it is no longer asynchronous
51224f8f34c13fbf5c51c3bdb3220b37ae91b629Adam Moore // Y.Assert.isFalse(global_notified, 'notification was not asynchronous');
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore test_async_fireonce: function() {
5f8408be995d28c8f351f37fd05e7c8633fdea40Adam Moore Y.Assert.isTrue(global_notified, 'asynchronous notification did not seem to work.');
4f2de35716c5df46152747980516af484d0ab208Adam Moore test_node_publish: function() {
4f2de35716c5df46152747980516af484d0ab208Adam Moore var node = Y.one('#adiv');
4f2de35716c5df46152747980516af484d0ab208Adam Moore var preventCount = 0, heard = 0;
4f2de35716c5df46152747980516af484d0ab208Adam Moore emitFacade: true,
4f2de35716c5df46152747980516af484d0ab208Adam Moore // should only be called once
4f2de35716c5df46152747980516af484d0ab208Adam Moore preventedFn: function() {
4f2de35716c5df46152747980516af484d0ab208Adam Moore preventCount++;
4f2de35716c5df46152747980516af484d0ab208Adam Moore node.on('foo1', function(e) {
4f2de35716c5df46152747980516af484d0ab208Adam Moore Y.Assert.areEqual('foo1', e._type);
4f2de35716c5df46152747980516af484d0ab208Adam Moore node.on('foo1', function(e) {
4f2de35716c5df46152747980516af484d0ab208Adam Moore type: 'faking foo'
4f2de35716c5df46152747980516af484d0ab208Adam Moore Y.Assert.areEqual(1, preventCount);
0dca577a07715960da42d47787eecc25b285182fAdam Moore // BUBBLE, ON
0dca577a07715960da42d47787eecc25b285182fAdam Moore // BUBBLE, DEFAULT BEHAVIOR
0dca577a07715960da42d47787eecc25b285182fAdam Moore // BUBBLE, AFTER
0dca577a07715960da42d47787eecc25b285182fAdam Moore // SRC, DEFAULT BEHAVIOR
0dca577a07715960da42d47787eecc25b285182fAdam Moore // SRC, AFTER
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore __testBubbleSequence300GA: function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore var count = 0,
0dca577a07715960da42d47787eecc25b285182fAdam Moore called = null,
0dca577a07715960da42d47787eecc25b285182fAdam Moore fn = function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore emitFacade: true,
0dca577a07715960da42d47787eecc25b285182fAdam Moore bubbles: true
482388c306e346930994afd7e59b3af43c00aac6Adam Moore leaf = new Y.EventTarget(config),
482388c306e346930994afd7e59b3af43c00aac6Adam Moore branch = new Y.EventTarget(config),
0dca577a07715960da42d47787eecc25b285182fAdam Moore root = new Y.EventTarget(config);
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.publish('test:foo', { defaultFn: fn});
0dca577a07715960da42d47787eecc25b285182fAdam Moore branch.publish('test:foo', { defaultFn: fn});
0dca577a07715960da42d47787eecc25b285182fAdam Moore root.publish('test:foo', { defaultFn: fn});
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.on('test:foo', function(e) {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(0, count, 'leaf.on should be first');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.isNull(called, 'leaf.on should be executed before any default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore branch.on('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(1, count, 'branch.on should be second');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.isNull(called, 'branch.on should be executed before any default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore root.on('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(2, count, 'root.on should be third');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.isNull(called, 'root.on should be executed before any default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore root.after('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(3, count, 'root.after should be fourth');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual('root', called, 'root.after should be executed after the root default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore branch.after('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(4, count, 'branch.after should be fifth');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual('branch', called, 'branch.after should be executed after the branch default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.after('test:foo', function(e) {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(5, count, 'leaf.after should be sixth and last');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual('leaf', called, 'leaf.after should be executed after the leaf default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.fire('test:foo', {}, leaf);
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // Ideally it should be this, but the defaultFn order is the least important bit
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // and there are issues changing the order.
0dca577a07715960da42d47787eecc25b285182fAdam Moore // BUBBLE, ON
0dca577a07715960da42d47787eecc25b285182fAdam Moore // SRC, DEFAULT BEHAVIOR
0dca577a07715960da42d47787eecc25b285182fAdam Moore // BUBBLE, DEFAULT BEHAVIOR (unless configured to only execute the default function on the target)
0dca577a07715960da42d47787eecc25b285182fAdam Moore // SRC, AFTER
0dca577a07715960da42d47787eecc25b285182fAdam Moore // BUBBLE, AFTER
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // The actual order is this:
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // BUBBLE, ON
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // BUBBLE, DEFAULT BEHAVIOR
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // SRC, DEFAULT BEHAVIOR (unless configured to only execute the default function on the target)
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // SRC, AFTER
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // BUBBLE, AFTER
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore testAlternativeSequencePost300GA: function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore var count = 0,
0dca577a07715960da42d47787eecc25b285182fAdam Moore called = null,
0dca577a07715960da42d47787eecc25b285182fAdam Moore fn = function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore emitFacade: true,
0dca577a07715960da42d47787eecc25b285182fAdam Moore bubbles: true
482388c306e346930994afd7e59b3af43c00aac6Adam Moore leaf = new Y.EventTarget(config),
482388c306e346930994afd7e59b3af43c00aac6Adam Moore branch = new Y.EventTarget(config),
0dca577a07715960da42d47787eecc25b285182fAdam Moore root = new Y.EventTarget(config);
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.publish('test:foo', { defaultFn: fn});
0dca577a07715960da42d47787eecc25b285182fAdam Moore branch.publish('test:foo', { defaultFn: fn});
0dca577a07715960da42d47787eecc25b285182fAdam Moore root.publish('test:foo', { defaultFn: fn});
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.on('test:foo', function(e) {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(0, count, 'leaf.on should be first');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.isNull(called, 'leaf.on should be executed before any default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore branch.on('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(1, count, 'branch.on should be second');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.isNull(called, 'branch.on should be executed before any default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore root.on('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(2, count, 'root.on should be third');
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.isNull(called, 'root.on should be executed before any default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.after('test:foo', function(e) {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(3, count, 'leaf.after should be fourth');
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // Y.Assert.areEqual('root', called, 'leaf.after should be executed after the root default function');
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore Y.Assert.areEqual('leaf', called, 'leaf.after should be executed after the root default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore branch.after('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(4, count, 'branch.after should be fifth');
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // Y.Assert.areEqual('root', called, 'leaf.after should be executed after the root default function');
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore Y.Assert.areEqual('leaf', called, 'leaf.after should be executed after the root default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore root.after('test:foo', function() {
0dca577a07715960da42d47787eecc25b285182fAdam Moore Y.Assert.areEqual(5, count, 'root.after should be sixth and last');
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore // Y.Assert.areEqual('root', called, 'leaf.after should be executed after the root default function');
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore Y.Assert.areEqual('leaf', called, 'leaf.after should be executed after the root default function');
0dca577a07715960da42d47787eecc25b285182fAdam Moore leaf.fire('test:foo', {}, leaf);
00a8d162b35725b8d543888e516723f5cb222f72Adam Moore Y.Assert.areEqual(6, count, 'total subscriber count');
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore testStarSubscriber: function() {
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore var count = 0,
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore emitFacade: true,
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore bubbles: true,
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore prefix: 'stars'
482388c306e346930994afd7e59b3af43c00aac6Adam Moore z = new Y.EventTarget(config),
482388c306e346930994afd7e59b3af43c00aac6Adam Moore a = new Y.EventTarget(config),
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore b = new Y.EventTarget(config);
dd3bb831f7d6a07193f48da84225f0df74f059adAdam Moore z.on('*:foo', function(e) {
dd3bb831f7d6a07193f48da84225f0df74f059adAdam Moore // b -> a -> z -- the parent's parent should be the target
dd3bb831f7d6a07193f48da84225f0df74f059adAdam Moore switch (count) {
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore ret = b.fire('a:foo', {}, b);
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore ret = b.fire('b:foo', {}, b);
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore // if the event target is not configured with a prefix, this won't work by design.
7b604197509a71120a1d0a11e3619d2cf12ae7e5Adam Moore ret = b.fire('foo', {}, b);
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore testPreventBubble: function() {
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore var count = 0,
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore emitFacade: true,
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore bubbles: true,
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore prefix: 'stars'
482388c306e346930994afd7e59b3af43c00aac6Adam Moore z = new Y.EventTarget(config),
482388c306e346930994afd7e59b3af43c00aac6Adam Moore a = new Y.EventTarget(config),
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore b = new Y.EventTarget(config);
5cbcc8e7f5c3e4ad283e5cb76520840300f81a0aAdam Moore z.after('*:foo', function(e) {
c7eb563867fa29409073f3b495a067d9afa00006Adam Moore ret = b.fire('a:foo', {}, b);
9ff461f1797a64eea59827655e3fbd0e2a1a10cfAdam Moore test_listen_once: function() {
9ff461f1797a64eea59827655e3fbd0e2a1a10cfAdam Moore var count = 0;
ad3e803b573f1ad93069380c0fa13ecac5ada5c5Adam Moore Y.once(['foo', 'bar'], function(e) {
9ff461f1797a64eea59827655e3fbd0e2a1a10cfAdam Moore Y.fire('foo', 'bar');
ad3e803b573f1ad93069380c0fa13ecac5ada5c5Adam Moore Y.fire('bar', 'bar');
9ff461f1797a64eea59827655e3fbd0e2a1a10cfAdam Moore Y.fire('foo', 'bar');
ad3e803b573f1ad93069380c0fa13ecac5ada5c5Adam Moore Y.fire('bar', 'bar');
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore test_array_type_param: function() {
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore var result = '';
e9a1463db83a41831766a7e13025b93b61552356Adam Moore var handle1 = Y.after(['foo', 'bar'], function(type) {
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore result += 'after' + type;
e9a1463db83a41831766a7e13025b93b61552356Adam Moore var handle2 = Y.on(['foo', 'bar'], function(type) {
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore result += 'on' + type;
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore Y.fire('foo', 'foo');
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore Y.fire('bar', 'bar');
e806a570fd5dbd8a6ef84c8e580763818b165618Adam Moore Y.Assert.areEqual('onfooafterfooonbarafterbar', result);
e9a1463db83a41831766a7e13025b93b61552356Adam Moore Y.fire('foo', 'foo');
e9a1463db83a41831766a7e13025b93b61552356Adam Moore Y.fire('bar', 'bar');
e9a1463db83a41831766a7e13025b93b61552356Adam Moore Y.Assert.areEqual('onfooafterfooonbarafterbar', result);
bd03a79f6dc612d2940a331a52ee4cf0f364b1baAdam Moore test_bubble_config: function() {
bd03a79f6dc612d2940a331a52ee4cf0f364b1baAdam Moore var a = new Y.EventTarget(),
482388c306e346930994afd7e59b3af43c00aac6Adam Moore emitFacade: true
bd03a79f6dc612d2940a331a52ee4cf0f364b1baAdam Moore b.on("foo", function(e) {
bd03a79f6dc612d2940a331a52ee4cf0f364b1baAdam Moore result = (e instanceof Y.EventFacade);
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith test_onceAfter: function () {
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith var a = new Y.EventTarget({ emitFacade: true, prefix: 'a' }),
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith result = '';
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith a.on('foo', function () { result += 'A'; });
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith a.once('foo', function () { result += 'B'; });
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith a.after('foo', function () { result += 'C'; });
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith a.onceAfter('foo', function () { result += 'D'; });
e1a238db8bc3bae8f67be06b3e6a70f7b9b6f4a0Luke Smith Y.Assert.areSame("ABCDAC", result);
ad40216913b3cb014e4e2d4db3049fe25150ec06Luke Smith test_multiple_object_publish: function () {
ad40216913b3cb014e4e2d4db3049fe25150ec06Luke Smith var target = new Y.EventTarget({ emitFacade: true, prefix: 'a' }),
ad40216913b3cb014e4e2d4db3049fe25150ec06Luke Smith defaultFn: function () { pass = true; }
80d2034f65b9348e5fd36291f03b0819181efb89Adam Moore Y.Test.Runner.add(testEventTarget);
0771d781138a507b3e657573703f511291640bf3Adam Moore // base: "/build/",
0771d781138a507b3e657573703f511291640bf3Adam Moore // filter: "debug",
0771d781138a507b3e657573703f511291640bf3Adam Moore // combine: false,
0771d781138a507b3e657573703f511291640bf3Adam Moore // useConsole: true,
0771d781138a507b3e657573703f511291640bf3Adam Moore // logExclude: {Dom: true, Selector: true, Node: true, attribute: true, base: true, loader: true, get: true, widget: true}
0771d781138a507b3e657573703f511291640bf3Adam Moore // }).use("datasource", function(Y) {