Javascript 为什么enzyme.find(';[htmlFor]';)返回两个元素而不是一个?

Javascript 为什么enzyme.find(';[htmlFor]';)返回两个元素而不是一个?,javascript,jquery,reactjs,enzyme,Javascript,Jquery,Reactjs,Enzyme,我正在测试下面的React无状态函数,它基本上是三个单选按钮: export default function (props) { return ( <ButtonToolbar className="float-right" aria-label="Toolbar with button groups"> <ButtonGroup className="mr-3" data-toggle="buttons" aria-label="

我正在测试下面的React无状态函数,它基本上是三个单选按钮:

export default function (props) {
    return (
        <ButtonToolbar className="float-right" aria-label="Toolbar with button groups">
          <ButtonGroup className="mr-3" data-toggle="buttons" aria-label="First group"
                onChange={props.handleLeaseOption}>
            <Label check htmlFor='option_active'
                    className={props.optionSelected === 'option_active' ?
                                classNameActive :
                                classNameInactive} >
              <Input type="radio"
                     name={name}
                     id='option_active'
                     value='option_active' /> Active
            </Label>
            <Label check htmlFor='option_inactive'
                    className={props.optionSelected === 'option_inactive' ?
                                classNameActive :
                                classNameInactive} >
              <Input type="radio"
                     name={name}
                     id='option_inactive'
                     value='option_inactive' /> Inactive
            </Label>
            <Label check htmlFor='option_all'
                    className={props.optionSelected === 'option_all' ?
                                classNameActive :
                                classNameInactive} >
              <Input type="radio"
                     name={name}
                     id='option_all'
                     value='option_all' /> All
            </Label>
          </ButtonGroup>
        </ButtonToolbar>);
}
使用上面的代码,我得到了一个错误:

Method “simulate” is only meant to be run on a single node. 2 found instead.
● Option Active

expect(jest.fn()).toBeCalledWith(expected)

Expected mock function to have been called with:
  ["option_active"]
But it was not called.
然后我将行选择器更改为:

const inputActive = wrapper.find('[htmlFor="' + ConstVariables.optionActive + '"]').first();
这一次我犯了一个错误:

Method “simulate” is only meant to be run on a single node. 2 found instead.
● Option Active

expect(jest.fn()).toBeCalledWith(expected)

Expected mock function to have been called with:
  ["option_active"]
But it was not called.
有人能帮忙吗。为什么我的选择器没有按预期工作?2.为什么不调用我的模拟函数