@transferwise/components 0.0.0-experimental-53c607c → 0.0.0-experimental-b002e6f
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/avatarLayout/AvatarLayout.js +2 -9
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +2 -9
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/Button.js +97 -74
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +98 -75
- package/build/button/Button.mjs.map +1 -1
- package/build/common/action/Action.js +1 -1
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +1 -1
- package/build/common/action/Action.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +2 -2
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/header/Header.js +2 -2
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/link/Link.js +3 -8
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +3 -8
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +0 -269
- package/build/nudge/Nudge.js +1 -1
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +3 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +3 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +4 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +4 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +1 -1
- package/build/select/Select.js +3 -5
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +2 -4
- package/build/select/Select.mjs.map +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +0 -11
- package/build/styles/button/Button.css +16 -251
- package/build/styles/main.css +0 -269
- package/build/types/avatarLayout/AvatarLayout.d.ts +2 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/avatarLayout/index.d.ts +0 -1
- package/build/types/avatarLayout/index.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +23 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +1 -2
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +2 -2
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +2 -2
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +3 -3
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/package.json +3 -3
- package/src/avatarLayout/AvatarLayout.css +0 -11
- package/src/avatarLayout/AvatarLayout.less +1 -18
- package/src/avatarLayout/AvatarLayout.tsx +3 -11
- package/src/avatarLayout/index.ts +0 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +0 -2
- package/src/button/Button.css +16 -251
- package/src/button/Button.less +14 -214
- package/src/button/Button.spec.tsx +231 -54
- package/src/button/Button.story.tsx +136 -287
- package/src/button/Button.tsx +131 -86
- package/src/button/__snapshots__/{LegacyButton.spec.tsx.snap → Button.spec.tsx.snap} +22 -22
- package/src/button/index.ts +3 -2
- package/src/common/action/Action.tsx +1 -1
- package/src/definitionList/DefinitionList.story.tsx +57 -57
- package/src/definitionList/DefinitionList.tsx +1 -1
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +1 -1
- package/src/iconButton/IconButton.less +1 -1
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/link/Link.tsx +6 -15
- package/src/main.css +0 -269
- package/src/main.less +0 -1
- package/src/nudge/Nudge.tsx +1 -1
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +7 -1
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -1
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +3 -1
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +8 -1
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -1
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +5 -2
- package/src/select/Select.tsx +0 -1
- package/src/slidingPanel/SlidingPanel.spec.tsx +69 -0
- package/src/test-utils/index.tsx +1 -0
- package/build/button/Button.resolver.js +0 -67
- package/build/button/Button.resolver.js.map +0 -1
- package/build/button/Button.resolver.mjs +0 -65
- package/build/button/Button.resolver.mjs.map +0 -1
- package/build/button/LegacyButton.js +0 -114
- package/build/button/LegacyButton.js.map +0 -1
- package/build/button/LegacyButton.mjs +0 -112
- package/build/button/LegacyButton.mjs.map +0 -1
- package/build/styles/button/Button.vars.css +0 -57
- package/build/styles/button/LegacyButton.css +0 -23
- package/build/types/button/Button.resolver.d.ts +0 -31
- package/build/types/button/Button.resolver.d.ts.map +0 -1
- package/build/types/button/Button.types.d.ts +0 -50
- package/build/types/button/Button.types.d.ts.map +0 -1
- package/build/types/button/LegacyButton.d.ts +0 -30
- package/build/types/button/LegacyButton.d.ts.map +0 -1
- package/src/button/Button.resolver.tsx +0 -113
- package/src/button/Button.types.ts +0 -70
- package/src/button/Button.vars.css +0 -57
- package/src/button/Button.vars.less +0 -71
- package/src/button/LegacyButton.css +0 -23
- package/src/button/LegacyButton.less +0 -24
- package/src/button/LegacyButton.spec.tsx +0 -245
- package/src/button/LegacyButton.story.tsx +0 -224
- package/src/button/LegacyButton.tsx +0 -161
- package/src/definitionList/DefinitionList.spec.js +0 -91
- package/src/slidingPanel/SlidingPanel.spec.js +0 -56
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { clsx } from 'clsx';
|
|
2
|
-
import { ElementType, forwardRef, MouseEvent } from 'react';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Size,
|
|
7
|
-
ControlType,
|
|
8
|
-
Priority,
|
|
9
|
-
ControlTypeAccent,
|
|
10
|
-
ControlTypeNegative,
|
|
11
|
-
ControlTypePositive,
|
|
12
|
-
PriorityPrimary,
|
|
13
|
-
PrioritySecondary,
|
|
14
|
-
PriorityTertiary,
|
|
15
|
-
SizeExtraSmall,
|
|
16
|
-
SizeSmall,
|
|
17
|
-
SizeMedium,
|
|
18
|
-
SizeLarge,
|
|
19
|
-
} from '../common';
|
|
20
|
-
import ProcessIndicator from '../processIndicator';
|
|
21
|
-
|
|
22
|
-
import messages from '../i18n/commonMessages/Button.messages';
|
|
23
|
-
import { typeClassMap, priorityClassMap } from './classMap';
|
|
24
|
-
import { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';
|
|
25
|
-
|
|
26
|
-
/** @deprecated */
|
|
27
|
-
type DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';
|
|
28
|
-
|
|
29
|
-
/** @deprecated */
|
|
30
|
-
type DeprecatedSizes = SizeExtraSmall;
|
|
31
|
-
|
|
32
|
-
type CommonProps = {
|
|
33
|
-
block?: boolean;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
loading?: boolean;
|
|
36
|
-
/** @deprecated */
|
|
37
|
-
type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;
|
|
38
|
-
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;
|
|
39
|
-
size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;
|
|
40
|
-
htmlType?: 'submit' | 'reset' | 'button';
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type ButtonProps = CommonProps &
|
|
44
|
-
Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {
|
|
45
|
-
as?: 'button';
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type AnchorProps = CommonProps &
|
|
49
|
-
Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {
|
|
50
|
-
as?: 'a';
|
|
51
|
-
href?: string;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type LegacyButtonProps = ButtonProps | AnchorProps;
|
|
55
|
-
|
|
56
|
-
export type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated make sure you use new Button component via `<Button useNewButton .. />` and new props
|
|
60
|
-
*/
|
|
61
|
-
const LegacyButton = forwardRef<ButtonReferenceType, LegacyButtonProps>(
|
|
62
|
-
(
|
|
63
|
-
{
|
|
64
|
-
as: component = 'button',
|
|
65
|
-
block = false,
|
|
66
|
-
children,
|
|
67
|
-
className,
|
|
68
|
-
disabled,
|
|
69
|
-
loading = false,
|
|
70
|
-
priority = Priority.PRIMARY,
|
|
71
|
-
size = Size.MEDIUM,
|
|
72
|
-
type = ControlType.ACCENT,
|
|
73
|
-
onClick,
|
|
74
|
-
...rest
|
|
75
|
-
}: LegacyButtonProps,
|
|
76
|
-
ref,
|
|
77
|
-
) => {
|
|
78
|
-
const intl = useIntl();
|
|
79
|
-
|
|
80
|
-
logDeprecationNotices({ size, type });
|
|
81
|
-
|
|
82
|
-
const newType = establishNewType(type);
|
|
83
|
-
const newPriority = establishNewPriority(priority, type);
|
|
84
|
-
|
|
85
|
-
const classes = clsx(
|
|
86
|
-
`btn btn-${size}`,
|
|
87
|
-
`np-btn np-btn-${size}`,
|
|
88
|
-
{
|
|
89
|
-
'btn-loading': loading,
|
|
90
|
-
'btn-block np-btn-block': block,
|
|
91
|
-
disabled,
|
|
92
|
-
},
|
|
93
|
-
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
95
|
-
typeClassMap[newType],
|
|
96
|
-
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
98
|
-
priorityClassMap[newPriority],
|
|
99
|
-
className,
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
function processIndicatorSize() {
|
|
103
|
-
return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const Element = (component as ElementType) ?? 'button';
|
|
107
|
-
let props;
|
|
108
|
-
|
|
109
|
-
if (Element === 'button') {
|
|
110
|
-
const { htmlType = 'button', ...restProps } = rest as ButtonProps;
|
|
111
|
-
props = {
|
|
112
|
-
...restProps,
|
|
113
|
-
disabled,
|
|
114
|
-
'aria-disabled': loading,
|
|
115
|
-
type: htmlType,
|
|
116
|
-
};
|
|
117
|
-
} else {
|
|
118
|
-
props = {
|
|
119
|
-
...rest,
|
|
120
|
-
'aria-disabled': loading,
|
|
121
|
-
} as AnchorProps;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Ensures that the button cannot be activated in loading or disabled mode,
|
|
126
|
-
* when `aria-disabled` might be used over the `disabled` HTML attribute
|
|
127
|
-
*/
|
|
128
|
-
const handleClick =
|
|
129
|
-
(handler: LegacyButtonProps['onClick']) =>
|
|
130
|
-
(event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {
|
|
131
|
-
if (disabled || loading) {
|
|
132
|
-
event.preventDefault();
|
|
133
|
-
} else if (typeof handler === 'function') {
|
|
134
|
-
handler(event);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<Element
|
|
140
|
-
ref={ref as React.Ref<ButtonReferenceType>}
|
|
141
|
-
className={classes}
|
|
142
|
-
onClick={handleClick(onClick)}
|
|
143
|
-
{...props}
|
|
144
|
-
aria-live={loading ? 'polite' : 'off'}
|
|
145
|
-
aria-busy={loading}
|
|
146
|
-
aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}
|
|
147
|
-
>
|
|
148
|
-
{children}
|
|
149
|
-
{loading && (
|
|
150
|
-
<ProcessIndicator
|
|
151
|
-
size={processIndicatorSize()}
|
|
152
|
-
className="btn-loader"
|
|
153
|
-
data-testid="ButtonProgressIndicator"
|
|
154
|
-
/>
|
|
155
|
-
)}
|
|
156
|
-
</Element>
|
|
157
|
-
);
|
|
158
|
-
},
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
export default LegacyButton;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { shallow, mount } from 'enzyme';
|
|
2
|
-
|
|
3
|
-
import { DefinitionList } from '..';
|
|
4
|
-
import { Layout } from '../common';
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
VERTICAL_TWO_COLUMN,
|
|
8
|
-
VERTICAL_ONE_COLUMN,
|
|
9
|
-
HORIZONTAL_LEFT_ALIGNED,
|
|
10
|
-
HORIZONTAL_RIGHT_ALIGNED,
|
|
11
|
-
HORIZONTAL_JUSTIFIED,
|
|
12
|
-
} = Layout;
|
|
13
|
-
|
|
14
|
-
describe('DefinitionList', () => {
|
|
15
|
-
const someDefinitions = () => [{ title: 'First', value: 'first value', key: 'first' }, null];
|
|
16
|
-
|
|
17
|
-
const withLayout = (layout) =>
|
|
18
|
-
shallow(<DefinitionList layout={layout} definitions={someDefinitions()} />);
|
|
19
|
-
|
|
20
|
-
const listHasClass = (layout, className) =>
|
|
21
|
-
withLayout(layout).find('dl.tw-definition-list').hasClass(className);
|
|
22
|
-
|
|
23
|
-
const valueHasClass = (layout, className) =>
|
|
24
|
-
withLayout(layout).find('dl.tw-definition-list dd').hasClass(className);
|
|
25
|
-
|
|
26
|
-
it('applies correct flex class', () => {
|
|
27
|
-
const colClass = 'flex-column';
|
|
28
|
-
|
|
29
|
-
expect(listHasClass(VERTICAL_ONE_COLUMN, colClass)).toBe(true);
|
|
30
|
-
expect(listHasClass(VERTICAL_TWO_COLUMN, colClass)).toBe(true);
|
|
31
|
-
expect(listHasClass(HORIZONTAL_LEFT_ALIGNED, colClass)).toBe(true);
|
|
32
|
-
expect(listHasClass(HORIZONTAL_RIGHT_ALIGNED, colClass)).toBe(true);
|
|
33
|
-
expect(listHasClass(HORIZONTAL_JUSTIFIED, colClass)).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('applies correct class for vertical two-column layout', () => {
|
|
37
|
-
const colClass = 'tw-definition-list--columns flex-column flex-row--sm';
|
|
38
|
-
|
|
39
|
-
expect(listHasClass(VERTICAL_TWO_COLUMN, colClass)).toBe(true);
|
|
40
|
-
expect(listHasClass(VERTICAL_ONE_COLUMN, colClass)).toBe(false);
|
|
41
|
-
expect(listHasClass(HORIZONTAL_LEFT_ALIGNED, colClass)).toBe(false);
|
|
42
|
-
expect(listHasClass(HORIZONTAL_RIGHT_ALIGNED, colClass)).toBe(false);
|
|
43
|
-
expect(listHasClass(HORIZONTAL_JUSTIFIED, colClass)).toBe(false);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('applies correct class for horiztonal layouts', () => {
|
|
47
|
-
const rowClass = 'tw-definition-list--horizontal flex-column';
|
|
48
|
-
|
|
49
|
-
expect(listHasClass(VERTICAL_TWO_COLUMN, rowClass)).toBe(false);
|
|
50
|
-
expect(listHasClass(VERTICAL_ONE_COLUMN, rowClass)).toBe(false);
|
|
51
|
-
expect(listHasClass(HORIZONTAL_LEFT_ALIGNED, rowClass)).toBe(true);
|
|
52
|
-
expect(listHasClass(HORIZONTAL_RIGHT_ALIGNED, rowClass)).toBe(true);
|
|
53
|
-
expect(listHasClass(HORIZONTAL_JUSTIFIED, rowClass)).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('applies correct class for alignment', () => {
|
|
57
|
-
expect(valueHasClass(VERTICAL_TWO_COLUMN, 'd-flex justify-content-between')).toBe(true);
|
|
58
|
-
expect(valueHasClass(VERTICAL_ONE_COLUMN, 'd-flex justify-content-between')).toBe(true);
|
|
59
|
-
expect(valueHasClass(HORIZONTAL_LEFT_ALIGNED, 'd-flex justify-content-between')).toBe(true);
|
|
60
|
-
expect(valueHasClass(HORIZONTAL_RIGHT_ALIGNED, 'text-sm-right')).toBe(true);
|
|
61
|
-
expect(valueHasClass(HORIZONTAL_JUSTIFIED, 'text-sm-justify')).toBe(true);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('has muted text class on title and value when muted flag is passed', () => {
|
|
65
|
-
const muted = shallow(<DefinitionList muted definitions={someDefinitions()} />);
|
|
66
|
-
const notMuted = shallow(<DefinitionList definitions={someDefinitions()} />);
|
|
67
|
-
|
|
68
|
-
expect(muted.find('dl.tw-definition-list').hasClass('text-muted')).toBe(true);
|
|
69
|
-
expect(notMuted.find('dl.tw-definition-list').hasClass('text-muted')).toBe(false);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('shows action button when one is passed in', () => {
|
|
73
|
-
const buttonSpy = jest.fn();
|
|
74
|
-
|
|
75
|
-
const definitionList = mount(
|
|
76
|
-
<DefinitionList
|
|
77
|
-
definitions={[
|
|
78
|
-
{
|
|
79
|
-
title: 'Name',
|
|
80
|
-
value: 'Jenkins',
|
|
81
|
-
key: '1',
|
|
82
|
-
action: { label: 'A button', onClick: buttonSpy },
|
|
83
|
-
},
|
|
84
|
-
]}
|
|
85
|
-
/>,
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
definitionList.find('button').simulate('click');
|
|
89
|
-
expect(buttonSpy).toHaveBeenCalledTimes(1);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { shallow, mount } from 'enzyme';
|
|
2
|
-
|
|
3
|
-
import SlidingPanel from './SlidingPanel';
|
|
4
|
-
|
|
5
|
-
describe('SlidingPanel', () => {
|
|
6
|
-
let component;
|
|
7
|
-
const props = {
|
|
8
|
-
open: true,
|
|
9
|
-
position: 'left',
|
|
10
|
-
children: null,
|
|
11
|
-
className: undefined,
|
|
12
|
-
slidingPanelPositionFixed: false,
|
|
13
|
-
showSlidingPanelBorder: false,
|
|
14
|
-
testId: undefined,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
it('renders with right props', () => {
|
|
18
|
-
component = mount(<SlidingPanel {...props} />);
|
|
19
|
-
expect(component.find(SlidingPanel)).toHaveLength(1);
|
|
20
|
-
expect(component.find(SlidingPanel).props()).toStrictEqual({ ...props });
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('renders CSSTransition with right props', () => {
|
|
24
|
-
component = shallow(<SlidingPanel {...props} />);
|
|
25
|
-
|
|
26
|
-
expect(cssTransition()).toHaveLength(1);
|
|
27
|
-
|
|
28
|
-
expect(cssTransition().props()).toEqual({
|
|
29
|
-
className: 'sliding-panel sliding-panel--open-left',
|
|
30
|
-
children: null,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('adds fixed class', () => {
|
|
35
|
-
component = shallow(<SlidingPanel {...props} slidingPanelPositionFixed />);
|
|
36
|
-
expect(cssTransition().prop('className')).toBe(
|
|
37
|
-
'sliding-panel sliding-panel--open-left sliding-panel--fixed',
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('adds border classes if showSlidingPanelBorder is set to true', () => {
|
|
42
|
-
component = shallow(<SlidingPanel {...props} showSlidingPanelBorder />);
|
|
43
|
-
expect(cssTransition().prop('className')).toBe(
|
|
44
|
-
'sliding-panel sliding-panel--open-left sliding-panel--border-left',
|
|
45
|
-
);
|
|
46
|
-
component = shallow(<SlidingPanel {...props} showSlidingPanelBorder={false} position="left" />);
|
|
47
|
-
expect(cssTransition().prop('className')).toBe('sliding-panel sliding-panel--open-left');
|
|
48
|
-
|
|
49
|
-
component = shallow(<SlidingPanel {...props} showSlidingPanelBorder position="top" />);
|
|
50
|
-
expect(cssTransition().prop('className')).toBe(
|
|
51
|
-
'sliding-panel sliding-panel--open-top sliding-panel--border-top',
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const cssTransition = () => component.find('div');
|
|
56
|
-
});
|