From 34bba3db194f8077488adb6112a975e4802f39f8 Mon Sep 17 00:00:00 2001 From: konnorrogers Date: Tue, 7 May 2024 23:00:03 -0400 Subject: [PATCH] working on tests --- src/components/range/range.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/range/range.ts b/src/components/range/range.ts index 640cdc5b5..995f4496f 100644 --- a/src/components/range/range.ts +++ b/src/components/range/range.ts @@ -231,6 +231,22 @@ export default class WaRange extends WebAwesomeFormAssociated { } } + formStateRestoreCallback(...args: Parameters) { + const [value, reason] = args; + super.formStateRestoreCallback(value, reason); + + /** @ts-expect-error Type widening issue due to what a formStateRestoreCallback can accept. */ + this.input.value = value; + } + + formResetCallback() { + // @ts-expect-error We pass a Number, but it wants a string :shrug: + this.input.value = this.defaultValue; + this.value = this.defaultValue; + + super.formResetCallback(); + } + render() { const hasLabelSlot = this.hasSlotController.test('label'); const hasHelpTextSlot = this.hasSlotController.test('help-text');