2016-05-25 01:25:43 +03:00
|
|
|
import React from 'react';
|
2017-02-06 11:53:31 +03:00
|
|
|
import { mount } from 'enzyme';
|
|
|
|
import { Button } from '../Button';
|
2017-01-05 04:42:18 +03:00
|
|
|
import theme from '../theme.css';
|
2015-11-04 22:20:00 +03:00
|
|
|
|
2017-01-26 20:05:32 +03:00
|
|
|
describe('Button', () => {
|
|
|
|
describe('#render', () => {
|
|
|
|
it('uses flat and neutral styles by default', () => {
|
2017-02-06 11:53:31 +03:00
|
|
|
const wrapper = mount(<Button theme={theme} />);
|
|
|
|
const { className } = wrapper.find('button').props();
|
2016-05-25 01:25:43 +03:00
|
|
|
expect(className).toContain(theme.flat);
|
|
|
|
expect(className).toContain(theme.neutral);
|
2015-11-04 22:20:00 +03:00
|
|
|
});
|
|
|
|
|
2017-01-26 20:05:32 +03:00
|
|
|
it('renders accent button with accent style', () => {
|
2017-02-06 11:53:31 +03:00
|
|
|
const wrapper = mount(<Button accent theme={theme} />);
|
|
|
|
const { className } = wrapper.find('button').props();
|
2016-05-25 01:25:43 +03:00
|
|
|
expect(className).toContain(theme.flat);
|
|
|
|
expect(className).toContain(theme.accent);
|
2015-11-04 22:20:00 +03:00
|
|
|
});
|
|
|
|
|
2017-01-26 20:05:32 +03:00
|
|
|
it('renders mini button with mini style', () => {
|
2017-02-06 11:53:31 +03:00
|
|
|
const wrapper = mount(<Button floating mini theme={theme} />);
|
|
|
|
const { className } = wrapper.find('button').props();
|
2016-05-25 01:25:43 +03:00
|
|
|
expect(className).toContain(theme.floating);
|
|
|
|
expect(className).toContain(theme.neutral);
|
|
|
|
expect(className).toContain(theme.mini);
|
2015-11-04 22:20:00 +03:00
|
|
|
});
|
|
|
|
|
2017-01-26 20:05:32 +03:00
|
|
|
it('renders mini accented button with both styles', () => {
|
2017-02-06 11:53:31 +03:00
|
|
|
const wrapper = mount(<Button accent mini theme={theme} />);
|
|
|
|
const { className } = wrapper.find('button').props();
|
2016-05-25 01:25:43 +03:00
|
|
|
expect(className).toContain(theme.flat);
|
|
|
|
expect(className).toContain(theme.accent);
|
|
|
|
expect(className).toContain(theme.mini);
|
2015-11-04 22:20:00 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|