@transferwise/components 0.0.0-experimental-da6dbbf → 0.0.0-experimental-4c1cb43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +635 -933
- package/build/index.js.map +1 -1
- package/build/index.mjs +625 -922
- package/build/index.mjs.map +1 -1
- package/build/main.css +0 -135
- package/build/styles/main.css +0 -135
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/common/card/Card.d.ts +2 -2
- package/build/types/common/card/Card.d.ts.map +1 -1
- package/build/types/common/hooks/useMedia.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +6 -5
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts +1 -11
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +4 -4
- package/build/types/index.d.ts +3 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +2 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +2 -2
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts +36 -19
- package/build/types/processIndicator/ProcessIndicator.d.ts.map +1 -1
- package/build/types/processIndicator/index.d.ts +2 -2
- package/build/types/processIndicator/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +5 -16
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts +1 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +2 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
- package/build/types/tooltip/Tooltip.d.ts +1 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +14 -14
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/package.json +9 -13
- package/src/accordion/AccordionItem/AccordionItem.tsx +2 -4
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -3
- package/src/button/Button.tsx +1 -1
- package/src/common/card/Card.tsx +43 -51
- package/src/common/hooks/useConditionalListener/useConditionalListener.spec.js +1 -1
- package/src/common/hooks/useHasIntersected/useHasIntersected.spec.js +3 -3
- package/src/common/hooks/useMedia.spec.ts +1 -1
- package/src/common/hooks/useMedia.ts +1 -2
- package/src/common/panel/Panel.tsx +90 -92
- package/src/common/responsivePanel/ResponsivePanel.tsx +34 -38
- package/src/dateLookup/DateLookup.rtl.spec.tsx +181 -5
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +171 -124
- package/src/dateLookup/DateLookup.tsx +14 -9
- package/src/drawer/Drawer.js +3 -3
- package/src/field/Field.tsx +3 -3
- package/src/index.ts +3 -4
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +2 -1
- package/src/inputs/SelectInput.story.tsx +2 -1
- package/src/inputs/SelectInput.tsx +10 -2
- package/src/inputs/contexts.tsx +4 -4
- package/src/main.css +0 -135
- package/src/main.less +0 -1
- package/src/modal/Modal.tsx +1 -2
- package/src/processIndicator/ProcessIndicator.rtl.spec.tsx +45 -0
- package/src/processIndicator/ProcessIndicator.tsx +110 -0
- package/src/promoCard/PromoCard.story.tsx +2 -2
- package/src/promoCard/PromoCard.tsx +9 -31
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +0 -1
- package/src/snackbar/Snackbar.spec.js +4 -1
- package/src/snackbar/Snackbar.story.tsx +4 -2
- package/src/tabs/Tabs.spec.js +46 -27
- package/src/test-utils/index.js +5 -7
- package/src/test-utils/jest.setup.js +9 -3
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +2 -1
- package/src/tooltip/Tooltip.tsx +44 -46
- package/src/tooltip/__snapshots__/Tooltip.spec.tsx.snap +2 -2
- package/src/upload/Upload.spec.js +34 -13
- package/src/uploadInput/UploadInput.spec.tsx +21 -23
- package/src/uploadInput/uploadItem/UploadItem.tsx +1 -3
- package/src/withDisplayFormat/WithDisplayFormat.spec.js +63 -32
- package/src/withDisplayFormat/WithDisplayFormat.tsx +28 -28
- package/build/styles/carousel/Carousel.css +0 -135
- package/build/types/carousel/Carousel.d.ts +0 -26
- package/build/types/carousel/Carousel.d.ts.map +0 -1
- package/build/types/carousel/index.d.ts +0 -3
- package/build/types/carousel/index.d.ts.map +0 -1
- package/src/carousel/Carousel.css +0 -135
- package/src/carousel/Carousel.less +0 -133
- package/src/carousel/Carousel.spec.tsx +0 -221
- package/src/carousel/Carousel.story.tsx +0 -63
- package/src/carousel/Carousel.tsx +0 -345
- package/src/carousel/index.ts +0 -3
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +0 -180
- package/src/processIndicator/ProcessIndicator.js +0 -117
- package/src/processIndicator/ProcessIndicator.spec.js +0 -101
- /package/src/processIndicator/{index.js → index.ts} +0 -0
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jest/expect-expect */
|
|
2
|
-
import { mount } from 'enzyme';
|
|
3
|
-
|
|
4
|
-
import { fakeKeyDownEventForKey } from '../common/fakeEvents';
|
|
5
|
-
import { mockMatchMedia } from '../test-utils';
|
|
6
|
-
|
|
7
|
-
import { DateLookupWithoutInputAttributes as DateLookup } from './DateLookup';
|
|
8
|
-
|
|
9
|
-
mockMatchMedia();
|
|
10
|
-
|
|
11
|
-
const defaultLocale = 'en-GB';
|
|
12
|
-
const formatMessage = (id) => String(id);
|
|
13
|
-
jest.mock('react-intl', () => ({
|
|
14
|
-
injectIntl: (Component) =>
|
|
15
|
-
function (props) {
|
|
16
|
-
return <Component {...props} intl={{ locale: defaultLocale, formatMessage }} />;
|
|
17
|
-
},
|
|
18
|
-
useIntl: () => ({ locale: defaultLocale, formatMessage }),
|
|
19
|
-
defineMessages: (translations) => translations,
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
describe('DateLookup (keyboard events)', () => {
|
|
23
|
-
const date = new Date(2018, 11, 27);
|
|
24
|
-
let component;
|
|
25
|
-
let props;
|
|
26
|
-
|
|
27
|
-
beforeEach(() => {
|
|
28
|
-
props = { value: date, onChange: jest.fn() };
|
|
29
|
-
component = mount(<DateLookup {...props} />);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('can be opened by LEFT arrow', () => {
|
|
33
|
-
pressKey('ArrowLeft');
|
|
34
|
-
expect(component.instance().state.open).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('can be opened by UP arrow', () => {
|
|
38
|
-
pressKey('ArrowUp');
|
|
39
|
-
expect(component.instance().state.open).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('can be opened by RIGHT arrow', () => {
|
|
43
|
-
pressKey('ArrowRight');
|
|
44
|
-
expect(component.instance().state.open).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('can be opened by DOWN arrow', () => {
|
|
48
|
-
pressKey('ArrowDown');
|
|
49
|
-
expect(component.instance().state.open).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('can be closed by pressing ESCAPE', () => {
|
|
53
|
-
component.setState({ open: true });
|
|
54
|
-
pressKey('Escape');
|
|
55
|
-
expect(component.instance().state.open).toBe(false);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('when open and in day mode', () => {
|
|
59
|
-
beforeEach(() => {
|
|
60
|
-
component.setState({ open: true, mode: 'day' });
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('moves 1 day back by pressing LEFT', () => {
|
|
64
|
-
pressKey('ArrowLeft');
|
|
65
|
-
onChangeCalledWith(new Date(2018, 11, 26));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('moves 7 days back by pressing UP', () => {
|
|
69
|
-
pressKey('ArrowUp');
|
|
70
|
-
onChangeCalledWith(new Date(2018, 11, 20));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('moves 1 day forward by pressing RIGHT', () => {
|
|
74
|
-
pressKey('ArrowRight');
|
|
75
|
-
onChangeCalledWith(new Date(2018, 11, 28));
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('moves 7 day forward by pressing DOWN', () => {
|
|
79
|
-
pressKey('ArrowDown');
|
|
80
|
-
onChangeCalledWith(new Date(2019, 0, 3));
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('resets to original date when escape key is pressed', () => {
|
|
84
|
-
pressKey('ArrowLeft');
|
|
85
|
-
pressKey('Escape');
|
|
86
|
-
onChangeCalledWith(date);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('resets to original date when clicking outside modal', () => {
|
|
90
|
-
pressKey('ArrowLeft');
|
|
91
|
-
component.find('.dimmer').simulate('click');
|
|
92
|
-
onChangeCalledWith(date);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
describe('when open and in month mode', () => {
|
|
97
|
-
beforeEach(() => {
|
|
98
|
-
component.setState({ open: true, mode: 'month' });
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('moves 1 month back by pressing LEFT', () => {
|
|
102
|
-
pressKey('ArrowLeft');
|
|
103
|
-
onChangeCalledWith(new Date(2018, 10, 27));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('moves 4 months back by pressing UP', () => {
|
|
107
|
-
pressKey('ArrowUp');
|
|
108
|
-
onChangeCalledWith(new Date(2018, 7, 27));
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('moves 1 month forward by pressing RIGHT', () => {
|
|
112
|
-
pressKey('ArrowRight');
|
|
113
|
-
onChangeCalledWith(new Date(2019, 0, 27));
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('moves 4 months forward by pressing DOWN', () => {
|
|
117
|
-
pressKey('ArrowDown');
|
|
118
|
-
onChangeCalledWith(new Date(2019, 3, 27));
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('when open and in year mode', () => {
|
|
123
|
-
beforeEach(() => {
|
|
124
|
-
component.setState({ open: true, mode: 'year' });
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('moves 1 year back by pressing LEFT', () => {
|
|
128
|
-
pressKey('ArrowLeft');
|
|
129
|
-
onChangeCalledWith(new Date(2017, 11, 27));
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('moves 4 years back by pressing UP', () => {
|
|
133
|
-
pressKey('ArrowUp');
|
|
134
|
-
onChangeCalledWith(new Date(2014, 11, 27));
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('moves 1 year forward by pressing RIGHT', () => {
|
|
138
|
-
pressKey('ArrowRight');
|
|
139
|
-
onChangeCalledWith(new Date(2019, 11, 27));
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('moves 4 year forward by pressing DOWN', () => {
|
|
143
|
-
pressKey('ArrowDown');
|
|
144
|
-
onChangeCalledWith(new Date(2022, 11, 27));
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
describe('when min and max provided', () => {
|
|
149
|
-
beforeEach(() => {
|
|
150
|
-
component.setState({
|
|
151
|
-
open: true,
|
|
152
|
-
mode: 'day',
|
|
153
|
-
min: new Date(2018, 11, 26),
|
|
154
|
-
max: new Date(2018, 11, 28),
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('makes sure that date is >= min', () => {
|
|
159
|
-
pressKey('ArrowLeft');
|
|
160
|
-
onChangeCalledWith(new Date(2018, 11, 26));
|
|
161
|
-
pressKey('ArrowLeft');
|
|
162
|
-
onChangeCalledWith(new Date(2018, 11, 26));
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('makes sure that date is <= max', () => {
|
|
166
|
-
pressKey('ArrowRight');
|
|
167
|
-
onChangeCalledWith(new Date(2018, 11, 28));
|
|
168
|
-
pressKey('ArrowRight');
|
|
169
|
-
onChangeCalledWith(new Date(2018, 11, 28));
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
const pressKey = (key) => {
|
|
174
|
-
component.simulate('keyDown', fakeKeyDownEventForKey(key));
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const onChangeCalledWith = (d) => {
|
|
178
|
-
expect(props.onChange).toHaveBeenLastCalledWith(d);
|
|
179
|
-
};
|
|
180
|
-
});
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Component } from 'react';
|
|
4
|
-
|
|
5
|
-
import { Status, Size } from '../common';
|
|
6
|
-
|
|
7
|
-
const radius = { xxs: 6, xs: 11, sm: 22, xl: 61 };
|
|
8
|
-
export const ANIMATION_DURATION_IN_MS = 1500;
|
|
9
|
-
|
|
10
|
-
class ProcessIndicator extends Component {
|
|
11
|
-
constructor(props) {
|
|
12
|
-
super(props);
|
|
13
|
-
this.state = {
|
|
14
|
-
status: props.status,
|
|
15
|
-
size: props.size,
|
|
16
|
-
};
|
|
17
|
-
this.interval = null;
|
|
18
|
-
this.timeout = null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create interval for animation duration (1500ms)
|
|
23
|
-
* Update state only at the end of every interval
|
|
24
|
-
* (end of animation loop) if props changed before end of animation
|
|
25
|
-
*/
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.interval = setInterval(() => {
|
|
28
|
-
const statusFromState = this.state.status;
|
|
29
|
-
const sizeFromState = this.state.size;
|
|
30
|
-
|
|
31
|
-
const statusFromProps = this.props.status;
|
|
32
|
-
const sizeFromProps = this.props.size;
|
|
33
|
-
|
|
34
|
-
if (statusFromState !== statusFromProps) {
|
|
35
|
-
this.setState({ status: statusFromProps }, this.runCallBack(statusFromProps));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (sizeFromState !== sizeFromProps) {
|
|
39
|
-
this.setState({ size: sizeFromProps });
|
|
40
|
-
}
|
|
41
|
-
}, ANIMATION_DURATION_IN_MS);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Only trigger render if comopnent's state got
|
|
46
|
-
* updated from interval callback
|
|
47
|
-
*
|
|
48
|
-
* @param nextProps
|
|
49
|
-
* @param nextState
|
|
50
|
-
*/
|
|
51
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
52
|
-
const isSameStatus = nextProps.status === nextState.status;
|
|
53
|
-
const isSameSize = nextProps.size === nextState.size;
|
|
54
|
-
|
|
55
|
-
return isSameStatus && isSameSize;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Clear interval before destroying component
|
|
59
|
-
componentWillUnmount() {
|
|
60
|
-
clearInterval(this.interval);
|
|
61
|
-
clearTimeout(this.timeout);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
runCallBack = (statusFromProps) => {
|
|
65
|
-
const { onAnimationCompleted } = this.props;
|
|
66
|
-
if (onAnimationCompleted) {
|
|
67
|
-
this.timeouts = setTimeout(() => {
|
|
68
|
-
onAnimationCompleted(statusFromProps);
|
|
69
|
-
}, ANIMATION_DURATION_IN_MS);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
render() {
|
|
74
|
-
const { className, 'data-testid': dataTestId } = this.props;
|
|
75
|
-
const { size, status } = this.state;
|
|
76
|
-
const classes = classNames(`process process-${size}`, className, {
|
|
77
|
-
[`process-danger`]: status === Status.FAILED,
|
|
78
|
-
[`process-stopped`]: status === Status.HIDDEN,
|
|
79
|
-
[`process-success`]: status === Status.SUCCEEDED,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<span className={classes} data-testid={dataTestId}>
|
|
84
|
-
<span className="process-icon-container">
|
|
85
|
-
<span className="process-icon-horizontal" />
|
|
86
|
-
<span className="process-icon-vertical" />
|
|
87
|
-
</span>
|
|
88
|
-
<svg xmlns="http://www.w3.org/2000/svg">
|
|
89
|
-
<circle
|
|
90
|
-
className="process-circle"
|
|
91
|
-
cx="50%"
|
|
92
|
-
cy="50%"
|
|
93
|
-
r={radius[this.state.size]}
|
|
94
|
-
fillOpacity="0.0"
|
|
95
|
-
/>
|
|
96
|
-
</svg>
|
|
97
|
-
</span>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
ProcessIndicator.propTypes = {
|
|
102
|
-
status: PropTypes.oneOf(['processing', 'failed', 'succeeded', 'hidden']),
|
|
103
|
-
size: PropTypes.oneOf(['xxs', 'xs', 'sm', 'xl']),
|
|
104
|
-
onAnimationCompleted: PropTypes.func,
|
|
105
|
-
className: PropTypes.string,
|
|
106
|
-
'data-testid': PropTypes.string,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
ProcessIndicator.defaultProps = {
|
|
110
|
-
status: Status.PROCESSING,
|
|
111
|
-
size: Size.SMALL,
|
|
112
|
-
onAnimationCompleted: null,
|
|
113
|
-
className: undefined,
|
|
114
|
-
'data-testid': null,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export default ProcessIndicator;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { mount } from 'enzyme';
|
|
2
|
-
|
|
3
|
-
import { Status, Size } from '../common';
|
|
4
|
-
|
|
5
|
-
import ProcessIndicator from '.';
|
|
6
|
-
|
|
7
|
-
describe('processIndicator', () => {
|
|
8
|
-
let wrapper;
|
|
9
|
-
const ANIMATION_DURATION = 1500;
|
|
10
|
-
const props = {
|
|
11
|
-
status: Status.PROCESSING,
|
|
12
|
-
size: Size.Small,
|
|
13
|
-
onAnimationCompleted: jest.fn(),
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
jest.useFakeTimers();
|
|
18
|
-
|
|
19
|
-
wrapper = mount(<ProcessIndicator {...props} />);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
jest.useRealTimers();
|
|
24
|
-
jest.clearAllMocks();
|
|
25
|
-
jest.clearAllTimers();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('has right classes when rendered with provided props', () => {
|
|
29
|
-
expect(wrapper.find('.process')).toHaveLength(1);
|
|
30
|
-
expect(wrapper.find('.process-sm')).toHaveLength(1);
|
|
31
|
-
|
|
32
|
-
expect(wrapper.find('.process-lg')).toHaveLength(0);
|
|
33
|
-
expect(wrapper.find('.process-xs')).toHaveLength(0);
|
|
34
|
-
expect(wrapper.find('.process-danger')).toHaveLength(0);
|
|
35
|
-
expect(wrapper.find('.process-stopped')).toHaveLength(0);
|
|
36
|
-
expect(wrapper.find('.process-success')).toHaveLength(0);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('updates component state with delay on props change to create smooth transition between CSS animations', () => {
|
|
40
|
-
expect(wrapper.state().status).toBe('processing');
|
|
41
|
-
|
|
42
|
-
wrapper.setProps({ status: 'succeeded' });
|
|
43
|
-
expect(wrapper.props().status).toBe('succeeded');
|
|
44
|
-
expect(wrapper.state().status).toBe('processing');
|
|
45
|
-
|
|
46
|
-
jest.advanceTimersByTime(ANIMATION_DURATION);
|
|
47
|
-
wrapper.update();
|
|
48
|
-
|
|
49
|
-
expect(wrapper.state().status).toBe('succeeded');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('updates size classes with delay', () => {
|
|
53
|
-
expect(wrapper.find('.process-sm')).toHaveLength(1);
|
|
54
|
-
wrapper.setProps({ size: 'xl' });
|
|
55
|
-
expect(wrapper.find('.process-xl')).toHaveLength(0);
|
|
56
|
-
|
|
57
|
-
jest.advanceTimersByTime(ANIMATION_DURATION);
|
|
58
|
-
wrapper.update();
|
|
59
|
-
|
|
60
|
-
expect(wrapper.find('.process-xs')).toHaveLength(0);
|
|
61
|
-
expect(wrapper.find('.process-sm')).toHaveLength(0);
|
|
62
|
-
expect(wrapper.find('.process-xl')).toHaveLength(1);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('properly updates status classes with delay', () => {
|
|
66
|
-
wrapper.setProps({ status: 'succeeded' });
|
|
67
|
-
expect(wrapper.find('.process-success')).toHaveLength(0);
|
|
68
|
-
jest.advanceTimersByTime(ANIMATION_DURATION);
|
|
69
|
-
wrapper.update();
|
|
70
|
-
expect(wrapper.find('.process-success')).toHaveLength(1);
|
|
71
|
-
expect(wrapper.find('.process-danger')).toHaveLength(0);
|
|
72
|
-
expect(wrapper.find('.process-stopped')).toHaveLength(0);
|
|
73
|
-
|
|
74
|
-
wrapper.setProps({ status: 'failed' });
|
|
75
|
-
expect(wrapper.find('.process-danger')).toHaveLength(0);
|
|
76
|
-
jest.advanceTimersByTime(ANIMATION_DURATION);
|
|
77
|
-
wrapper.update();
|
|
78
|
-
expect(wrapper.find('.process-success')).toHaveLength(0);
|
|
79
|
-
expect(wrapper.find('.process-danger')).toHaveLength(1);
|
|
80
|
-
expect(wrapper.find('.process-stopped')).toHaveLength(0);
|
|
81
|
-
|
|
82
|
-
wrapper.setProps({ status: 'hidden' });
|
|
83
|
-
expect(wrapper.find('.process-stopped')).toHaveLength(0);
|
|
84
|
-
jest.advanceTimersByTime(ANIMATION_DURATION);
|
|
85
|
-
wrapper.update();
|
|
86
|
-
expect(wrapper.find('.process-success')).toHaveLength(0);
|
|
87
|
-
expect(wrapper.find('.process-danger')).toHaveLength(0);
|
|
88
|
-
expect(wrapper.find('.process-stopped')).toHaveLength(1);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('calls onAnimationCompleted with Delay', () => {
|
|
92
|
-
expect(props.onAnimationCompleted).not.toHaveBeenCalled();
|
|
93
|
-
wrapper.setProps({ status: Status.FAILED });
|
|
94
|
-
expect(props.onAnimationCompleted).not.toHaveBeenCalled();
|
|
95
|
-
jest.advanceTimersByTime(ANIMATION_DURATION * 2);
|
|
96
|
-
expect(props.onAnimationCompleted).toHaveBeenCalledWith(Status.FAILED);
|
|
97
|
-
wrapper.setProps({ status: Status.SUCCEEDED });
|
|
98
|
-
jest.advanceTimersByTime(ANIMATION_DURATION * 2);
|
|
99
|
-
expect(props.onAnimationCompleted).toHaveBeenCalledWith(Status.SUCCEEDED);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
File without changes
|