mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
Added test for task-focus directive
This commit is contained in:
parent
6564cb52dc
commit
06f59bed7c
1 changed files with 25 additions and 0 deletions
25
test/spec/directives/task-focus.directives.js
Normal file
25
test/spec/directives/task-focus.directives.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
describe('taskFocus Directive', function() {
|
||||
var elementToFocus, scope;
|
||||
|
||||
beforeEach(module('habitrpg'));
|
||||
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
|
||||
scope.focusThisLink = false;
|
||||
var element = '<a data-task-focus="focusThisLink" ></a>';
|
||||
|
||||
elementToFocus = $compile(element)(scope);
|
||||
scope.$digest();
|
||||
}));
|
||||
|
||||
it('places focus on the element it is applied to when the expression it binds to evaluates to true', function() {
|
||||
elementToFocus.appendTo(document.body);
|
||||
scope.focusThisLink = true;
|
||||
scope.$digest();
|
||||
expect(document.activeElement).to.eql(elementToFocus)
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue