diff --git a/components/form/__tests__/label.test.js b/components/form/__tests__/label.test.js index cba6dcb93c..e0deb006e5 100644 --- a/components/form/__tests__/label.test.js +++ b/components/form/__tests__/label.test.js @@ -11,8 +11,8 @@ describe('Form', () => { // Use origin logic if (id) { - const input = this.getElementsByTagName('input')[0]; - if (input.id === id) { + const [input] = this.getElementsByTagName('input'); + if (input && input.id === id) { return input; } }