Implement removeDrive and removeImage in selection service

This commit is contained in:
Juan Cruz Viotti 2016-01-19 09:42:57 -04:00
parent ffbccc5aec
commit b3dde83083
3 changed files with 69 additions and 0 deletions

View File

@ -669,6 +669,30 @@ selectionState.service('SelectionStateService', function() {
return !!self.getImage();
};
/**
* @summary Remove drive
* @function
* @public
*
* @example
* SelectionStateService.removeDrive();
*/
this.removeDrive = function() {
self.setDrive(undefined);
};
/**
* @summary Remove image
* @function
* @public
*
* @example
* SelectionStateService.removeImage();
*/
this.removeImage = function() {
self.setImage(undefined);
};
/**
* @summary Clear all selections
* @function

View File

@ -123,6 +123,30 @@ selectionState.service('SelectionStateService', function() {
return !!self.getImage();
};
/**
* @summary Remove drive
* @function
* @public
*
* @example
* SelectionStateService.removeDrive();
*/
this.removeDrive = function() {
self.setDrive(undefined);
};
/**
* @summary Remove image
* @function
* @public
*
* @example
* SelectionStateService.removeImage();
*/
this.removeImage = function() {
self.setImage(undefined);
};
/**
* @summary Clear all selections
* @function

View File

@ -78,6 +78,17 @@ describe('Browser: SelectionState', function() {
});
describe('.removeDrive()', function() {
it('should clear the drive', function() {
SelectionStateService.removeDrive();
var drive = SelectionStateService.getDrive();
m.chai.expect(drive).to.be.undefined;
});
});
});
describe('given no drive', function() {
@ -128,6 +139,16 @@ describe('Browser: SelectionState', function() {
});
describe('.removeImage()', function() {
it('should clear the image', function() {
SelectionStateService.removeImage();
var image = SelectionStateService.getImage();
m.chai.expect(image).to.be.undefined;
});
});
});
describe('given no image', function() {