"use strict";

describe('keyCapture', function() {
  beforeEach(module('arethusa.core'));

  describe('isCtrlActive', function() {
    it('return false before any event', inject(function(keyCapture) {
      expect(keyCapture.isCtrlActive()).toBe(false);
    }));

    it('return true if keydown for ctrl was received', inject(function(keyCapture) {
      keyCapture.keydown({ keyCode : keyCapture.keyCodes.ctrl });

      expect(keyCapture.isCtrlActive()).toBe(true);
    }));

    it('return false if keydown for ctrl was received', inject(function(keyCapture) {
      keyCapture.keydown({ keyCode : keyCapture.keyCodes.ctrl });
      keyCapture.keyup({ keyCode : keyCapture.keyCodes.ctrl });

      expect(keyCapture.isCtrlActive()).toBe(false);
    }));
  });

  describe('onKeyPressed', function() {
    it('calls the given callback', inject(function(keyCapture) {
      var callbackCalled = false;
      var callback = function() { callbackCalled = true; };
      keyCapture.onKeyPressed(keyCapture.keyCodes.esc, callback);

      keyCapture.keydown({ keyCode : keyCapture.keyCodes.esc });
      keyCapture.keyup({ keyCode : keyCapture.keyCodes.esc });

      expect(callbackCalled).toBe(true);
    }));
  });
});

@@ -100,503 +100,136 @@
 be('
-isCtrlActive', function() %7B%0A    it('return false before any event', inject(function(keyCapture) %7B%0A      expect(keyCapture.isCtrlActive()).toBe(false);%0A    %7D));%0A%0A    it('return true if keydown for ctrl was received', inject(function(keyCapture) %7B%0A      keyCapture.keydown(%7B keyCode : keyCapture.keyCodes.ctrl %7D);%0A%0A      expect(keyCapture.isCtrlActive()).toBe(true);%0A    %7D));%0A%0A    it('return false if keydown for ctrl was received', inject(function(keyCapture) %7B%0A      keyCapture.keydown(%7B
+onKeyPressed', function() %7B%0A    it('calls the given callback', inject(function(keyCapture) %7B%0A      var event = %7B%0A       
  keyCode
  : k
@@ -228,278 +228,54 @@
 Code
- 
 : 
-keyCapture.keyCodes.ctrl %7D);%0A      keyCapture.keyup(%7B keyCode : keyCapture.keyCodes.ctrl %7D);%0A%0A      expect(keyCapture.isCtrlActive()).toBe(false);%0A    %7D));%0A  %7D);%0A%0A  describe('onKeyPressed', function() %7B%0A    it('calls the given callback', inject(function(keyCapture) %7B
+27,%0A        target: %7B tagname: '' %7D%0A      %7D;
 %0A   
@@ -395,39 +395,21 @@
 Pressed(
-keyCapture.keyCodes.
+'
 esc
+'
 , callba
@@ -438,113 +438,16 @@
 .key
-down(%7B keyCode : keyCapture.keyCodes.esc %7D);%0A      keyCapture.keyup(%7B keyCode : keyCapture.keyCodes.esc %7D
+up(event
 );%0A%0A

Remove obsolete specs for keyCapture service