mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Improving cancel task edit functionality. closes #7688
This commit is contained in:
@@ -30,11 +30,89 @@ describe('Tasks Controller', function() {
|
||||
});
|
||||
|
||||
describe('editTask', function() {
|
||||
it('is Tasks.editTask', function() {
|
||||
inject(function(Tasks) {
|
||||
expect(scope.editTask).to.eql(Tasks.editTask);
|
||||
});
|
||||
|
||||
var task;
|
||||
|
||||
beforeEach(function(){
|
||||
task = specHelper.newTask();
|
||||
});
|
||||
|
||||
it('toggles the _editing property', function() {
|
||||
scope.editTask(task, user);
|
||||
expect(task._editing).to.eql(true);
|
||||
});
|
||||
|
||||
it('sets _tags to true by default', function() {
|
||||
scope.editTask(task, user);
|
||||
|
||||
expect(task._tags).to.eql(true);
|
||||
});
|
||||
|
||||
it('sets _tags to false if preference for collapsed tags is turned on', function() {
|
||||
user.preferences.tagsCollapsed = true;
|
||||
scope.editTask(task, user);
|
||||
|
||||
expect(task._tags).to.eql(false);
|
||||
});
|
||||
|
||||
it('sets _advanced to true by default', function(){
|
||||
user.preferences.advancedCollapsed = true;
|
||||
scope.editTask(task, user);
|
||||
|
||||
expect(task._advanced).to.eql(false);
|
||||
});
|
||||
|
||||
it('sets _advanced to false if preference for collapsed advance menu is turned on', function() {
|
||||
user.preferences.advancedCollapsed = false;
|
||||
scope.editTask(task, user);
|
||||
|
||||
expect(task._advanced).to.eql(true);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('cancelEdit', function() {
|
||||
|
||||
var task;
|
||||
|
||||
beforeEach(function(){
|
||||
task = specHelper.newTask();
|
||||
});
|
||||
|
||||
it('resets the task text', function() {
|
||||
let originalText = task.text;
|
||||
scope.editTask(task, user);
|
||||
task.text = 'test';
|
||||
scope.cancelTaskEdit(task)
|
||||
expect(task.text).to.be.eql(originalText);
|
||||
});
|
||||
|
||||
it('resets the task notes', function() {
|
||||
let originalNotes = task.notes;
|
||||
scope.editTask(task, user);
|
||||
task.notes = 'test';
|
||||
scope.cancelTaskEdit(task)
|
||||
expect(task.notes).to.be.eql(originalNotes);
|
||||
});
|
||||
|
||||
it('resets the task alias', function() {
|
||||
task.alias = 'alias';
|
||||
let originalAlias = task.alias;
|
||||
scope.editTask(task, user);
|
||||
task.alias = 'test';
|
||||
scope.cancelTaskEdit(task)
|
||||
expect(task.alias).to.be.eql(originalAlias);
|
||||
});
|
||||
|
||||
it('resets the task priority', function() {
|
||||
let originalPriority = task.priority;
|
||||
scope.editTask(task, user);
|
||||
task.priority = 'test';
|
||||
scope.cancelTaskEdit(task)
|
||||
expect(task.priority).to.be.eql(originalPriority);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('removeTask', function() {
|
||||
|
||||
Reference in New Issue
Block a user