Add support for checkboxes and radio buttons
Noticed while adding some requested form support that inputs with a checked state are not accounted for, as they are dropped in the field.value !== field.defaultValue check. This adds support for them! And adds checkboxes to the test. I'm not sure this is the world's most elegant approach, but I think it's easy to understand and doesn't introduce a ton of logic.
Also included is an example/test page that I made to check that this wasn't a bug caused by something else in the bigger stack. The page has a button to set the sessionStorage, as I found it difficult to debug otherwise, but not a submit button. Happy to add a submit button :)
Updated the PR to account for default checked checkboxes that get unchecked, along with a test for it. Hoping this is good to go so I can also move the work along on the actual form implementation side 🤞
@seanpdoyle the changes make sense, however there are currently several failing tests on this branch. Can you please have a look? Thanks!
UPDATE: @seanpdoyle here's a PR against this branch that fixes the tests https://github.com/helen/session-resume/pull/1
🚀 This has shipped in v0.5.0
- https://www.npmjs.com/package/@github/session-resume/v/0.5.0
- https://github.com/github/session-resume/releases/tag/v0.5.0