mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-13 12:47:28 +01:00
Remove focus-me directive
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
describe('focusMe Directive', function() {
|
||||
var element, scope;
|
||||
|
||||
beforeEach(module('habitrpg'));
|
||||
|
||||
beforeEach(inject(function($rootScope, $compile) {
|
||||
scope = $rootScope.$new();
|
||||
|
||||
element = "<input focus-me></input>";
|
||||
|
||||
element = $compile(element)(scope);
|
||||
scope.$digest();
|
||||
}));
|
||||
|
||||
it('focuses the element when appended to the DOM', function() {
|
||||
inject(function($timeout) {
|
||||
var focusSpy = sandbox.spy();
|
||||
|
||||
element.appendTo(document.body);
|
||||
element.on('focus', focusSpy);
|
||||
|
||||
$timeout.flush();
|
||||
expect(focusSpy).to.have.been.called;
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,25 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
(function(){
|
||||
angular
|
||||
.module('habitrpg')
|
||||
.directive('focusMe', focusMe);
|
||||
|
||||
focusMe.$inject = [
|
||||
'$timeout',
|
||||
'$parse'
|
||||
];
|
||||
|
||||
function focusMe($timeout, $parse) {
|
||||
return {
|
||||
link: function($scope, element, attrs) {
|
||||
var model = $parse(attrs.focusMe);
|
||||
$scope.$watch(model, function(value) {
|
||||
$timeout(function() {
|
||||
element[0].focus();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}());
|
||||
@@ -60,7 +60,6 @@
|
||||
|
||||
"js/directives/close-menu.directive.js",
|
||||
"js/directives/expand-menu.directive.js",
|
||||
"js/directives/focus-me.directive.js",
|
||||
"js/directives/from-now.directive.js",
|
||||
"js/directives/habitrpg-tasks.directive.js",
|
||||
"js/directives/hrpg-sort-checklist.directive.js",
|
||||
|
||||
Reference in New Issue
Block a user