summaryrefslogtreecommitdiff
path: root/web-ui/src/common/flat_button/flat_button.spec.js
blob: 16f03acbd61ba4f9ef3380d82a0c2f6aa8f94669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { shallow } from 'enzyme';
import expect from 'expect';
import React from 'react';
import FlatButton from 'src/common/flat_button/flat_button';

describe('FlatButton', () => {
  let flatButton;

  beforeEach(() => {
    flatButton = shallow(<FlatButton name='logout' buttonText='Logout' fontIconClass='fa fa-sign-out' />);
  });

  it('renders a FlatButton of type submit with name logout', () => {
    expect(flatButton.find('FlatButton').props().name).toEqual('logout');
  });

  it('renders a FlatButton of type submit with text logout', () => {
    expect(flatButton.find('FlatButton').props().label).toEqual('Logout');
  });

  it('renders a FlatButton of type submit with title logout', () => {
    expect(flatButton.find('FlatButton').props().title).toEqual('Logout');
  });

  it('renders a FlatButton of type submit with aria-label logout', () => {
    expect(flatButton.find('FlatButton').props()['aria-label']).toEqual('Logout');
  });

  it('renders a FlatButton with given fontIcon class', () => {
    expect(flatButton.find('FlatButton').props().icon.props.className).toEqual('fa fa-sign-out');
  });
});