[Ivan Diaz] - Fix indentation of unit test [skip ci]

This commit is contained in:
Ivan Diaz 2016-01-26 10:39:36 -03:00
parent 07c0a03c62
commit bd5e14d5a1
2 changed files with 33 additions and 32 deletions

View File

@ -3,33 +3,34 @@ jest.dontMock('../button.js');
import React from 'react/addons'; import React from 'react/addons';
import Button from '../button.js'; import Button from '../button.js';
var TestUtils = React.addons.TestUtils; let TestUtils = React.addons.TestUtils;
describe('Button', () => { describe('Button', function () {
it('should render children', () => { it('should render children', function () {
var button = TestUtils.renderIntoDocument( let button = TestUtils.renderIntoDocument(
<Button> <Button>
testcontent testcontent
</Button> </Button>
); );
expect(button.getDOMNode().textContent).toEqual('testcontent'); expect(button.getDOMNode().textContent).toEqual('testcontent');
}); });
it('should add passed types to class', () => { it('should add passed types to class', function () {
var types = [ let types = [
'primary', 'primary',
'clean', 'clean',
'link' 'link'
]; ];
types.forEach((type) => { types.forEach(function (type) {
var button = TestUtils.renderIntoDocument( let button = TestUtils.renderIntoDocument(
<Button type={type}> <Button type={type}>
testcontent testcontent
</Button> </Button>
); );
expect(button.getDOMNode().getAttribute('class')).toContain('button-' + type);
}); expect(button.getDOMNode().getAttribute('class')).toContain('button-' + type);
}); });
}); });
});

View File

@ -5,10 +5,10 @@ import React from 'react/addons';
import Form from 'core-components/form.js'; import Form from 'core-components/form.js';
import Input from 'core-components/input.js'; import Input from 'core-components/input.js';
var TestUtils = React.addons.TestUtils; let TestUtils = React.addons.TestUtils;
describe('Form', () => { describe('Form', function () {
var results = TestUtils.renderIntoDocument( let results = TestUtils.renderIntoDocument(
<Form onSubmit={jest.genMockFunction()}> <Form onSubmit={jest.genMockFunction()}>
<div> <div>
<Input name="first" value="value1"/> <Input name="first" value="value1"/>
@ -17,9 +17,9 @@ describe('Form', () => {
<Input name="third" value="value3" /> <Input name="third" value="value3" />
</Form> </Form>
); );
var inputs = TestUtils.scryRenderedComponentsWithType(results, Input); let inputs = TestUtils.scryRenderedComponentsWithType(results, Input);
it('should store input value in form state', () => { it('should store input value in form state', function () {
expect(results.state.form).toEqual({ expect(results.state.form).toEqual({
first: 'value1', first: 'value1',
second: 'value2', second: 'value2',
@ -27,7 +27,7 @@ describe('Form', () => {
}); });
}); });
it('should update form state if an input value changes', () => { it('should update form state if an input value changes', function () {
inputs[0].props.onChange({ target: {value: 'value4'}}); inputs[0].props.onChange({ target: {value: 'value4'}});
expect(results.state.form).toEqual({ expect(results.state.form).toEqual({
@ -37,7 +37,7 @@ describe('Form', () => {
}); });
}); });
it('should update input value if state value changes', () => { it('should update input value if state value changes', function () {
results.setState({ results.setState({
form: { form: {
first: 'value6', first: 'value6',
@ -51,7 +51,7 @@ describe('Form', () => {
expect(inputs[2].props.value).toEqual('value8'); expect(inputs[2].props.value).toEqual('value8');
}); });
it('should call onSubmit callback when form is submitted', () => { it('should call onSubmit callback when form is submitted', function () {
TestUtils.Simulate.submit(results.getDOMNode()); TestUtils.Simulate.submit(results.getDOMNode());
expect(results.props.onSubmit).toBeCalledWith(results.state.form); expect(results.props.onSubmit).toBeCalledWith(results.state.form);