Skip to content

Commit

Permalink
tests: fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed May 8, 2023
1 parent 50e0399 commit 86c3587
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('Slick-Pagination Component', () => {

expect(translateService.getCurrentLanguage()).toBe('en');
expect(removeExtraSpaces(pageInfoFromTo.innerHTML)).toBe('<span class="item-from" data-test="item-from" aria-label="Page Item From">10</span>-<span class="item-to" data-test="item-to" aria-label="Page Item To">15</span> <span class="text-of">of</span> ');
expect(removeExtraSpaces(pageInfoTotalItems.innerHTML)).toBe('<span class="total-items" data-test="total-items">95</span> <span class="text-items">items</span> ');
expect(removeExtraSpaces(pageInfoTotalItems.innerHTML)).toBe('<span class="total-items" data-test="total-items" aria-label="Total Items">95</span> <span class="text-items">items</span> ');
component.dispose();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('Slick-Pagination Component', () => {

expect(translateService.getCurrentLanguage()).toBe('en');
expect(removeExtraSpaces(pageInfoFromTo.innerHTML)).toBe('<span class="item-from" data-test="item-from" aria-label="Page Item From">10</span>-<span class="item-to" data-test="item-to" aria-label="Page Item To">15</span> <span class="text-of">of</span> ');
expect(removeExtraSpaces(pageInfoTotalItems.innerHTML)).toBe('<span class="total-items" data-test="total-items">95</span> <span class="text-items">items</span> ');
expect(removeExtraSpaces(pageInfoTotalItems.innerHTML)).toBe('<span class="total-items" data-test="total-items" aria-label="Total Items">95</span> <span class="text-items">items</span> ');
expect(itemsPerPage.selectedOptions[0].value).toBe('5');
});

Expand Down Expand Up @@ -256,7 +256,7 @@ describe('with different i18n locale', () => {

it('should throw an error when enabling translate without a Translate Service', () => {
mockGridOptions.enableTranslate = true;
expect(() => new SlickPaginationComponent(paginationServiceStub, eventPubSubService, sharedService, null))
expect(() => new SlickPaginationComponent(paginationServiceStub, eventPubSubService, sharedService, null as any))
.toThrow('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');
});

Expand All @@ -269,7 +269,7 @@ describe('with different i18n locale', () => {
const pageInfoTotalItems = document.querySelector('.page-info-total-items') as HTMLSpanElement;
expect(translateService.getCurrentLanguage()).toBe('fr');
expect(removeExtraSpaces(pageInfoFromTo.innerHTML)).toBe(`<span class="item-from" data-test="item-from" aria-label="Page Item From">10</span>-<span class="item-to" data-test="item-to" aria-label="Page Item To">15</span> <span class="text-of">de</span> `);
expect(removeExtraSpaces(pageInfoTotalItems.innerHTML)).toBe(`<span class="total-items" data-test="total-items">95</span> <span class="text-items">éléments</span> `);
expect(removeExtraSpaces(pageInfoTotalItems.innerHTML)).toBe(`<span class="total-items" data-test="total-items" aria-label="Total Items">95</span> <span class="text-items">éléments</span> `);
done();
}, 50);
});
Expand Down

0 comments on commit 86c3587

Please sign in to comment.