Skip to content

Commit

Permalink
Fix emit events on 'window' and 'document' objects
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-matos authored and kriszyp committed Feb 3, 2014
1 parent 5a93bd3 commit 47c2126
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/on/on.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ define([
signal.remove(); signal.remove();
signal2.remove(); signal2.remove();


// make sure 'document' and 'window' can also emit events
var eventEmitted;
var globalObjects = [document, window];
for(var i = 0, len = globalObjects.length; i < len; i++) {
eventEmitted = false;
on(globalObjects[i], 'custom-test-event', function () {
eventEmitted = true;
});
on.emit(globalObjects[i], 'custom-test-event', {});
t.is(true, eventEmitted);
}

// test out event delegation // test out event delegation
if(query){ if(query){
// if dojo.query is loaded, test event delegation // if dojo.query is loaded, test event delegation
Expand Down

0 comments on commit 47c2126

Please sign in to comment.