@transferwise/components 0.0.0-experimental-a656242 → 0.0.0-experimental-887f2e6
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 +9 -2
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +9 -2
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +1 -12
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +1 -12
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/button/Button.js +78 -79
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +79 -80
- package/build/button/Button.mjs.map +1 -1
- package/build/button/Button.resolver.js +78 -0
- package/build/button/Button.resolver.js.map +1 -0
- package/build/button/Button.resolver.mjs +76 -0
- package/build/button/Button.resolver.mjs.map +1 -0
- package/build/button/LegacyButton.js +114 -0
- package/build/button/LegacyButton.js.map +1 -0
- package/build/button/LegacyButton.mjs +112 -0
- package/build/button/LegacyButton.mjs.map +1 -0
- package/build/circularButton/CircularButton.js +21 -18
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +22 -19
- package/build/circularButton/CircularButton.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/i18n/de.json +0 -1
- package/build/i18n/de.json.js +0 -1
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +0 -1
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/it.json +0 -1
- package/build/i18n/it.json.js +0 -1
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +0 -1
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/th.json +0 -1
- package/build/i18n/th.json.js +0 -1
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +0 -1
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/link/Link.js +8 -3
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +8 -3
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +416 -17
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +1 -3
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +1 -3
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +1 -4
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +1 -4
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +1 -1
- package/build/select/Select.js +5 -3
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +4 -2
- package/build/select/Select.mjs.map +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +11 -0
- package/build/styles/button/Button.css +240 -16
- package/build/styles/button/Button.vars.css +55 -0
- package/build/styles/button/LegacyButton.css +23 -0
- package/build/styles/circularButton/CircularButton.css +158 -17
- package/build/styles/main.css +416 -17
- package/build/types/avatarLayout/AvatarLayout.d.ts +1 -2
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/avatarLayout/index.d.ts +1 -0
- package/build/types/avatarLayout/index.d.ts.map +1 -1
- package/build/types/avatarView/AvatarView.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +1 -23
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.resolver.d.ts +31 -0
- package/build/types/button/Button.resolver.d.ts.map +1 -0
- package/build/types/button/Button.types.d.ts +67 -0
- package/build/types/button/Button.types.d.ts.map +1 -0
- package/build/types/button/LegacyButton.d.ts +30 -0
- package/build/types/button/LegacyButton.d.ts.map +1 -0
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +4 -11
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +2 -1
- 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/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.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/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 +11 -0
- package/src/avatarLayout/AvatarLayout.less +18 -1
- package/src/avatarLayout/AvatarLayout.tsx +11 -3
- package/src/avatarLayout/index.ts +1 -0
- package/src/avatarView/AvatarView.tsx +1 -15
- package/src/button/Button.css +240 -16
- package/src/button/Button.less +208 -14
- package/src/button/Button.resolver.tsx +120 -0
- package/src/button/Button.spec.tsx +54 -231
- package/src/button/Button.story.tsx +610 -137
- package/src/button/Button.tsx +88 -132
- package/src/button/Button.types.ts +88 -0
- package/src/button/Button.vars.css +55 -0
- package/src/button/Button.vars.less +69 -0
- package/src/button/LegacyButton.css +23 -0
- package/src/button/LegacyButton.less +24 -0
- package/src/button/LegacyButton.spec.tsx +146 -0
- package/src/button/LegacyButton.story.tsx +224 -0
- package/src/button/LegacyButton.tsx +161 -0
- package/src/button/index.ts +2 -3
- package/src/circularButton/CircularButton.css +158 -17
- package/src/circularButton/CircularButton.less +91 -22
- package/src/circularButton/CircularButton.story.tsx +24 -45
- package/src/circularButton/CircularButton.tsx +25 -38
- package/src/circularButton/_button-label-states.less +34 -0
- package/src/definitionList/DefinitionList.spec.js +91 -0
- 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/i18n/de.json +0 -1
- package/src/i18n/it.json +0 -1
- package/src/i18n/th.json +0 -1
- package/src/iconButton/IconButton.story.tsx +6 -6
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/link/Link.tsx +15 -6
- package/src/main.css +416 -17
- package/src/main.less +1 -0
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +1 -7
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.ts +1 -1
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -3
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +1 -8
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +2 -5
- package/src/select/Select.tsx +1 -0
- package/src/slidingPanel/SlidingPanel.spec.js +56 -0
- package/src/button/__snapshots__/Button.spec.tsx.snap +0 -309
- package/src/slidingPanel/SlidingPanel.spec.tsx +0 -69
package/src/select/Select.tsx
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
});
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Button by default renders a medium button of type accent and priority primary 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<button
|
|
6
|
-
aria-busy="false"
|
|
7
|
-
aria-disabled="false"
|
|
8
|
-
aria-live="off"
|
|
9
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
10
|
-
type="button"
|
|
11
|
-
>
|
|
12
|
-
Send money
|
|
13
|
-
</button>
|
|
14
|
-
</div>
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
exports[`Button by default renders an anchor tag with button styles of type accent and priority primary 1`] = `
|
|
18
|
-
<div>
|
|
19
|
-
<a
|
|
20
|
-
aria-busy="false"
|
|
21
|
-
aria-disabled="false"
|
|
22
|
-
aria-live="off"
|
|
23
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
24
|
-
href="#"
|
|
25
|
-
>
|
|
26
|
-
Send money
|
|
27
|
-
</a>
|
|
28
|
-
</div>
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
exports[`Button deprecated types renders danger as negative buttons with priority secondary and logs a warning 1`] = `
|
|
32
|
-
<div>
|
|
33
|
-
<button
|
|
34
|
-
aria-busy="false"
|
|
35
|
-
aria-disabled="false"
|
|
36
|
-
aria-live="off"
|
|
37
|
-
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-2"
|
|
38
|
-
type="button"
|
|
39
|
-
>
|
|
40
|
-
Send money
|
|
41
|
-
</button>
|
|
42
|
-
</div>
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
exports[`Button deprecated types renders link as accent buttons with priority tertiary and logs a warning 1`] = `
|
|
46
|
-
<div>
|
|
47
|
-
<button
|
|
48
|
-
aria-busy="false"
|
|
49
|
-
aria-disabled="false"
|
|
50
|
-
aria-live="off"
|
|
51
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-3"
|
|
52
|
-
type="button"
|
|
53
|
-
>
|
|
54
|
-
Send money
|
|
55
|
-
</button>
|
|
56
|
-
</div>
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
exports[`Button deprecated types renders pay as positive buttons and logs a warning 1`] = `
|
|
60
|
-
<div>
|
|
61
|
-
<button
|
|
62
|
-
aria-busy="false"
|
|
63
|
-
aria-disabled="false"
|
|
64
|
-
aria-live="off"
|
|
65
|
-
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-1"
|
|
66
|
-
type="button"
|
|
67
|
-
>
|
|
68
|
-
Send money
|
|
69
|
-
</button>
|
|
70
|
-
</div>
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
exports[`Button deprecated types renders primary as accent buttons and logs a warning 1`] = `
|
|
74
|
-
<div>
|
|
75
|
-
<button
|
|
76
|
-
aria-busy="false"
|
|
77
|
-
aria-disabled="false"
|
|
78
|
-
aria-live="off"
|
|
79
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
80
|
-
type="button"
|
|
81
|
-
>
|
|
82
|
-
Send money
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
`;
|
|
86
|
-
|
|
87
|
-
exports[`Button other states renders as block if block is true 1`] = `
|
|
88
|
-
<div>
|
|
89
|
-
<button
|
|
90
|
-
aria-busy="false"
|
|
91
|
-
aria-disabled="false"
|
|
92
|
-
aria-live="off"
|
|
93
|
-
class="btn btn-md np-btn np-btn-md btn-block np-btn-block btn-accent btn-priority-1"
|
|
94
|
-
type="button"
|
|
95
|
-
>
|
|
96
|
-
Send money
|
|
97
|
-
</button>
|
|
98
|
-
</div>
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
exports[`Button priorities defaults tertiary buttons to secondary for positive buttons 1`] = `
|
|
102
|
-
<div>
|
|
103
|
-
<button
|
|
104
|
-
aria-busy="false"
|
|
105
|
-
aria-disabled="false"
|
|
106
|
-
aria-live="off"
|
|
107
|
-
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-2"
|
|
108
|
-
type="button"
|
|
109
|
-
>
|
|
110
|
-
Send money
|
|
111
|
-
</button>
|
|
112
|
-
</div>
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
exports[`Button priorities defaults tertiary buttons to secondary for positive buttons 2`] = `
|
|
116
|
-
<div>
|
|
117
|
-
<button
|
|
118
|
-
aria-busy="false"
|
|
119
|
-
aria-disabled="false"
|
|
120
|
-
aria-live="off"
|
|
121
|
-
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-2"
|
|
122
|
-
type="button"
|
|
123
|
-
>
|
|
124
|
-
Send money
|
|
125
|
-
</button>
|
|
126
|
-
</div>
|
|
127
|
-
`;
|
|
128
|
-
|
|
129
|
-
exports[`Button priorities renders primary buttons 1`] = `
|
|
130
|
-
<div>
|
|
131
|
-
<button
|
|
132
|
-
aria-busy="false"
|
|
133
|
-
aria-disabled="false"
|
|
134
|
-
aria-live="off"
|
|
135
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
136
|
-
type="button"
|
|
137
|
-
>
|
|
138
|
-
Send money
|
|
139
|
-
</button>
|
|
140
|
-
</div>
|
|
141
|
-
`;
|
|
142
|
-
|
|
143
|
-
exports[`Button priorities renders primary buttons 2`] = `
|
|
144
|
-
<div>
|
|
145
|
-
<button
|
|
146
|
-
aria-busy="false"
|
|
147
|
-
aria-disabled="false"
|
|
148
|
-
aria-live="off"
|
|
149
|
-
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-1"
|
|
150
|
-
type="button"
|
|
151
|
-
>
|
|
152
|
-
Send money
|
|
153
|
-
</button>
|
|
154
|
-
</div>
|
|
155
|
-
`;
|
|
156
|
-
|
|
157
|
-
exports[`Button priorities renders primary buttons 3`] = `
|
|
158
|
-
<div>
|
|
159
|
-
<button
|
|
160
|
-
aria-busy="false"
|
|
161
|
-
aria-disabled="false"
|
|
162
|
-
aria-live="off"
|
|
163
|
-
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-1"
|
|
164
|
-
type="button"
|
|
165
|
-
>
|
|
166
|
-
Send money
|
|
167
|
-
</button>
|
|
168
|
-
</div>
|
|
169
|
-
`;
|
|
170
|
-
|
|
171
|
-
exports[`Button priorities renders secondary buttons 1`] = `
|
|
172
|
-
<div>
|
|
173
|
-
<button
|
|
174
|
-
aria-busy="false"
|
|
175
|
-
aria-disabled="false"
|
|
176
|
-
aria-live="off"
|
|
177
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-2"
|
|
178
|
-
type="button"
|
|
179
|
-
>
|
|
180
|
-
Send money
|
|
181
|
-
</button>
|
|
182
|
-
</div>
|
|
183
|
-
`;
|
|
184
|
-
|
|
185
|
-
exports[`Button priorities renders secondary buttons 2`] = `
|
|
186
|
-
<div>
|
|
187
|
-
<button
|
|
188
|
-
aria-busy="false"
|
|
189
|
-
aria-disabled="false"
|
|
190
|
-
aria-live="off"
|
|
191
|
-
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-2"
|
|
192
|
-
type="button"
|
|
193
|
-
>
|
|
194
|
-
Send money
|
|
195
|
-
</button>
|
|
196
|
-
</div>
|
|
197
|
-
`;
|
|
198
|
-
|
|
199
|
-
exports[`Button priorities renders secondary buttons 3`] = `
|
|
200
|
-
<div>
|
|
201
|
-
<button
|
|
202
|
-
aria-busy="false"
|
|
203
|
-
aria-disabled="false"
|
|
204
|
-
aria-live="off"
|
|
205
|
-
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-2"
|
|
206
|
-
type="button"
|
|
207
|
-
>
|
|
208
|
-
Send money
|
|
209
|
-
</button>
|
|
210
|
-
</div>
|
|
211
|
-
`;
|
|
212
|
-
|
|
213
|
-
exports[`Button priorities renders tertiary buttons 1`] = `
|
|
214
|
-
<div>
|
|
215
|
-
<button
|
|
216
|
-
aria-busy="false"
|
|
217
|
-
aria-disabled="false"
|
|
218
|
-
aria-live="off"
|
|
219
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-3"
|
|
220
|
-
type="button"
|
|
221
|
-
>
|
|
222
|
-
Send money
|
|
223
|
-
</button>
|
|
224
|
-
</div>
|
|
225
|
-
`;
|
|
226
|
-
|
|
227
|
-
exports[`Button sizes renders large buttons 1`] = `
|
|
228
|
-
<div>
|
|
229
|
-
<button
|
|
230
|
-
aria-busy="false"
|
|
231
|
-
aria-disabled="false"
|
|
232
|
-
aria-live="off"
|
|
233
|
-
class="btn btn-lg np-btn np-btn-lg btn-accent btn-priority-1"
|
|
234
|
-
type="button"
|
|
235
|
-
>
|
|
236
|
-
Send money
|
|
237
|
-
</button>
|
|
238
|
-
</div>
|
|
239
|
-
`;
|
|
240
|
-
|
|
241
|
-
exports[`Button sizes renders medium buttons 1`] = `
|
|
242
|
-
<div>
|
|
243
|
-
<button
|
|
244
|
-
aria-busy="false"
|
|
245
|
-
aria-disabled="false"
|
|
246
|
-
aria-live="off"
|
|
247
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
248
|
-
type="button"
|
|
249
|
-
>
|
|
250
|
-
Send money
|
|
251
|
-
</button>
|
|
252
|
-
</div>
|
|
253
|
-
`;
|
|
254
|
-
|
|
255
|
-
exports[`Button sizes renders small buttons 1`] = `
|
|
256
|
-
<div>
|
|
257
|
-
<button
|
|
258
|
-
aria-busy="false"
|
|
259
|
-
aria-disabled="false"
|
|
260
|
-
aria-live="off"
|
|
261
|
-
class="btn btn-sm np-btn np-btn-sm btn-accent btn-priority-1"
|
|
262
|
-
type="button"
|
|
263
|
-
>
|
|
264
|
-
Send money
|
|
265
|
-
</button>
|
|
266
|
-
</div>
|
|
267
|
-
`;
|
|
268
|
-
|
|
269
|
-
exports[`Button types renders accent buttons 1`] = `
|
|
270
|
-
<div>
|
|
271
|
-
<button
|
|
272
|
-
aria-busy="false"
|
|
273
|
-
aria-disabled="false"
|
|
274
|
-
aria-live="off"
|
|
275
|
-
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
276
|
-
type="button"
|
|
277
|
-
>
|
|
278
|
-
Send money
|
|
279
|
-
</button>
|
|
280
|
-
</div>
|
|
281
|
-
`;
|
|
282
|
-
|
|
283
|
-
exports[`Button types renders negative buttons 1`] = `
|
|
284
|
-
<div>
|
|
285
|
-
<button
|
|
286
|
-
aria-busy="false"
|
|
287
|
-
aria-disabled="false"
|
|
288
|
-
aria-live="off"
|
|
289
|
-
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-1"
|
|
290
|
-
type="button"
|
|
291
|
-
>
|
|
292
|
-
Send money
|
|
293
|
-
</button>
|
|
294
|
-
</div>
|
|
295
|
-
`;
|
|
296
|
-
|
|
297
|
-
exports[`Button types renders positive buttons 1`] = `
|
|
298
|
-
<div>
|
|
299
|
-
<button
|
|
300
|
-
aria-busy="false"
|
|
301
|
-
aria-disabled="false"
|
|
302
|
-
aria-live="off"
|
|
303
|
-
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-1"
|
|
304
|
-
type="button"
|
|
305
|
-
>
|
|
306
|
-
Send money
|
|
307
|
-
</button>
|
|
308
|
-
</div>
|
|
309
|
-
`;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '../test-utils';
|
|
2
|
-
import SlidingPanel, { SlidingPanelProps } from './SlidingPanel';
|
|
3
|
-
|
|
4
|
-
describe('SlidingPanel', () => {
|
|
5
|
-
const initialProps: SlidingPanelProps = {
|
|
6
|
-
open: true,
|
|
7
|
-
children: <div data-testid="content">Content</div>,
|
|
8
|
-
testId: 'wrapper',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const customRender = (overrides: Partial<SlidingPanelProps> = {}) =>
|
|
12
|
-
render(<SlidingPanel {...initialProps} {...overrides} />);
|
|
13
|
-
|
|
14
|
-
describe('open', () => {
|
|
15
|
-
it('should respect open=false', () => {
|
|
16
|
-
customRender({ open: false });
|
|
17
|
-
expect(screen.queryByTestId('wrapper')).not.toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should respect open=true', () => {
|
|
21
|
-
customRender();
|
|
22
|
-
expect(screen.getByTestId('wrapper')).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('position', () => {
|
|
27
|
-
it(`should default to 'left'`, () => {
|
|
28
|
-
customRender();
|
|
29
|
-
expect(screen.queryByTestId('wrapper')).toHaveClass(`sliding-panel--open-left`);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
(['left', 'right', 'top', 'bottom'] as const).forEach((position) => {
|
|
33
|
-
describe(position, () => {
|
|
34
|
-
it(`should add the classname`, () => {
|
|
35
|
-
customRender({ position });
|
|
36
|
-
expect(screen.queryByTestId('wrapper')).toHaveClass(`sliding-panel--open-${position}`);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it(`should add the classname for 'showSlidingPanelBorder'`, () => {
|
|
40
|
-
customRender({ position, showSlidingPanelBorder: true });
|
|
41
|
-
expect(screen.queryByTestId('wrapper')).toHaveClass(`sliding-panel--border-${position}`);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should render children', () => {
|
|
48
|
-
customRender();
|
|
49
|
-
expect(screen.getByTestId('content')).toBeInTheDocument();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should respect className', () => {
|
|
53
|
-
const className = 'customClass';
|
|
54
|
-
customRender({ className });
|
|
55
|
-
expect(screen.getByTestId('wrapper')).toHaveClass(className);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('slidingPanelPositionFixed', () => {
|
|
59
|
-
it('should not be fixed by default', () => {
|
|
60
|
-
customRender();
|
|
61
|
-
expect(screen.getByTestId('wrapper')).not.toHaveClass('sliding-panel--fixed');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should respect slidingPanelPositionFixed=true', () => {
|
|
65
|
-
customRender({ slidingPanelPositionFixed: true });
|
|
66
|
-
expect(screen.getByTestId('wrapper')).toHaveClass('sliding-panel--fixed');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|