diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index e49c68d2b0..c8069da3cc 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -62,7 +62,7 @@ describe('Component vnMultiCheck', () => { }); describe('areAllChecked()', () => { - it(`should set return true if all elements are checked`, () => { + it(`should return true if all elements are checked`, () => { const data = controller.model.data; data[0].checked = true; data[1].checked = true; @@ -71,7 +71,7 @@ describe('Component vnMultiCheck', () => { expect(controller.areAllChecked()).toBeTruthy(); }); - it(`should set return false if not all elements are checked`, () => { + it(`should return false if not all elements are checked`, () => { const data = controller.model.data; data[0].checked = true; data[1].checked = false; @@ -82,7 +82,7 @@ describe('Component vnMultiCheck', () => { }); describe('areAllUnchecked()', () => { - it(`should set return true if all elements are unchecked`, () => { + it(`should return true if all elements are unchecked`, () => { const data = controller.model.data; data[0].checked = false; data[1].checked = false; @@ -91,7 +91,7 @@ describe('Component vnMultiCheck', () => { expect(controller.areAllUnchecked()).toBeTruthy(); }); - it(`should set return false if not all elements are unchecked`, () => { + it(`should return false if not all elements are unchecked`, () => { const data = controller.model.data; data[0].checked = false; data[1].checked = true; @@ -100,4 +100,36 @@ describe('Component vnMultiCheck', () => { expect(controller.areAllUnchecked()).toBeFalsy(); }); }); + + describe('setSelection()', () => { + it(`should check all elements between the index range`, () => { + controller.setSelection(true, 0, 2); + + const data = controller.model.data; + const firstRow = data[0]; + const secondRow = data[1]; + const thirdRow = data[2]; + + expect(firstRow.checked).toBeTruthy(); + expect(secondRow.checked).toBeTruthy(); + expect(thirdRow.checked).toBeTruthy(); + }); + + it(`should uncheck all elements between the index range`, () => { + const data = controller.model.data; + const firstRow = data[0]; + const secondRow = data[1]; + const thirdRow = data[2]; + + firstRow.checked = true; + secondRow.checked = true; + thirdRow.checked = true; + + controller.setSelection(false, 0, 1); + + expect(firstRow.checked).toBeFalsy(); + expect(secondRow.checked).toBeFalsy(); + expect(thirdRow.checked).toBeTruthy(); + }); + }); }); diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 4904f2ff15..fe7f60c148 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -28,7 +28,7 @@ describe('Ticket Component vnTicketDescriptor', () => { beforeEach(inject(($componentController, _$httpBackend_, _$state_) => { $httpBackend = _$httpBackend_; $httpBackend.whenGET(`Tickets/${ticket.id}/canHaveStowaway`).respond(true); - $httpBackend.whenGET(`Tickets/1/isEditable`).respond(true); + $httpBackend.expect('GET', `Tickets/${ticket.id}/isEditable`).respond(true); $state = _$state_; $state.params.id = 1;