Skip to content

Commit

Permalink
sort sub documents by recent uploads first (#1725)
Browse files Browse the repository at this point in the history
* sort sub documents by recent uploads first

* unit test

* version change

* Unit test refactored

* version update

* new version

---------

Co-authored-by: Ritesh Dsouza <[email protected]>
  • Loading branch information
OgunyemiO and RiteshHMCTS committed Jul 4, 2024
1 parent d58c6ae commit e42d934
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.0.42",
"version": "7.0.43",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.0.42",
"version": "7.0.43",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ describe('CaseFileViewFolderComponent', () => {
documentFilterInputEl.dispatchEvent(new Event('input'));
fixture.detectChanges();
await fixture.whenStable();
component.sortDataSourceDescending(1)
fixture.detectChanges();
expect(component.filter).toHaveBeenCalled();

expect(component.documentTreeData).toEqual(treeData);
expect(treeData[3].children[0].upload_timestamp).toEqual('17 Nov 2022 00:00:00');
});

it('should generate tree data from categorised data', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AbstractAppConfig } from '../../../../../../app.config';
import {
CaseFileViewCategory,
CaseFileViewDocument,
CaseFileViewSortColumns,
CategoriesAndDocuments,
DocumentTreeNode,
DocumentTreeNodeType
Expand Down Expand Up @@ -100,6 +101,7 @@ export class CaseFileViewFolderComponent implements OnInit, OnDestroy {
// Initialise cdk tree with generated data
this.nestedDataSource = this.documentTreeData;
this.nestedTreeControl.dataNodes = this.documentTreeData;
this.sortDataSourceDescending(CaseFileViewSortColumns.DOCUMENT_UPLOAD_TIMESTAMP);
});
}

Expand Down

0 comments on commit e42d934

Please sign in to comment.