Skip to content

Commit

Permalink
Merge pull request #55 from ynonp/master
Browse files Browse the repository at this point in the history
Add spec to Button component
  • Loading branch information
javivelasco committed Nov 6, 2015
2 parents 1547bd6 + 531e7e0 commit aa22c1d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions components/button/__test__/index.spec.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import expect from 'expect';
import style from '../../button/style';
import utils from '../../utils/testing';
import Button from '../index';

describe('Button', function () {
let button;

describe('#render', function () {

it('uses flat and primary styles by default', function () {
button = utils.shallowRenderComponent(Button);

expect(button.props.className).toContain(style.flat);
expect(button.props.className).toContain(style.primary);
});

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('1 renders mini button with mini style', function () {
button = utils.shallowRenderComponent(Button, { mini: true });

expect(button.props.className).toContain(style.flat);
expect(button.props.className).toContain(style.primary);
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);
});

});
});

0 comments on commit aa22c1d

Please sign in to comment.