[ACS-10083] Filter not behaving correctly in file and site (#4817)

* [ACS-10083]: adds query decoding

* [ACS-10083]: adds unit test for added feature

* [ACS-10083]: unit test fix

* [ACS-10083]: minor fixes

* [ACS-10083]: circular dep fix

* [ACS-10083]: removes redundant code

* [ACS-10083]: test fix
This commit is contained in:
rmnvch
2025-10-28 12:43:36 +01:00
committed by GitHub
parent cd330c290d
commit 83bc55e6bb
4 changed files with 31 additions and 50 deletions
@@ -259,11 +259,4 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
onSortingChanged(event: any) {
this.filterSorting = event.detail.key + '-' + event.detail.direction;
}
onAllFilterCleared() {
if (!this.isOutletPreviewUrl()) {
this.documentList.node = null;
this.documentListService.reload();
}
}
}
@@ -26,11 +26,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageComponent } from './document-base-page.component';
import { AppState, SetSelectedNodesAction, ViewNodeAction } from '@alfresco/aca-shared/store';
import { LibTestingModule, discoveryApiServiceMockValue, DocumentBasePageServiceMock } from '@alfresco/aca-shared';
import { NodeEntry, NodePaging } from '@alfresco/js-api';
import { NodeEntry } from '@alfresco/js-api';
import { DocumentBasePageService } from './document-base-page.service';
import { Store } from '@ngrx/store';
import { Component } from '@angular/core';
import { DiscoveryApiService, DocumentListComponent, DocumentListService, SearchAiInputState, SearchAiService } from '@alfresco/adf-content-services';
import { DiscoveryApiService, DocumentListService, SearchAiInputState, SearchAiService } from '@alfresco/adf-content-services';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { provideCoreAuth, UserPreferencesService } from '@alfresco/adf-core';
import { of, Subscription } from 'rxjs';
@@ -157,41 +157,6 @@ describe('PageComponent', () => {
expect(store.dispatch['calls'].mostRecent().args[0]).toEqual(new SetSelectedNodesAction([node]));
});
it('should clear results onAllFilterCleared event', () => {
spyOn(documentListService, 'reload');
component.documentList = {
node: {
list: {
pagination: {},
entries: [{ entry: { id: 'new-node-id' } }]
}
} as NodePaging
} as DocumentListComponent;
spyOn(store, 'dispatch');
component.onAllFilterCleared();
expect(component.documentList.node).toBe(null);
expect(documentListService.reload).toHaveBeenCalled();
});
it('should call onAllFilterCleared event if page is viewer outlet', () => {
window.history.pushState({}, null, `${locationHref}#test(viewer:view)`);
const nodePaging = {
list: {
pagination: {},
entries: [{ entry: { id: 'new-node-id' } }]
}
} as NodePaging;
component.documentList = { node: nodePaging } as DocumentListComponent;
spyOn(store, 'dispatch');
component.onAllFilterCleared();
expect(component.documentList.node).toEqual(nodePaging);
expect(store.dispatch).not.toHaveBeenCalled();
});
it('should call ViewNodeAction on showPreview for selected node', () => {
spyOn(store, 'dispatch');
const node = {