Skip to content

Commit

Permalink
Merge branch 'master' into exui-2086-caseId-missing-in-mv
Browse files Browse the repository at this point in the history
  • Loading branch information
RiteshHMCTS authored Jul 19, 2024
2 parents aef4a28 + 118773a commit d613f46
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 58 deletions.
11 changes: 11 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## RELEASE NOTES

### Version 7.0.50
**EXUI-1298** MC - (Level-A) : DAC_No_Accessible_Name_01
**EXUI-1540** Accessibilty issues

### Version 7.0.49
**EXUI-1538** MC - (Level-A) : DAC_Tables_01
**EXUI-1539** MC - (Level-A) : DAC_Sortable_Tables_01

### Version 7.0.48
**EXUI-1952** Add time to date display in case file view

### Version 7.0.47
**EXUI-2082** Transparent background of calendar control

Expand Down
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.47-exui-2086-rc1",
"version": "7.0.50-exui-2086-rc1",
"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.47-exui-2086-rc1",
"version": "7.0.50-exui-2086-rc1",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ ccd-event-trigger {
.markdown h3 {
margin-bottom: 0px;
}

.hide-table-capion {
position: absolute;
visibility: hidden;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<span class="node__name node-name-document">
{{node.name}}
<br>
<span class="node__document-upload-timestamp">{{node.upload_timestamp | date:"dd MMM YYYY"}}</span>
<span class="node__document-upload-timestamp">{{node.upload_timestamp | date:"dd MMM YYYY HH:mm"}}</span>
</span>
<div class="node__document-options">
<ccd-case-file-view-folder-document-actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('CaseFileViewFolderComponent', () => {
document_filename: 'Ale encyclopedia',
document_binary_url: '/test/binary',
attribute_path: '',
upload_timestamp: '12 Mar 2023 00:00:00'
upload_timestamp: '12 Mar 2023 01:23:01'
}
]);

Expand Down Expand Up @@ -117,18 +117,18 @@ describe('CaseFileViewFolderComponent', () => {
const documentTreeContainerEl = nativeElement.querySelector('.document-tree-container');
expect(documentTreeContainerEl).toBeDefined();
const timestampElements = nativeElement.querySelectorAll('.node__document-upload-timestamp');
expect(timestampElements[0].textContent).toEqual('11 May 2023');
expect(timestampElements[1].textContent).toEqual('14 Apr 2023');
expect(timestampElements[2].textContent).toEqual('12 Mar 2023');
expect(timestampElements[0].textContent).toEqual('11 May 2023 00:00');
expect(timestampElements[1].textContent).toEqual('14 Apr 2023 00:00');
expect(timestampElements[2].textContent).toEqual('12 Mar 2023 01:23');
expect(timestampElements[3].textContent).toEqual('');
expect(timestampElements[4].textContent).toEqual('10 Feb 2023');
expect(timestampElements[5].textContent).toEqual('12 Apr 2023');
expect(timestampElements[6].textContent).toEqual('16 Mar 2023');
expect(timestampElements[7].textContent).toEqual('21 Jun 2022');
expect(timestampElements[8].textContent).toEqual('04 Nov 2022');
expect(timestampElements[9].textContent).toEqual('28 Dec 2022');
expect(timestampElements[10].textContent).toEqual('17 Nov 2022');
expect(timestampElements[11].textContent).toEqual('23 Feb 2023');
expect(timestampElements[4].textContent).toEqual('10 Feb 2023 00:00');
expect(timestampElements[5].textContent).toEqual('12 Apr 2023 00:00');
expect(timestampElements[6].textContent).toEqual('16 Mar 2023 00:00');
expect(timestampElements[7].textContent).toEqual('21 Jun 2022 00:00');
expect(timestampElements[8].textContent).toEqual('04 Nov 2022 00:00');
expect(timestampElements[9].textContent).toEqual('28 Dec 2022 00:00');
expect(timestampElements[10].textContent).toEqual('17 Nov 2022 00:00');
expect(timestampElements[11].textContent).toEqual('23 Feb 2023 00:00');
});

it('should call sortChildrenAscending on all children of nestedDataSource when calling sortDataSourceAscAlphabetically', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const categoriesAndDocumentsTestData: CategoriesAndDocuments = {
document_filename: 'Ale encyclopedia',
document_binary_url: '/test/binary',
attribute_path: '',
upload_timestamp: new Date(2023, 2, 12, 0, 0, 0, 0),
upload_timestamp: new Date(2023, 2, 12, 1, 23, 1, 0),
content_type: ''
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const aleEncyclopedia = {
document_filename: 'Ale encyclopedia',
document_binary_url: '/test/binary',
attribute_path: '',
upload_timestamp: '12 Mar 2023 00:00:00'
upload_timestamp: '12 Mar 2023 01:23:01'
};

export const whiskyHighland = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ <h2 class="heading-h2" id="search-result-heading__text" tabindex="-1">{{ (caseSt
</strong>
</div>

<div *ngIf="(hasResults() || hasDrafts())" class="pagination-top"
[attr.aria-label]="getTotalResults() + ' results have been found' | rpxTranslate" role="status">
<span class="text-16" id="search-result-summary__text">{{'Showing' | rpxTranslate}}
<div *ngIf="(hasResults() || hasDrafts())" class="pagination-top">
<output [attr.aria-label]="getTotalResults() + ' results have been found' | rpxTranslate"></output>
<span class="text-16" id="search-result-summary__text">{{'Showing' | rpxTranslate}}
<span class="govuk-!-font-weight-bold">{{ getFirstResult() }}</span>
{{'to' | rpxTranslate}}
<span class="govuk-!-font-weight-bold">{{ getLastResult() }}</span>
Expand All @@ -30,25 +30,22 @@ <h2 class="heading-h2" id="search-result-heading__text" tabindex="-1">{{ (caseSt
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="select-all" name="select-all" type="checkbox" (change)="selectAll()" [checked]="allOnPageSelected()" [disabled]="!canAnyBeShared()" />
<label class="govuk-label govuk-checkboxes__label" for="select-all">
Select all
</label>
</div>
</th>
<th *ngFor="let col of resultView.columns">
<table class="search-result-column-header"
[attr.aria-label]="('Sort by ' + col.label + ' ' + isSortAscending(col)? 'ascending' : 'descending') | rpxTranslate">
<tr>
<th>
<div class="search-result-column-label" (click)="sort(col)">
{{col.label | rpxTranslate}}
</div>
<div *ngIf="comparator(col)" class="search-result-column-sort">
<a (click)="sort(col)" class="sort-widget" [innerHTML]="sortWidget(col)" href="javascript:void(0)"></a>
</div>
</th>
</tr>
</table>
<th *ngFor="let col of resultView.columns" class="search-result-column-header"
[attr.aria-sort]="isSortAscending(col) === null ? null : (isSortAscending(col) ? 'ascending' : 'descending')">
<div>
<div class="search-result-column-label" (click)="sort(col)" (keyup)="noop()">
{{col.label | rpxTranslate}}
</div>
<div *ngIf="comparator(col)" class="search-result-column-sort">
<a (click)="sort(col)" class="sort-widget" [innerHTML]="sortWidget(col)" href="javascript:void(0)"></a>
</div>
</div>
</th>
<th *ngIf="activityEnabled()" style="width: 110px;"></th>
<th *ngIf="activityEnabled()" style="width: 110px;">&ZeroWidthSpace;</th>
</tr>
</thead>

Expand All @@ -61,6 +58,7 @@ <h2 class="heading-h2" id="search-result-heading__text" tabindex="-1">{{ (caseSt
<input class="govuk-checkboxes__input" id="select-{{ result.case_id }}" name="select-{{ result.case_id }}"
type="checkbox" (change)="changeSelection(result)" [checked]="isSelected(result)" [disabled]="!canBeShared(result)" />
<label class="govuk-label govuk-checkboxes__label" for="select-{{ result.case_id }}">
Select case {{ result.case_id }}
</label>
</div>
</td>
Expand Down Expand Up @@ -97,6 +95,7 @@ <h2 class="heading-h2" id="search-result-heading__text" tabindex="-1">{{ (caseSt
<input class="govuk-checkboxes__input" id="select-{{ result.case_id }}" name="select-{{ result.case_id }}"
type="checkbox" (change)="changeSelection(result)" [checked]="isSelected(result)" [disabled]="!canBeShared(result)" (keyup)="onKeyUp($event, result)" />
<label class="govuk-label govuk-checkboxes__label" for="select-{{ result.case_id }}">
Select case {{ result.case_id }}
</label>
</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import {
Jurisdiction,
PaginationMetadata,
SearchResultView,
SearchResultViewItem
SearchResultViewColumn,
SearchResultViewItem,
SortOrder
} from '../../domain';
import { CaseReferencePipe, SortSearchResultPipe } from '../../pipes';
import { ActivityService, BrowserService, FieldsUtils, SearchResultViewItemComparatorFactory, SessionStorageService } from '../../services';
Expand Down Expand Up @@ -350,7 +352,7 @@ describe('SearchResultComponent', () => {

it('should render an case activity column with header', () => {
const headRow = de.query(By.css('div>table>thead>tr th:nth-child(4)'));
expect(headRow.nativeElement.textContent).toBe('');
expect(headRow.nativeElement.textContent).not.toBeNull();
});

it('should not render an case activity column when activity is disabled', () => {
Expand Down Expand Up @@ -901,5 +903,26 @@ describe('SearchResultComponent', () => {
const pagination = de.query(By.css('div.pagination-top'));
expect(pagination).toBeFalsy();
});

it('should return true if the column is sorted in ascending order', () => {
const column = { case_field_id: 'PersonFirstName' } as SearchResultViewColumn;
component.consumerSortParameters = { column: 'PersonFirstName', order: SortOrder.ASCENDING, type: 'Text' };

expect(component.isSortAscending(column)).toBe(true);
});

it('should return false if the column is sorted in descending order', () => {
const column = { case_field_id: 'PersonFirstName' } as SearchResultViewColumn;
component.consumerSortParameters = { column: 'PersonFirstName', order: SortOrder.DESCENDING, type: 'Text' };

expect(component.isSortAscending(column)).toBe(false);
});

it('should return null if the column is not sorted', () => {
const column = { case_field_id: 'PersonFirstName' } as SearchResultViewColumn;
component.consumerSortParameters = { column: 'PersonLastName', order: SortOrder.ASCENDING, type: 'Text' };

expect(component.isSortAscending(column)).toBe(null);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -387,28 +387,11 @@ export class SearchResultComponent implements OnChanges, OnInit {
}

public isSortAscending(column: SearchResultViewColumn): boolean {
const currentSortOrder = this.currentSortOrder(column);

return currentSortOrder === SortOrder.UNSORTED || currentSortOrder === SortOrder.DESCENDING;
}

private currentSortOrder(column: SearchResultViewColumn): SortOrder {

let isAscending = true;
let isDescending = true;

if (this.comparator(column) === undefined) {
return SortOrder.UNSORTED;
}
for (let i = 0; i < this.resultView.results.length - 1; i++) {
const comparison = this.comparator(column).compare(this.resultView.results[i], this.resultView.results[i + 1]);
isDescending = isDescending && comparison <= 0;
isAscending = isAscending && comparison >= 0;
if (!isAscending && !isDescending) {
break;
}
// simple way to determine if the column param is sorted and if its asc/desc
if (this.consumerSortParameters.column === column.case_field_id) {
return this.consumerSortParameters.order === SortOrder.ASCENDING;
}
return isAscending ? SortOrder.ASCENDING : isDescending ? SortOrder.DESCENDING : SortOrder.UNSORTED;
return null;
}

public getFirstResult(): number {
Expand Down Expand Up @@ -457,4 +440,7 @@ export class SearchResultComponent implements OnChanges, OnInit {
}
}
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
noop(): void {}
}
Empty file added yarn-audit-issues
Empty file.

0 comments on commit d613f46

Please sign in to comment.