2019-09-08 14:47:55 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
|
|
|
import MainButton from '.';
|
|
|
|
import Button from '../button';
|
|
|
|
|
|
|
|
describe('<MainButton />', () => {
|
|
|
|
it('renders without error', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<MainButton text='Button' isDisabled={false} isDropdown={true}>
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label='Some button' />
|
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper).toExist();
|
|
|
|
});
|
2019-12-03 11:47:48 +00:00
|
|
|
|
|
|
|
it('accepts id', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<MainButton text='Button' isDisabled={false} isDropdown={true} id="testId">
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label='Some button' />
|
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.prop('id')).toEqual('testId');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('accepts className', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<MainButton text='Button' isDisabled={false} isDropdown={true} className="test">
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label='Some button' />
|
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.prop('className')).toEqual('test');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('accepts style', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<MainButton text='Button' isDisabled={false} isDropdown={true} style={{ color: 'red' }}>
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label='Some button' />
|
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.getDOMNode().style).toHaveProperty('color', 'red');
|
|
|
|
});
|
2019-09-08 14:47:55 +00:00
|
|
|
});
|