mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-23 14:17:05 +00:00
Fixed broken test by change element to a focusable element
This commit is contained in:
parent
06f59bed7c
commit
42066be2cf
1 changed files with 12 additions and 4 deletions
|
|
@ -9,17 +9,25 @@ describe('taskFocus Directive', function() {
|
|||
scope = $rootScope.$new();
|
||||
|
||||
scope.focusThisLink = false;
|
||||
var element = '<a data-task-focus="focusThisLink" ></a>';
|
||||
var element = '<input data-task-focus="focusThisLink" />';
|
||||
|
||||
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() {
|
||||
it('places focus on the element it is applied to when the expression it binds to evaluates to true',
|
||||
inject(function($timeout) {
|
||||
var focusSpy = sandbox.spy();
|
||||
|
||||
elementToFocus.appendTo(document.body);
|
||||
elementToFocus.on('focus', focusSpy);
|
||||
scope.focusThisLink = true;
|
||||
scope.$digest();
|
||||
expect(document.activeElement).to.eql(elementToFocus)
|
||||
});
|
||||
|
||||
$timeout.flush();
|
||||
expect(document.activeElement.dataset.taskFocus).to.eql("focusThisLink");
|
||||
expect(focusSpy).to.have.been.called;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue