Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #999 from Particular/add_select_all_to_archived_view
Add a `Select-all` button to archive view
- Loading branch information
Showing
4 changed files
with
149 additions
and
6 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
src/ServicePulse.Host.Tests/tests/js/views/archive/controller.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
describe('archivedMessageController', | ||
function() { | ||
beforeEach(module('sc')); | ||
|
||
var $controller; | ||
|
||
beforeEach(inject(function(_$controller_) { | ||
$controller = _$controller_; | ||
})); | ||
|
||
describe('when calling selectAllMessages', | ||
function() { | ||
var controller, serviceControlService, root, deferred, getFailedMessageSpy; | ||
|
||
beforeEach(inject(function ($rootScope, notifyService, $q) { | ||
root = $rootScope; | ||
this.notifyService = notifyService; | ||
serviceControlService = { getExceptionGroups: function () { }, getFailedMessages: function(){ } }; | ||
deferred = $q.defer(); | ||
spyOn(serviceControlService, 'getExceptionGroups').and.callFake(function () { | ||
|
||
return deferred.promise; | ||
}); | ||
|
||
getFailedMessageSpy = spyOn(serviceControlService, 'getFailedMessages').and.callFake(function () { | ||
return deferred.promise; | ||
}); | ||
|
||
controller = $controller('archivedMessageController', | ||
{ | ||
$scope: root, | ||
$interval: function(){}, | ||
sharedDataService: { getstats: function() { return { number_of_pending_retries: 0 }; }, getConfiguration: function() {return {data_retention: {error_retention_period: "00:00:00"}};} }, | ||
notifyService: notifyService, | ||
serviceControlService: serviceControlService, | ||
failedMessageGroupsService: null | ||
}); | ||
})); | ||
|
||
it('all messages should be selected', | ||
function () { | ||
|
||
controller.archives = [{id: 0, selected: false}, {id: 1, selected: false}, {id:2, selected: false}]; | ||
|
||
controller.selectAllMessages(); | ||
|
||
expect(controller.archives[0].selected).toEqual(true); | ||
expect(controller.archives[1].selected).toEqual(true); | ||
expect(controller.archives[2].selected).toEqual(true); | ||
expect(controller.selectedIds.length).toEqual(3); | ||
}); | ||
|
||
it('if any message was selected, all should be unselected', | ||
function () { | ||
|
||
controller.archives = [{id: 0, selected: false}, {id: 1, selected: true}, {id:2, selected: false}]; | ||
controller.selectedIds = [1]; | ||
|
||
controller.selectAllMessages(); | ||
|
||
expect(controller.archives[0].selected).toEqual(false); | ||
expect(controller.archives[1].selected).toEqual(false); | ||
expect(controller.archives[2].selected).toEqual(false); | ||
expect(controller.selectedIds.length).toEqual(0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters