score:6

Accepted answer
const wrapper = shallowTestComponent();
const toggler = wrapper.find(NavbarToggler);

// initial state
expect(wrapper.find(NavbarCollapsibleContent).props().isOpen).toBe(false);

// click to expand (i.e. NOT collapse)
toggler.simulate("click");
expect(wrapper.find(NavbarCollapsibleContent).props().isOpen).toBe(true);

// click to collapse
toggler.simulate("click");
expect(wrapper.find(NavbarCollapsibleContent).props().isOpen).toBe(false);

Related Query

More Query from same tag