refs #4764 add test front
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-08-01 12:33:56 +02:00
parent 12acda0b1c
commit 79d88facc3
2 changed files with 24 additions and 10 deletions

View File

@ -32,7 +32,6 @@
vn-acl="invoicing, claimManager, salesAssistant" vn-acl="invoicing, claimManager, salesAssistant"
vn-acl-action="remove"> vn-acl-action="remove">
</vn-button> </vn-button>
{{ $ctrl.checkeds }}
</vn-button-bar> </vn-button-bar>
<vn-horizontal ng-repeat="service in $ctrl.services"> <vn-horizontal ng-repeat="service in $ctrl.services">
<vn-check <vn-check

View File

@ -19,12 +19,11 @@ describe('Ticket component vnTicketService', () => {
describe('getDefaultTaxClass', () => { describe('getDefaultTaxClass', () => {
it('should set the default tax class in the controller', () => { it('should set the default tax class in the controller', () => {
$httpBackend.whenRoute('GET', `TaxClasses/findOne`) $httpBackend.whenRoute('GET', `TaxClasses/findOne`).respond({
.respond({ id: 4000,
id: 4000, name: 'Whatever',
name: 'Whatever', code: 'GG',
code: 'GG' });
});
controller.getDefaultTaxClass(); controller.getDefaultTaxClass();
$httpBackend.flush(); $httpBackend.flush();
@ -49,15 +48,15 @@ describe('Ticket component vnTicketService', () => {
it('should set the description of the selected service upon service type creation', () => { it('should set the description of the selected service upon service type creation', () => {
const service = { const service = {
id: 1, id: 1,
quantity: 10 quantity: 10,
}; };
$scope.newServiceType = { $scope.newServiceType = {
name: 'Totally new stuff' name: 'Totally new stuff',
}; };
$httpBackend.when('POST', 'TicketServiceTypes').respond({ $httpBackend.when('POST', 'TicketServiceTypes').respond({
id: 4001, id: 4001,
name: 'Totally new stuff' name: 'Totally new stuff',
}); });
controller.onNewServiceTypeAccept(service); controller.onNewServiceTypeAccept(service);
$httpBackend.flush(); $httpBackend.flush();
@ -65,4 +64,20 @@ describe('Ticket component vnTicketService', () => {
expect(service.ticketServiceTypeFk).toEqual(4001); expect(service.ticketServiceTypeFk).toEqual(4001);
}); });
}); });
describe('addChecked', () => {
it('should add an item to the checkeds array', () => {
controller.checkeds = [];
controller.addChecked(1);
expect(controller.checkeds).toEqual([1]);
});
it('should remove an item if it is already in the checkeds array', () => {
controller.checkeds = [1, 2, 3];
controller.addChecked(2);
expect(controller.checkeds).toEqual([1, 3]);
});
});
}); });