2018-04-03 23:45:53 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import { shallow, mount } from 'enzyme';
|
|
|
|
|
import Modal from '../Modal';
|
|
|
|
|
|
|
|
|
|
it('renders without crashing', () => {
|
|
|
|
|
shallow(<Modal />);
|
|
|
|
|
});
|
|
|
|
|
|
2018-04-04 01:09:29 +02:00
|
|
|
let actionButton;
|
|
|
|
|
let childButton;
|
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
|
|
beforeEach(()=>{
|
|
|
|
|
actionButton = <button key={0}>Dummy action button</button>;
|
|
|
|
|
childButton = <button key={1}>Child button</button>;
|
|
|
|
|
wrapper = mount(<Modal title={'Dummy title'} actions={[actionButton]}>{childButton}</Modal>);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it ('snapshot', () => {
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
|
});
|
|
|
|
|
|
2018-04-03 23:45:53 +02:00
|
|
|
it('receives props as expected', () =>{
|
|
|
|
|
expect(wrapper.props().title).toEqual('Dummy title');
|
|
|
|
|
expect(wrapper.props().actions).toEqual([actionButton]);
|
|
|
|
|
expect(wrapper.props().children).toEqual(childButton);
|
|
|
|
|
});
|