missing test
This commit is contained in:
parent
cf23d6c5b2
commit
6e3703b980
27
test/core.js
Normal file
27
test/core.js
Normal file
@ -0,0 +1,27 @@
|
||||
module('torque.core.Event');
|
||||
|
||||
function TestObj(){}
|
||||
TestObj.prototype = torque.Event;
|
||||
|
||||
test("on", function() {
|
||||
var called = false;
|
||||
var o = new TestObj();
|
||||
o.on('test', function() { called = true});
|
||||
o.trigger('test');
|
||||
equal(called, true);
|
||||
});
|
||||
|
||||
test("off", function() {
|
||||
var called = false;
|
||||
var o = new TestObj();
|
||||
function fn() { called = true; }
|
||||
o.on('test', fn);
|
||||
equal(o.callbacks('test').length, 1);
|
||||
o.off('test', fn);
|
||||
equal(o.callbacks('test').length, 0);
|
||||
o.trigger('test');
|
||||
equal(called, false);
|
||||
o.on('test', fn);
|
||||
o.off('test');
|
||||
equal(o.callbacks('test').length, 0);
|
||||
});
|
Loading…
Reference in New Issue
Block a user