how to select element text with react+enzyme

前端 未结 4 1062
不知归路
不知归路 2021-02-02 07:13

Just what it says. Some example code:

let wrapper = shallow(
); const b = wrapper
4条回答
  •  滥情空心
    2021-02-02 07:48

    I ran into this post when searching for ways to select all/some of the text within a textarea within jest and enzyme. For those who are looking for the same thing, you do can the following to select some text (provided you already know the length):

    let wrapper;
    let textareaNode;
    beforeEach(() => {
        wrapper = mount(