mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Don't use default exports.
This commit is contained in:
@ -5,25 +5,28 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {render} from 'customTestRender';
|
||||
import { render } from "customTestRender";
|
||||
|
||||
import Button from '../Button'
|
||||
import { Button } from "../Button";
|
||||
|
||||
describe('<Button />', () => {
|
||||
it('Render button correctly', () => {
|
||||
const {container} = render(<Button>Test Button</Button>);
|
||||
expect(container.firstChild).toMatchSnapshot()
|
||||
describe("<Button />", () => {
|
||||
it("Render button correctly", () => {
|
||||
const { container } = render(<Button>Test Button</Button>);
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Render button with custom classes', () => {
|
||||
const {container} = render(<Button className="one two three">Test Button</Button>)
|
||||
expect(container.firstChild).toMatchSnapshot()
|
||||
it("Render button with custom classes", () => {
|
||||
const { container } = render(<Button className="one two three">Test Button</Button>);
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Render button with spinner', () => {
|
||||
const {container} = render(<Button loading={true}>Test Button</Button>)
|
||||
expect(container.firstChild).toMatchSnapshot()
|
||||
it("Render button with spinner", () => {
|
||||
const { container } = render(<Button loading={true}>Test Button</Button>);
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -5,32 +5,35 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {render} from 'customTestRender';
|
||||
import { render } from "customTestRender";
|
||||
|
||||
import CheckBox from '../Checkbox'
|
||||
import { CheckBox } from "../Checkbox";
|
||||
|
||||
describe('<Checkbox/>', () => {
|
||||
it('Render checkbox', () => {
|
||||
const {container} = render(
|
||||
describe("<Checkbox/>", () => {
|
||||
it("Render checkbox", () => {
|
||||
const { container } = render(
|
||||
<CheckBox
|
||||
label="Test label"
|
||||
checked
|
||||
helpText="Some help text"
|
||||
onChange={()=>{}}
|
||||
onChange={() => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Render uncheked checkbox', () => {
|
||||
const {container} = render(
|
||||
it("Render uncheked checkbox", () => {
|
||||
const { container } = render(
|
||||
<CheckBox
|
||||
label="Test label"
|
||||
helpText="Some help text"
|
||||
/>
|
||||
);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -5,16 +5,16 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {render} from 'customTestRender';
|
||||
import { render } from "customTestRender";
|
||||
|
||||
import NumberInput from '../NumberInput';
|
||||
import { NumberInput } from "../NumberInput";
|
||||
|
||||
|
||||
describe('<NumberInput/>', () => {
|
||||
it('Render number input', () => {
|
||||
const {container} = render(
|
||||
describe("<NumberInput/>", () => {
|
||||
it("Render number input", () => {
|
||||
const { container } = render(
|
||||
<NumberInput
|
||||
label="Test label"
|
||||
helpText="Some help text"
|
||||
@ -23,6 +23,7 @@ describe('<NumberInput/>', () => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -5,15 +5,15 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {render} from 'customTestRender';
|
||||
import { render } from "customTestRender";
|
||||
|
||||
import PasswordInput from '../PasswordInput';
|
||||
import { PasswordInput } from "../PasswordInput";
|
||||
|
||||
describe('<PasswordInput/>', () => {
|
||||
it('Render password input', () => {
|
||||
const {container} = render(
|
||||
describe("<PasswordInput/>", () => {
|
||||
it("Render password input", () => {
|
||||
const { container } = render(
|
||||
<PasswordInput
|
||||
label="Test label"
|
||||
helpText="Some help text"
|
||||
@ -22,6 +22,7 @@ describe('<PasswordInput/>', () => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -5,31 +5,41 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {render} from 'customTestRender';
|
||||
import { render } from "customTestRender";
|
||||
|
||||
import RadioSet from '../RadioSet';
|
||||
import { RadioSet } from "../RadioSet";
|
||||
|
||||
const TEST_CHOICES = [
|
||||
{label: 'label', value: 'value'},
|
||||
{label: 'another label', value: 'another value'},
|
||||
{label: 'another one label', value: 'another on value'}
|
||||
{
|
||||
label: "label",
|
||||
value: "value"
|
||||
},
|
||||
{
|
||||
label: "another label",
|
||||
value: "another value"
|
||||
},
|
||||
{
|
||||
label: "another one label",
|
||||
value: "another on value"
|
||||
}
|
||||
];
|
||||
|
||||
describe('<RadioSet/>', () => {
|
||||
it('Render radio set', () => {
|
||||
const {container} = render(
|
||||
describe("<RadioSet/>", () => {
|
||||
it("Render radio set", () => {
|
||||
const { container } = render(
|
||||
<RadioSet
|
||||
name={'test_name'}
|
||||
name={"test_name"}
|
||||
label='Radios set label'
|
||||
value='value'
|
||||
choices={TEST_CHOICES}
|
||||
helpText={'Some help text'}
|
||||
helpText={"Some help text"}
|
||||
onChange={() => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -5,23 +5,23 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {fireEvent, getByDisplayValue, getByText, render} from 'customTestRender';
|
||||
import { fireEvent, getByDisplayValue, getByText, render } from "customTestRender";
|
||||
|
||||
import Select from '../Select';
|
||||
import { Select } from "../Select";
|
||||
|
||||
const TEST_CHOICES = {
|
||||
'1': 'one',
|
||||
'2': 'two',
|
||||
'3': 'three',
|
||||
"1": "one",
|
||||
"2": "two",
|
||||
"3": "three",
|
||||
};
|
||||
|
||||
describe('<Select/>', () => {
|
||||
describe("<Select/>", () => {
|
||||
var selectContainer;
|
||||
const onChangeHandler = jest.fn();
|
||||
beforeEach(() => {
|
||||
const {container} = render(
|
||||
const { container } = render(
|
||||
<Select
|
||||
label='Test label'
|
||||
value='1'
|
||||
@ -34,18 +34,22 @@ describe('<Select/>', () => {
|
||||
selectContainer = container;
|
||||
});
|
||||
|
||||
it('Test with snapshot.', () => {
|
||||
expect(selectContainer).toMatchSnapshot();
|
||||
it("Test with snapshot.", () => {
|
||||
expect(selectContainer)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Test onChange handling.', () => {
|
||||
const select = getByDisplayValue(selectContainer, 'one');
|
||||
expect(select.value).toBe('1');
|
||||
fireEvent.change(select, {target: {value: '2'}});
|
||||
it("Test onChange handling.", () => {
|
||||
const select = getByDisplayValue(selectContainer, "one");
|
||||
expect(select.value)
|
||||
.toBe("1");
|
||||
fireEvent.change(select, { target: { value: "2" } });
|
||||
|
||||
const option = getByText(selectContainer, 'two');
|
||||
expect(onChangeHandler).toBeCalled();
|
||||
const option = getByText(selectContainer, "two");
|
||||
expect(onChangeHandler)
|
||||
.toBeCalled();
|
||||
|
||||
expect(option.value).toBe('2');
|
||||
})
|
||||
expect(option.value)
|
||||
.toBe("2");
|
||||
});
|
||||
});
|
||||
|
@ -5,15 +5,15 @@
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import {render} from 'customTestRender';
|
||||
import { render } from "customTestRender";
|
||||
|
||||
import TextInput from '../TextInput';
|
||||
import { TextInput } from "../TextInput";
|
||||
|
||||
describe('<TextInput/>', () => {
|
||||
it('Render text input', () => {
|
||||
const {container} = render(
|
||||
describe("<TextInput/>", () => {
|
||||
it("Render text input", () => {
|
||||
const { container } = render(
|
||||
<TextInput
|
||||
label="Test label"
|
||||
helpText="Some help text"
|
||||
@ -22,6 +22,7 @@ describe('<TextInput/>', () => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
expect(container.firstChild)
|
||||
.toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user