Merge "Increase Create Volume Step Coverage NG Images"

This commit is contained in:
Jenkins 2016-02-24 12:21:16 +00:00 committed by Gerrit Code Review
commit 49a894203a
2 changed files with 57 additions and 1 deletions

View File

@ -162,7 +162,7 @@
}
function updateStorageGraph() {
if (ctrl.volume.size > 0) {
if (ctrl.volume.size >= 0) {
var totalGigabytesAllocated = ctrl.volume.size + ctrl.totalGigabytesUsed;
ctrl.storageQuota.data[0].value = ctrl.totalGigabytesUsed;
ctrl.storageQuota.data[1].value = ctrl.volume.size;

View File

@ -220,6 +220,62 @@
expect(graph.overMax).toBeTruthy();
});
it('should not change if volume size is 0', function() {
getAbsoluteLimitsSpy.and.returnValue({
success: function(callback) {
return callback({
maxTotalVolumeGigabytes: 2,
totalVolumesUsed: 1,
maxTotalVolumes: 5,
totalGigabytesUsed: 1
});
}
});
var ctrl = createController();
var graph = ctrl.storageQuota;
var current = graph.data[0];
var added = graph.data[1];
var remaining = graph.data[2];
ctrl.volume.size = 0;
$scope.$apply();
expect(current.value).toEqual(1);
expect(added.value).toEqual(0);
expect(remaining.value).toEqual(1);
expect(graph.label).toEqual('50%');
expect(graph.maxLimit).toEqual(2);
});
it('should not change if volume size is < 0', function() {
getAbsoluteLimitsSpy.and.returnValue({
success: function(callback) {
return callback({
maxTotalVolumeGigabytes: 2,
totalVolumesUsed: 1,
maxTotalVolumes: 5,
totalGigabytesUsed: 1
});
}
});
var ctrl = createController();
var graph = ctrl.storageQuota;
var current = graph.data[0];
var added = graph.data[1];
var remaining = graph.data[2];
ctrl.volume.size = -1;
$scope.$apply();
expect(current.value).toEqual(current.value);
expect(added.value).toEqual(added.value);
expect(remaining.value).toEqual(remaining.value);
expect(graph.label).toEqual(graph.label);
expect(graph.maxLimit).toEqual(graph.maxLimit);
});
it('should emit volumeChanged event when a volume attribute is changed', function() {
var ctrl = createController();