Skip to content

Commit 4c9fe3c

Browse files
38elementseddyerburgh
authored andcommitted
fix: handle textarea correctly in setValue() and setChecked() (#771)
1 parent 71a2ac4 commit 4c9fe3c

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

packages/test-utils/src/wrapper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ export default class Wrapper implements BaseWrapper {
748748
this.trigger('change')
749749
}
750750
}
751-
} else if (tagName === 'INPUT' || tagName === 'textarea') {
751+
} else if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
752752
throwError(
753753
`wrapper.setChecked() cannot be called on "text" ` +
754754
`inputs. Use wrapper.setValue() instead`
@@ -795,7 +795,7 @@ export default class Wrapper implements BaseWrapper {
795795
`type="radio" /> element. Use wrapper.setChecked() ` +
796796
`instead`
797797
)
798-
} else if (tagName === 'INPUT' || tagName === 'textarea') {
798+
} else if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
799799
throwError(
800800
`wrapper.setSelected() cannot be called on "text" ` +
801801
`inputs. Use wrapper.setValue() instead`

test/specs/wrapper/setChecked.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ describeWithShallowAndMount('setChecked', mountingMethod => {
9393
const message =
9494
'wrapper.setChecked() cannot be called on "text" inputs. Use wrapper.setValue() instead'
9595
shouldThrowErrorOnElement('input[type="text"]', message)
96+
shouldThrowErrorOnElement('textarea', message)
9697
})
9798

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

test/specs/wrapper/setSelected.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describeWithShallowAndMount('setSelected', mountingMethod => {
4949
const message =
5050
'wrapper.setSelected() cannot be called on "text" inputs. Use wrapper.setValue() instead'
5151
shouldThrowErrorOnElement('input[type="text"]', message)
52+
shouldThrowErrorOnElement('textarea', message)
5253
})
5354

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

0 commit comments

Comments
 (0)