diff --git a/test/spec/directives/focus-me.directive.spec.js b/test/spec/directives/focus-me.directive.spec.js new file mode 100644 index 0000000000..f958a7b70e --- /dev/null +++ b/test/spec/directives/focus-me.directive.spec.js @@ -0,0 +1,26 @@ +'use strict'; + +describe('focusMe Directive', function() { + var element, scope; + + beforeEach(module('habitrpg')); + + beforeEach(inject(function($rootScope, $compile) { + scope = $rootScope.$new(); + + element = ""; + + element = $compile(element)(scope); + scope.$digest(); + })); + + it('focuses the element when appended to the DOM', function(done) { + inject(function($timeout) { + element.appendTo(document.body); + + element.on('focus', function() { done() }); + + $timeout.flush(); + }); + }); +});