Skip to content

Commit

Permalink
Add the fix and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RiteshHMCTS committed Nov 14, 2024
1 parent d80548e commit 47319a4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## RELEASE NOTES

### Version 7.0.77
**EXUI-2462** DynamicRadioList incorrectly selects the wrong radio button

### Version 7.0.75
**EXUI-2415** Redirect to an new event by a hyperlink

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.75",
"version": "7.0.77",
"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.75",
"version": "7.0.77",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,29 @@ describe('WriteDynamicRadioListFieldComponent', () => {
expect(attr(options[1], 'id')).toEqual('MaritalStatus_F');
expect(attr(options[2], 'id')).toEqual('MaritalStatus_O');
});

// Note: Currently unknown why this is the default for a parent with relevant value
it('test parent value sets element ID', () => {
component.parent = {value: {id: '1', value: 'value'}} as any;
fixture.detectChanges();
const options = de.queryAll($RADIO);

expect(options.length).toEqual(3);
expect(attr(options[0], 'type')).toEqual('radio');
expect(attr(options[0], 'id')).toEqual('1value');
expect(attr(options[1], 'id')).toEqual('1value');
expect(attr(options[2], 'id')).toEqual('1value');
});

it('test parent value not present', () => {
component.parent = {value: null} as any;
fixture.detectChanges();
const options = de.queryAll($RADIO);

expect(options.length).toEqual(3);
expect(attr(options[0], 'type')).toEqual('radio');
expect(attr(options[0], 'id')).toEqual('MaritalStatus_M');
expect(attr(options[1], 'id')).toEqual('MaritalStatus_F');
expect(attr(options[2], 'id')).toEqual('MaritalStatus_O');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class WriteDynamicRadioListFieldComponent extends AbstractFieldWriteCompo
}

public createElementId(name: string): string {
return this.parent && this.parent.value ? this.parent.value.id + this.parent.value.value : super.createElementId(name);
// EXUI-2462 - parent may not always have value with content
// this is independent from the caseField.list_items so is irrelevant to event journey
return this.parent?.value?.id ? this.parent.value.id + this.parent.value.value : super.createElementId(name);
}
}

0 comments on commit 47319a4

Please sign in to comment.