mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
emitter instances with base
This commit is contained in:
parent
33046fff47
commit
11f4fa49b0
1 changed files with 3 additions and 9 deletions
|
@ -12,14 +12,8 @@
|
||||||
|
|
||||||
module('Emitter');
|
module('Emitter');
|
||||||
|
|
||||||
function emitterFactory() {
|
|
||||||
var emitter = {};
|
|
||||||
paper.Base.each(Emitter, function (f, k) {emitter[k] = f});
|
|
||||||
return emitter;
|
|
||||||
}
|
|
||||||
|
|
||||||
test('on()', function() {
|
test('on()', function() {
|
||||||
var emitter = emitterFactory(),
|
var emitter = new Base(Emitter),
|
||||||
installed;
|
installed;
|
||||||
// fake event type registration
|
// fake event type registration
|
||||||
emitter._eventTypes = {mouseMove: {install: function(){ installed = true;} } };
|
emitter._eventTypes = {mouseMove: {install: function(){ installed = true;} } };
|
||||||
|
@ -43,7 +37,7 @@ test('on()', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('off()', function() {
|
test('off()', function() {
|
||||||
var emitter = emitterFactory(),
|
var emitter = new Base(Emitter),
|
||||||
uninstalled, called = 0,
|
uninstalled, called = 0,
|
||||||
handler = function () {called++},
|
handler = function () {called++},
|
||||||
handler2 = function () {};
|
handler2 = function () {};
|
||||||
|
@ -74,7 +68,7 @@ test('off()', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('emit()', function() {
|
test('emit()', function() {
|
||||||
var emitter = emitterFactory(),
|
var emitter = new Base(Emitter),
|
||||||
called,
|
called,
|
||||||
handler = function (e) {called = e};
|
handler = function (e) {called = e};
|
||||||
// fake event type registration
|
// fake event type registration
|
||||||
|
|
Loading…
Reference in a new issue