diff --git a/src/elements/radio-button/radio-button-group/radio-button-group.spec.ts b/src/elements/radio-button/radio-button-group/radio-button-group.spec.ts index c943cfa02e..ce278fb0e3 100644 --- a/src/elements/radio-button/radio-button-group/radio-button-group.spec.ts +++ b/src/elements/radio-button/radio-button-group/radio-button-group.spec.ts @@ -71,13 +71,13 @@ import '../radio-button-panel.js'; expect(element.value).to.be.equal(radio.value); }); - it('should ignore disabled radios', async () => { + it('should respect disabled radio in value getter', async () => { const radio = radios[0]; radio.checked = true; radio.disabled = true; await waitForLitRender(element); - expect(element.value).to.be.null; + expect(element.value).to.be.equal('Value one'); }); it('should update disabled on children', async () => { diff --git a/src/elements/radio-button/radio-button-group/radio-button-group.ts b/src/elements/radio-button/radio-button-group/radio-button-group.ts index 633fc02c94..5a2665fb20 100644 --- a/src/elements/radio-button/radio-button-group/radio-button-group.ts +++ b/src/elements/radio-button/radio-button-group/radio-button-group.ts @@ -59,7 +59,7 @@ class SbbRadioButtonGroupElement extends SbbDisabledMixin(LitElement) { if (!this._didLoad) { return; } - if (!val) { + if (val == null) { this.radioButtons.forEach((r) => (r.checked = false)); return; } @@ -69,7 +69,7 @@ class SbbRadioButtonGroupElement extends SbbDisabledMixin(LitElement) { } } public get value(): string | null { - return this.radioButtons.find((r) => r.checked && !r.disabled)?.value ?? this._fallbackValue; + return this.radioButtons.find((r) => r.checked)?.value ?? this._fallbackValue; } /** * Used to preserve the `value` in case the radios are not yet 'loaded'