Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6a065091de
commit
33aec33cba
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue