From 976bbe7af01bb30a8dc6907d8702e6be8ac4d5c1 Mon Sep 17 00:00:00 2001 From: 38elements <38elements@users.noreply.github.com> Date: Fri, 29 Jun 2018 01:49:38 +0900 Subject: [PATCH 1/2] fix: fix tagName --- packages/test-utils/src/wrapper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 77ed8c2c7..53d822d69 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -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` @@ -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` From 545b63acc8a520fc02f346ac91d96d7ba1fc756c Mon Sep 17 00:00:00 2001 From: 38elements Date: Fri, 29 Jun 2018 08:33:16 +0900 Subject: [PATCH 2/2] add test --- test/specs/wrapper/setChecked.spec.js | 1 + test/specs/wrapper/setSelected.spec.js | 1 + 2 files changed, 2 insertions(+) diff --git a/test/specs/wrapper/setChecked.spec.js b/test/specs/wrapper/setChecked.spec.js index 805b504b8..4c6accb09 100644 --- a/test/specs/wrapper/setChecked.spec.js +++ b/test/specs/wrapper/setChecked.spec.js @@ -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', () => { diff --git a/test/specs/wrapper/setSelected.spec.js b/test/specs/wrapper/setSelected.spec.js index c374af856..5b6375d5f 100644 --- a/test/specs/wrapper/setSelected.spec.js +++ b/test/specs/wrapper/setSelected.spec.js @@ -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', () => {