diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-02 16:06:53 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-02 16:06:53 +0000 |
commit | 441c9e85dcb824dba2a44657a31fa29ad71a4ee1 (patch) | |
tree | e3558477d639a95bb5a24807d2a8174c73e1ac83 /js/tests/ElggEventsTest.js | |
parent | 99b267a9fc4b023e54a9d2c8ec9bd9fe42a32e54 (diff) | |
download | elgg-441c9e85dcb824dba2a44657a31fa29ad71a4ee1.tar.gz elgg-441c9e85dcb824dba2a44657a31fa29ad71a4ee1.tar.bz2 |
Refs #2538: Moved js directory to elgg root.
git-svn-id: http://code.elgg.org/elgg/trunk@7189 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/tests/ElggEventsTest.js')
-rw-r--r-- | js/tests/ElggEventsTest.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/tests/ElggEventsTest.js b/js/tests/ElggEventsTest.js new file mode 100644 index 000000000..cc30e8418 --- /dev/null +++ b/js/tests/ElggEventsTest.js @@ -0,0 +1,28 @@ +ElggEventsTest = TestCase("ElggEventsTest"); + +ElggEventsTest.prototype.setUp = function() { + elgg.config.events = {}; + elgg.provide('elgg.config.events.all.all'); +}; + +ElggEventsTest.prototype.testEventHandlersMustBeFunctions = function() { + assertException(function() { elgg.register_event_handler('str', 'str', 'oops'); }); +}; + +ElggEventsTest.prototype.testReturnValueDefaultsToTrue = function() { + assertTrue(elgg.trigger_event('fee', 'fum')); + + elgg.register_event_handler('fee', 'fum', function() {}); + assertTrue(elgg.trigger_event('fee', 'fum')); +}; + +ElggEventsTest.prototype.testCanGlomEventsWithAll = function() { + elgg.register_event_handler('all', 'bar', function() { throw new Error(); }); + assertException("all,bar", function() { elgg.trigger_event('foo', 'bar'); }); + + elgg.register_event_handler('foo', 'all', function() { throw new Error(); }); + assertException("foo,all", function() { elgg.trigger_event('foo', 'baz'); }); + + elgg.register_event_handler('all', 'all', function() { throw new Error(); }); + assertException("all,all", function() { elgg.trigger_event('pinky', 'winky'); }); +};
\ No newline at end of file |