[ACS-5654] Unit tests

This commit is contained in:
Aayush Rohila
2023-08-23 15:02:36 +05:30
parent 28919566bc
commit ab40686668
2 changed files with 12 additions and 1 deletions
@@ -63,6 +63,7 @@ import { matIconRegistryMock } from '../../testing/mat-icon-registry-mock';
import { domSanitizerMock } from '../../testing/dom-sanitizer-mock';
import { MatDialog } from '@angular/material/dialog';
import { FileAutoDownloadComponent } from './file-auto-download/file-auto-download.component';
import { ShareDataTableAdapter } from '../public-api';
const mockDialog = {
open: jasmine.createSpy('open')
@@ -278,6 +279,15 @@ describe('DocumentList', () => {
expect(documentList.selection).toEqual([]);
});
it('should show the header when there are no records in the table but filter is active', () => {
documentList.data = new ShareDataTableAdapter(thumbnailService, contentService, []);
documentList.filterValue = { $thumbnail: 'TYPE:"cm:folder"' };
fixture.detectChanges();
expect(documentList.showHeader).toEqual('always');
});
it('should reloadWithoutResettingSelection not reset the selection', () => {
documentList.selection = [{ entry: mockNode3 }];
documentList.reloadWithoutResettingSelection();
@@ -236,6 +236,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
/** @hidden */
@Input()
_rowFilter: RowFilter | null = null;
documentList: any[];
/**
* Custom function to choose whether to show or hide rows.
@@ -451,7 +452,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
.subscribe(val => this.contextActionCallback(val));
this.enforceSingleClickNavigationForMobile();
if (Object.keys(this.filterValue).length > 0) {
if (this.filterValue && Object.keys(this.filterValue).length > 0) {
this.showHeader = ShowHeaderMode.Always;
}
}