mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Add first directive spec
This commit is contained in:
26
test/spec/directives/focus-me.directive.spec.js
Normal file
26
test/spec/directives/focus-me.directive.spec.js
Normal file
@@ -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 = "<input focus-me='model'></input>";
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user