mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Simplify editTask
This commit is contained in:
@@ -176,17 +176,9 @@ describe('Challenges Controller', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('editTask', function() {
|
describe('editTask', function() {
|
||||||
it('calls Tasks.editTask', function() {
|
it('is Tasks.editTask', function() {
|
||||||
inject(function(Tasks) {
|
inject(function(Tasks) {
|
||||||
sinon.stub(Tasks, 'editTask');
|
expect(scope.editTask).to.eql(Tasks.editTask);
|
||||||
var task = {
|
|
||||||
id: 'task-id',
|
|
||||||
type: 'todo'
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.editTask(task);
|
|
||||||
expect(Tasks.editTask).to.be.calledOnce;
|
|
||||||
expect(Tasks.editTask).to.be.calledWith(task);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,17 +22,9 @@ describe('Tasks Controller', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('editTask', function() {
|
describe('editTask', function() {
|
||||||
it('calls Tasks.editTask', function() {
|
it('is Tasks.editTask', function() {
|
||||||
inject(function(Tasks) {
|
inject(function(Tasks) {
|
||||||
sinon.stub(Tasks, 'editTask');
|
expect(scope.editTask).to.eql(Tasks.editTask);
|
||||||
var task = {
|
|
||||||
id: 'task-id',
|
|
||||||
type: 'todo'
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.editTask(task);
|
|
||||||
expect(Tasks.editTask).to.be.calledOnce;
|
|
||||||
expect(Tasks.editTask).to.be.calledWith(task);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.editTask = function(task) {
|
$scope.editTask = Tasks.editTask;
|
||||||
Tasks.editTask(task);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create
|
* Create
|
||||||
|
|||||||
@@ -65,9 +65,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||||||
list.focus = true;
|
list.focus = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.editTask = function(task) {
|
$scope.editTask = Tasks.editTask;
|
||||||
Tasks.editTask(task);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the new task to the actions log
|
* Add the new task to the actions log
|
||||||
|
|||||||
Reference in New Issue
Block a user