Skip to content

Commit

Permalink
fix: handle textarea correctly in setValue() and setChecked() (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
38elements authored and eddyerburgh committed Jun 29, 2018
1 parent 71a2ac4 commit 4c9fe3c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ export default class Wrapper implements BaseWrapper {
this.trigger('change')
}
}
} else if (tagName === 'INPUT' || tagName === 'textarea') {
} else if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
throwError(
`wrapper.setChecked() cannot be called on "text" ` +
`inputs. Use wrapper.setValue() instead`
Expand Down Expand Up @@ -795,7 +795,7 @@ export default class Wrapper implements BaseWrapper {
`type="radio" /> element. Use wrapper.setChecked() ` +
`instead`
)
} else if (tagName === 'INPUT' || tagName === 'textarea') {
} else if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
throwError(
`wrapper.setSelected() cannot be called on "text" ` +
`inputs. Use wrapper.setValue() instead`
Expand Down
1 change: 1 addition & 0 deletions test/specs/wrapper/setChecked.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describeWithShallowAndMount('setChecked', mountingMethod => {
const message =
'wrapper.setChecked() cannot be called on "text" inputs. Use wrapper.setValue() instead'
shouldThrowErrorOnElement('input[type="text"]', message)
shouldThrowErrorOnElement('textarea', message)
})

it('throws error if element is not valid', () => {
Expand Down
1 change: 1 addition & 0 deletions test/specs/wrapper/setSelected.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describeWithShallowAndMount('setSelected', mountingMethod => {
const message =
'wrapper.setSelected() cannot be called on "text" inputs. Use wrapper.setValue() instead'
shouldThrowErrorOnElement('input[type="text"]', message)
shouldThrowErrorOnElement('textarea', message)
})

it('throws error if element is not valid', () => {
Expand Down

0 comments on commit 4c9fe3c

Please sign in to comment.