nwt.unit
.describe('Tests NWTEvent.on with a node. (Click)')
.setup('<div id="event"><a href="#">Click me!</a></div>').run(function(unit) {
	nwt.one('#event a').on('click', function (e) {
		nwt.unit.equal('Click me!', this.getContent()).report();
	});
	nwt.one('#event a').click();
});


nwt.unit
.describe('Tests NWTEvent.on/once with a node. Making sure we remove the event')
.setup('<div id="event"><a href="#">Click me!</a></div>').run(function(unit) {

	var numEventsOn = 0,
		numEventsOnce = 0;

	nwt.one('#event a').on('click', function (e) {
		numEventsOn++;
	});
	nwt.one('#event a').once('click', function (e) {
		numEventsOnce++;
	});

	nwt.one('#event a').click();
	nwt.one('#event a').click();
	nwt.one('#event a').click();
	nwt.unit.equal(3, numEventsOn);
	nwt.unit.equal(1, numEventsOnce).report();
});

nwt.unit
.describe('Tests NWTEventIntance.noBubble')
.setup('<div id="event"><a href="#">Click me!</a></div>').run(function(unit) {

	var hitParent = false;

	// Tests noBubble
	nwt.one('#event').on('click', function (e) {
		hitParent = true;
	});
	
	nwt.one('#event a').on('click', function (e) {
		e.noBubble();
	});

	nwt.one('#event a').click();
	nwt.unit.isFalse(function() { return hitParent; }).report();
});


nwt.unit
.describe('Tests NWTEventIntance.noDefault')
.setup('<div id="eventnext"><input type="checkbox"></div>').run(function(unit) {

	var el = nwt.one('#eventnext input'),

		handleClick = function (e) {
			e.noDefault();
		};
		
	el.once('click', handleClick);
	el.click();
	nwt.unit.isFalse(function() { return el.get('checked'); });

	// The second click should work because we used on
	el.click();
	nwt.unit.isTrue(function() { return el.get('checked'); }).report();
});

nwt.unit
.describe('Tests event delegation with on and a selector')
.setup('<div id="event"><a id="first" class="yes" href="#">a</a><a id="second" href="#">b</a><a href="#" id="third" class="yes">c</a></div>').run(function(unit) {

	var genContent = "",
	
		populateResponse = function (e) {
			genContent += e.target.getContent()
		};
	
	nwt.one('#event').on('click', populateResponse, '.yes');

	nwt.one('#event a#first').click();
	nwt.one('#event a#second').click();
	nwt.one('#event a#third').click();

	nwt.unit.equal('ac', genContent).report();

	// Attempt to use event.once with a selector
	nwt.one('#event').off('click', populateResponse);

	nwt.one('#event').once('click', populateResponse, '.yes');

	nwt.one('#event a#first').click();
	nwt.one('#event a#second').click();
	nwt.one('#event a#third').click();

	nwt.unit.equal('aca', genContent).report();
});
@@ -1209,24 +1209,309 @@
 itParent; %7D)
+;%0A%0A%0A%09// Tests that custom events DO BUBBLE%0A%09var bubbleCount = 0;%0A%09nwt.one('#event').on('omgcustom', function (e) %7B%0A%09%09bubbleCount++;%0A%09%7D);%0A%09%0A%09nwt.one('#event a').on('omgcustom', function (e) %7B%0A%09%09bubbleCount++;%0A%09%7D);%0A%0A%09nwt.one('#event a').fire('omgcustom');%0A%09nwt.unit.equal(bubbleCount, 2)
 .report();%0A%7D
@@ -1505,24 +1505,25 @@
 ).report();%0A
+%0A
 %7D);%0A%0A%0Anwt.un
@@ -1979,25 +1979,16 @@
 ed'); %7D)
-.report()
 ;%0A%7D);%0A%0An
@@ -2799,32 +2799,32 @@
 ird').click();%0A%0A
-
 %09nwt.unit.equal(
@@ -2833,30 +2833,429 @@
 ca', genContent)
+;%0A%7D);%0A%0Anwt.unit%0A.describe('Tests custom events and custom event data')%0A.setup('%3Cdiv id=%22event%22%3E%3C/div%3E').run(function(unit) %7B%0A%0A%09var isFired = false,%0A%09%09testData;%0A%0A%09nwt.one('#event').once('customEvt', function(e, arg1)%7B%0A%09%09isFired = true;%0A%09%09testData = arg1.someKey;%0A%09%7D);%0A%0A%09nwt.one('#event').fire('customEvt', %7BsomeKey: 'someData'%7D);%0A%0A%09nwt.unit.equal(isFired, true);%0A%09nwt.unit.equal(testData, 'someData')
 .report();%0A%7D);

Add custom event test.