Javascript 酶在组件内部单击按钮在组件内部

Javascript 酶在组件内部单击按钮在组件内部,javascript,reactjs,enzyme,storybook,Javascript,Reactjs,Enzyme,Storybook,我现在正在写一本React Javascript故事书,我试图弄明白如何让酶在组件中点击组件内部的按钮。换句话说,这就是结构 <Component 1> <Component 2> <Button> </Component 2> </Component 1> 我想点击Component 2里面的按钮。到目前为止,我有这个 storesOf("Press the button",module).add("Button

我现在正在写一本React Javascript故事书,我试图弄明白如何让酶在组件中点击组件内部的按钮。换句话说,这就是结构

<Component 1>
   <Component 2>
    <Button>
   </Component 2>
</Component 1>
我想点击Component 2里面的按钮。到目前为止,我有这个

storesOf("Press the button",module).add("Button press:,() => {
    let output;
    specs(() => describe('clicked',function () {
        it("Should do the thing",function () {
            output = mount(<Component 1/>);
            output.find("Button").at(0).simulate("click")
        })
    }));

    const Inst = () => output.instance();
    return <Inst/>;
});
有人有什么建议吗?我还应该补充的是,从目前起,它没有找到任何按钮来单击,因为您可以使用React组件构造函数作为选择器。您可以这样做:

output = mount(<Component1 />);
output.find(Component2).find(Button).simulate("click")