Enzyme - How to access and set <input> value?

后端 未结 16 2124
面向向阳花
面向向阳花 2020-12-07 22:06

I\'m confused about how to access value when using mount. Here\'s what I\'ve got as my test:

  it(\'cancels changes w         


        
16条回答
  •  眼角桃花
    2020-12-07 22:10

    here is my code..

    const input = MobileNumberComponent.find('input')
    // when
    input.props().onChange({target: {
       id: 'mobile-no',
       value: '1234567900'
    }});
    MobileNumberComponent.update()
    const Footer = (loginComponent.find('Footer'))
    expect(Footer.find('Buttons').props().disabled).equals(false)
    

    I have update my DOM with componentname.update() And then checking submit button validation(disable/enable) with length 10 digit.

提交回复
热议问题