mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
[Ivan Diaz] - Fix indentation of unit test [skip ci]
This commit is contained in:
parent
07c0a03c62
commit
bd5e14d5a1
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user