react-toolbox/components/button/__test__/index.spec.js

42 lines
1.4 KiB
JavaScript
Raw Normal View History

2015-11-04 22:20:00 +03:00
import expect from 'expect';
import style from '../../button/style';
import utils from '../../utils/testing';
2016-01-22 16:57:31 +03:00
import {RawButton as Button} from '../Button';
2015-11-04 22:20:00 +03:00
describe('Button', function () {
let button;
describe('#render', function () {
it('uses flat and neutral styles by default', function () {
2015-11-04 22:20:00 +03:00
button = utils.shallowRenderComponent(Button);
expect(button.props.className).toContain(style.flat);
expect(button.props.className).toContain(style.neutral);
2015-11-04 22:20:00 +03:00
});
it('renders accent button with accent style', function () {
button = utils.shallowRenderComponent(Button, { accent: true });
expect(button.props.className).toContain(style.flat);
expect(button.props.className).toContain(style.accent);
});
it('renders mini button with mini style', function () {
button = utils.shallowRenderComponent(Button, { floating: true, mini: true });
2015-11-04 22:20:00 +03:00
expect(button.props.className).toContain(style.floating);
expect(button.props.className).toContain(style.neutral);
2015-11-04 22:20:00 +03:00
expect(button.props.className).toContain(style.mini);
});
it('renders mini accented button with both styles', function () {
button = utils.shallowRenderComponent(Button, { mini: true, accent: true });
expect(button.props.className).toContain(style.flat);
expect(button.props.className).toContain(style.accent);
expect(button.props.className).toContain(style.mini);
});
});
});