How to use the enzyme.mount function in enzyme

To help you get started, we’ve selected a few enzyme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github securingsincity / react-ace / tests / src / ace.spec.js View on Github external
it("should trigger the focus on mount", () => {
      const onFocusCallback = sinon.spy();
      mount(, mountOptions);

      // Read the focus
      expect(onFocusCallback.callCount).to.equal(1);
    });
github react-csv / react-csv / test / ComponentsSpec.js View on Github external
it(`persists new opened window`, () => {
        const openCallback = sinon.stub(window,'open').returns('newPage');
        const wrapper = mount( );
        const actualNewWindow= wrapper.instance().getWindow();
        expect(actualNewWindow).toEqual('newPage');
        openCallback.restore();
 
     });
  });
github react-z / react-swipe / test / Swipe.spec.js View on Github external
test('Swipe component', (t) => {
  const wrapper = mount(
    
      <li>1</li><li>2</li>
    
  )

  t.pass(
    expect(wrapper.props().elementId).toEqual('react-swipe-1')
  )

  t.pass(
    expect(wrapper.props().children[0]).toEqual(<li>1</li>)
  )

  t.end()
});
github vazco / uniforms / packages / uniforms-material / __tests__ / ListField.tsx View on Github external
test(' - renders correct label (specified)', () =&gt; {
  const element = ;
  const wrapper = mount(
    element,
    createContext({ x: { type: Array }, 'x.$': { type: String } }),
  );

  expect(wrapper.find(ListSubheader)).toHaveLength(1);
  expect(wrapper.find(ListSubheader).text()).toBe('ListFieldLabel');
});
github zakariaharti / react-awesome-notifications / src / components / Notification.spec.tsx View on Github external
it('should not remove the notification when dismissible is false',() =&gt; {
    notification.dismissible = false;

    const wrapper = mount(
      
        
      
    );

    wrapper.find(ConnectedNotification).simulate('click');
    expect(store.getActions()).toEqual([]);
  });
github 3scale / porta / spec / javascripts / LoginPage / FlashMessages.spec.jsx View on Github external
it('should render proper notification message', () =&gt; {
  const wrapper = mount()
  expect(wrapper.find('.pf-m-notice').exists()).toEqual(true)
  expect(wrapper.find('.pf-m-notice').text()).toContain('You are advised!')
})
github chuckbergeron / etherplate / spec / components / token / index_spec.js View on Github external
function setup() {
  const props = {
    token: {},
    match: {
      params: {
        tokenId: "4"
      }
    }
  }

  const enzymeWrapper = mount(
    
      
    
  )

  return {
    props,
    enzymeWrapper
  }
}
github microsoft / BotFramework-Emulator / packages / app / client / src / ui / dialogs / postMigrationDialog / postMigrationDialog.spec.tsx View on Github external
beforeEach(() =&gt; {
    mockStore = createStore(navBar);
    mockDispatch = jest.spyOn(mockStore, 'dispatch');
    wrapper = mount(
      
        
      
    );
    node = wrapper.find(PostMigrationDialog);
    instance = wrapper.find(PostMigrationDialog).instance();
  });
github Madmous / madClones / client / trello / src / app / routes / signUp / SignUp.spec.js View on Github external
errorMessage: {}
    },
    signUp: {
      isFetchingSuccessful: false,
      isFetching: false,

      errorMessage: {}
    },
    signUpActions: {}
  };

  const middlewares = [ thunk ];
  const mockStore = configureMockStore(middlewares);
  const store = mockStore(initialState);
  
  const wrapper = mount(
    
      
    ); 
  
  return {
    wrapper,
    store
  };
};