2017-11-09 13:27:32 +02:00
|
|
|
import React from 'react';
|
|
|
|
import renderer from 'react-test-renderer';
|
|
|
|
import 'jest-styled-components';
|
|
|
|
|
2018-02-05 17:12:47 +02:00
|
|
|
import { KeyValue } from 'joyent-ui-toolkit';
|
2017-12-21 02:12:42 +02:00
|
|
|
import Theme from '@mocks/theme';
|
2017-11-09 13:27:32 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-11-09 13:27:32 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue expanded={false} /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue expanded={false} />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-11-09 13:27:32 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue input="input" /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue input="input" />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-11-09 13:27:32 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue input="textarea" /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue input="textarea" />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-12-21 21:20:22 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue type="tag" /> without throwing', () => {
|
|
|
|
expect(
|
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue type="tag" />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-12-21 21:20:22 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue method="add" /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue method="add" />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-12-21 21:20:22 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue method="edit" /> without throwing', () => {
|
|
|
|
expect(
|
|
|
|
renderer
|
|
|
|
.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue method="edit" />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
.toJSON()
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-12-21 21:20:22 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue removing /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue removing />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|
2017-12-21 21:20:22 +02:00
|
|
|
|
2017-12-21 02:12:42 +02:00
|
|
|
it('renders <KeyValue submitting /> without throwing', () => {
|
2017-12-21 21:20:22 +02:00
|
|
|
expect(
|
2017-12-21 02:12:42 +02:00
|
|
|
renderer.create(
|
|
|
|
<Theme>
|
|
|
|
<KeyValue submitting />
|
|
|
|
</Theme>
|
|
|
|
)
|
|
|
|
).toMatchSnapshot();
|
|
|
|
});
|