Skip to content

Commit

Permalink
[ACS-5654] Retain filter header in document list. (#8811)
Browse files Browse the repository at this point in the history
* [ACS-5654] Retain filter header in document list.

* [ACS-5654] Unit tests

* [ACS-5654] Unit tests

* [ACS-5654] Unit test fix.
  • Loading branch information
arohilaGL committed Sep 1, 2023
1 parent 9ce8b01 commit b4ffc86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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 '../data/share-datatable-adapter';

const mockDialog = {
open: jasmine.createSpy('open')
Expand Down Expand Up @@ -237,6 +238,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
.subscribe(val => this.contextActionCallback(val));

this.enforceSingleClickNavigationForMobile();
if (this.filterValue && Object.keys(this.filterValue).length > 0) {
this.showHeader = ShowHeaderMode.Always;
}
}

ngAfterContentInit() {
Expand Down

0 comments on commit b4ffc86

Please sign in to comment.