emitter instances with base

This commit is contained in:
rumman 2015-04-08 21:01:38 +02:00
parent 33046fff47
commit 11f4fa49b0

View file

@ -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