Skip to content

feat: Serialize select elements values#295

Merged
Robdel12 merged 3 commits intomasterfrom
rd/selects
Jul 22, 2019
Merged

feat: Serialize select elements values#295
Robdel12 merged 3 commits intomasterfrom
rd/selects

Conversation

@Robdel12
Copy link
Copy Markdown
Contributor

@Robdel12 Robdel12 commented Jul 15, 2019

What is this?

This will capture the selected values from <select> elements.

TODOs:

  • Fight TypeScript to maybe get union types going..
  • Remove scoped import from dom.test.ts file

@Robdel12 Robdel12 requested a review from djones July 15, 2019 19:37
@Robdel12 Robdel12 marked this pull request as ready for review July 16, 2019 14:56
@Robdel12 Robdel12 changed the title WIP: Serialize select elements values feature: Serialize select elements values Jul 16, 2019
@Robdel12 Robdel12 changed the title feature: Serialize select elements values feat: Serialize select elements values Jul 16, 2019
Robdel12 added 3 commits July 22, 2019 12:03
Still fighting TS though
I'd rather make something `any` than cast everything to a type that's incorrect
but makes TS happy.
Copy link
Copy Markdown
Contributor

@timhaines timhaines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Approving as all code makes sense when reading through. Trust you've exercised appropriately to consider it reliable.

const inputId = elem.getAttribute('data-percy-element-id')
const selector = `[data-percy-element-id="${inputId}"]`
const cloneEl = clonedDOM.querySelector(selector) as HTMLInputElement
const cloneEl = clonedDOM.querySelector(selector) as any
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called it out in the commit that made this change, but want to be clear here too.

I made this any since we're looping over an array of DOM nodes that can be any of these (at this time): select, input, textarea

Since TS doesn't allow you to recast a type, I'd rather make this any since the type of node can/will change with each loop.

@Robdel12 Robdel12 merged commit 3df435b into master Jul 22, 2019
@delete-merged-branch delete-merged-branch bot deleted the rd/selects branch July 22, 2019 17:34
djones pushed a commit that referenced this pull request Jul 22, 2019
# [0.9.0](v0.8.3...v0.9.0) (2019-07-22)

### Features

* Serialize select elements values ([#295](#295)) ([3df435b](3df435b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants