beCodeMyFriend/Cuore.js — Issue #10: testing collaboration handler - component
Author: hell03610
Created: 2012-03-03 18:26:28+00:00
State: open

When handler has logic and it's tested, it would be nice to test that a component uses that handler for some event, instead of dispatching the event and testing again handler and component.

Testing collaboration nowadays (breaking some rules):
it("uses LoginHandler to handle the login", function() {
var button = new LoginButton('name','key');
var handlers = button.handlerSet.handlersForEvent['LoginService_login_EXECUTED'];
expect(handlers[0] instanceof LoginHandler);
});

Suggested test/api:
it("uses LoginHandler to handle the login", function() {
var button = new LoginButton('name','key');
var handlers = button.getHandlersFor('LoginService_login_EXECUTED');
expect(handlers[0] instanceof LoginHandler);
});