@transferwise/components 0.0.0-experimental-696128b → 0.0.0-experimental-328f2cc
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 +4 -10
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +4 -10
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/Button.js +79 -81
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +80 -82
- package/build/button/Button.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/header/Header.js +2 -2
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +2 -1
- package/build/index.mjs.map +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 +13 -224
- package/build/nudge/Nudge.js.map +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 +2 -2
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +2 -12
- package/build/styles/button/Button.css +15 -204
- package/build/styles/main.css +13 -224
- package/build/styles/nudge/Nudge.css +11 -0
- package/build/table/Table.js +166 -0
- package/build/table/Table.js.map +1 -0
- package/build/table/Table.messages.js +24 -0
- package/build/table/Table.messages.js.map +1 -0
- package/build/table/Table.messages.mjs +22 -0
- package/build/table/Table.messages.mjs.map +1 -0
- package/build/table/Table.mjs +164 -0
- package/build/table/Table.mjs.map +1 -0
- package/build/table/TableCell.js +86 -0
- package/build/table/TableCell.js.map +1 -0
- package/build/table/TableCell.mjs +84 -0
- package/build/table/TableCell.mjs.map +1 -0
- package/build/table/TableHeader.js +57 -0
- package/build/table/TableHeader.js.map +1 -0
- package/build/table/TableHeader.mjs +55 -0
- package/build/table/TableHeader.mjs.map +1 -0
- package/build/table/TableRow.js +85 -0
- package/build/table/TableRow.js.map +1 -0
- package/build/table/TableRow.mjs +83 -0
- package/build/table/TableRow.mjs.map +1 -0
- package/build/table/TableStatusText.js +54 -0
- package/build/table/TableStatusText.js.map +1 -0
- package/build/table/TableStatusText.mjs +52 -0
- package/build/table/TableStatusText.mjs.map +1 -0
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +23 -2
- 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/index.d.ts +2 -0
- package/build/types/index.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/nudge/Nudge.d.ts +1 -1
- package/build/types/nudge/Nudge.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 +2 -6
- 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/test-utils/story-config.d.ts +1 -1
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/getAllowedFileTypes.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/build/uploadInput/uploadButton/getAllowedFileTypes.js +23 -3
- package/build/uploadInput/uploadButton/getAllowedFileTypes.js.map +1 -1
- package/build/uploadInput/uploadButton/getAllowedFileTypes.mjs +23 -3
- package/build/uploadInput/uploadButton/getAllowedFileTypes.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.tests.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.css +2 -12
- package/src/avatarLayout/AvatarLayout.less +2 -19
- package/src/avatarLayout/AvatarLayout.tsx +3 -10
- package/src/button/Button.css +15 -204
- package/src/button/Button.less +14 -211
- package/src/button/Button.spec.tsx +227 -75
- package/src/button/Button.story.tsx +135 -728
- package/src/button/Button.tsx +131 -94
- package/src/button/__snapshots__/Button.spec.tsx.snap +309 -0
- package/src/button/index.ts +3 -2
- package/src/drawer/Drawer.spec.tsx +93 -0
- package/src/field/Field.story.tsx +1 -1
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +1 -1
- package/src/index.ts +12 -0
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/label/Label.story.tsx +1 -1
- package/src/link/Link.tsx +6 -15
- package/src/main.css +13 -224
- package/src/main.less +0 -1
- package/src/nudge/Nudge.css +11 -0
- package/src/nudge/Nudge.less +3 -0
- package/src/nudge/Nudge.story.tsx +10 -0
- package/src/nudge/Nudge.tsx +2 -1
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +7 -1
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.ts +2 -7
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +3 -1
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +8 -1
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +5 -2
- package/src/test-utils/Parameters.d.ts +1 -9
- package/src/test-utils/story-config.ts +1 -10
- package/src/uploadInput/UploadInput.tests.story.tsx +5 -5
- package/src/uploadInput/uploadButton/getAllowedFileTypes.spec.ts +12 -0
- package/src/uploadInput/uploadButton/getAllowedFileTypes.ts +33 -7
- package/build/button/Button.resolver.js +0 -74
- package/build/button/Button.resolver.js.map +0 -1
- package/build/button/Button.resolver.mjs +0 -72
- 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 -39
- package/build/styles/button/LegacyButton.css +0 -23
- package/build/types/button/Button.resolver.d.ts +0 -33
- package/build/types/button/Button.resolver.d.ts.map +0 -1
- package/build/types/button/Button.types.d.ts +0 -58
- 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 -73
- package/src/button/Button.tests.story.tsx +0 -27
- package/src/button/Button.types.ts +0 -74
- package/src/button/Button.vars.css +0 -39
- package/src/button/Button.vars.less +0 -50
- package/src/button/LegacyButton.css +0 -23
- package/src/button/LegacyButton.less +0 -24
- package/src/button/LegacyButton.spec.tsx +0 -147
- package/src/button/LegacyButton.story.tsx +0 -225
- package/src/button/LegacyButton.tsx +0 -160
- package/src/drawer/Drawer.rtl.spec.tsx +0 -59
- package/src/drawer/Drawer.spec.js +0 -101
- package/src/drawer/__snapshots__/Drawer.rtl.spec.tsx.snap +0 -55
|
@@ -1,94 +1,246 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ControlType, Type, Priority, Size } from '../common';
|
|
4
|
+
import { render, screen, userEvent } from '../test-utils';
|
|
5
|
+
|
|
6
|
+
import Button from '.';
|
|
7
|
+
import messages from '../i18n/commonMessages/Button.messages';
|
|
8
|
+
import { ButtonReferenceType } from './Button';
|
|
9
|
+
|
|
10
|
+
const { ACCENT, POSITIVE, NEGATIVE } = ControlType;
|
|
11
|
+
const { PAY, LINK, DANGER } = Type;
|
|
12
|
+
const { PRIMARY, SECONDARY, TERTIARY } = Priority;
|
|
13
|
+
const { SMALL, MEDIUM, LARGE } = Size;
|
|
3
14
|
|
|
4
15
|
describe('Button', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
size: 'md',
|
|
9
|
-
type: 'accent',
|
|
10
|
-
};
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
const originalWarn = console.warn;
|
|
18
|
+
let mockedWarn: typeof originalWarn;
|
|
11
19
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
testId: 'new-button',
|
|
20
|
+
const props = {
|
|
21
|
+
onClick: jest.fn(),
|
|
22
|
+
onFocus: jest.fn(),
|
|
23
|
+
onBlur: jest.fn(),
|
|
24
|
+
children: 'Send money',
|
|
18
25
|
};
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
beforeAll(() => {
|
|
28
|
+
mockedWarn = jest.fn().mockImplementation((args) => {
|
|
29
|
+
if (typeof args !== 'string' || !args.startsWith('Button has deprecated the')) {
|
|
30
|
+
originalWarn(args);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.warn = mockedWarn;
|
|
25
35
|
});
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
beforeEach(jest.clearAllMocks);
|
|
38
|
+
|
|
39
|
+
afterAll(() => {
|
|
40
|
+
// eslint-disable-next-line no-console
|
|
41
|
+
console.warn = originalWarn;
|
|
32
42
|
});
|
|
33
43
|
|
|
34
|
-
describe('
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
describe('by default', () => {
|
|
45
|
+
it('renders the text', () => {
|
|
46
|
+
render(<Button {...props} />);
|
|
47
|
+
expect(screen.getByText(props.children)).toBeInTheDocument();
|
|
48
|
+
});
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
render(<Button v2>{name}</Button>);
|
|
41
|
-
expect(screen.getByRole('button', { name })).toBeInTheDocument();
|
|
42
|
-
});
|
|
43
|
-
it('should render as link if href is provided', () => {
|
|
44
|
-
render(
|
|
45
|
-
<Button v2 href={href}>
|
|
46
|
-
{name}
|
|
47
|
-
</Button>,
|
|
48
|
-
);
|
|
49
|
-
expect(screen.getByRole('link', { name })).toHaveAttribute('href', href);
|
|
50
|
-
});
|
|
50
|
+
it('set `ref` to be true on Button', () => {
|
|
51
|
+
const reference = createRef<ButtonReferenceType>();
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</Button>,
|
|
57
|
-
);
|
|
58
|
-
expect(screen.getByText(name).closest('a')).toBeInTheDocument();
|
|
59
|
-
});
|
|
53
|
+
expect(reference.current).toBeFalsy();
|
|
54
|
+
render(<Button ref={reference}>Click me!</Button>);
|
|
55
|
+
expect(reference.current).toBeTruthy();
|
|
56
|
+
});
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
it('is not disabled', () => {
|
|
59
|
+
render(<Button {...props} />);
|
|
60
|
+
expect(screen.getByRole('button')).toBeEnabled();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('renders a medium button of type accent and priority primary', () => {
|
|
64
|
+
expect(render(<Button {...props} />).container).toMatchSnapshot();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('renders an anchor tag with button styles of type accent and priority primary', () => {
|
|
68
|
+
expect(render(<Button {...props} as="a" href="#" />).container).toMatchSnapshot();
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
describe('button attributes', () => {
|
|
73
|
+
it('sets the htmlType if set', () => {
|
|
74
|
+
render(<Button {...props} htmlType="submit" />);
|
|
75
|
+
expect(screen.getByRole('button')).toHaveAttribute('type', 'submit');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('passes through custom classes if set', () => {
|
|
79
|
+
render(<Button {...props} className="donkeysarethebest" />);
|
|
80
|
+
expect(screen.getByRole('button')).toHaveClass('donkeysarethebest');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('passes through aria-label if set', () => {
|
|
84
|
+
render(<Button {...props} aria-label="unique label" />);
|
|
85
|
+
const loadingButton = screen.getByLabelText('unique label');
|
|
86
|
+
expect(loadingButton).toBeInTheDocument();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('onClick', () => {
|
|
91
|
+
it('calls onClick when clicked', async () => {
|
|
92
|
+
render(<Button {...props} />);
|
|
93
|
+
await userEvent.click(screen.getByRole('button'));
|
|
94
|
+
expect(props.onClick).toHaveBeenCalledTimes(1);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('does not call onClick when clicked if disabled', async () => {
|
|
98
|
+
render(<Button {...props} disabled />);
|
|
99
|
+
await userEvent.click(screen.getByRole('button'));
|
|
100
|
+
expect(props.onClick).toHaveBeenCalledTimes(0);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('does not call onClick when clicked if loading', async () => {
|
|
104
|
+
render(<Button {...props} loading />);
|
|
105
|
+
await userEvent.click(screen.getByRole('button'));
|
|
106
|
+
expect(props.onClick).toHaveBeenCalledTimes(0);
|
|
107
|
+
});
|
|
82
108
|
});
|
|
83
109
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
...
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
110
|
+
describe('onFocus and onBlur', () => {
|
|
111
|
+
it('calls both handlers by default', async () => {
|
|
112
|
+
render(<Button {...props} />);
|
|
113
|
+
await userEvent.tab();
|
|
114
|
+
expect(props.onFocus).toHaveBeenCalledTimes(1);
|
|
115
|
+
await userEvent.tab();
|
|
116
|
+
expect(props.onFocus).toHaveBeenCalledTimes(1);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('does not call either handler if disabled', async () => {
|
|
120
|
+
render(<Button {...props} disabled />);
|
|
121
|
+
await userEvent.tab();
|
|
122
|
+
expect(props.onFocus).not.toHaveBeenCalled();
|
|
123
|
+
await userEvent.tab();
|
|
124
|
+
expect(props.onFocus).not.toHaveBeenCalled();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('calls both handlers if loading', async () => {
|
|
128
|
+
render(<Button {...props} loading />);
|
|
129
|
+
await userEvent.tab();
|
|
130
|
+
expect(props.onFocus).toHaveBeenCalledTimes(1);
|
|
131
|
+
await userEvent.tab();
|
|
132
|
+
expect(props.onFocus).toHaveBeenCalledTimes(1);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe('sizes', () => {
|
|
137
|
+
it('renders small buttons', () => {
|
|
138
|
+
expect(render(<Button {...props} size={SMALL} />).container).toMatchSnapshot();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('renders medium buttons', () => {
|
|
142
|
+
expect(render(<Button {...props} size={MEDIUM} />).container).toMatchSnapshot();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('renders large buttons', () => {
|
|
146
|
+
expect(render(<Button {...props} size={LARGE} />).container).toMatchSnapshot();
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe('types', () => {
|
|
151
|
+
it('renders accent buttons', () => {
|
|
152
|
+
expect(render(<Button {...props} type={ACCENT} />).container).toMatchSnapshot();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('renders positive buttons', () => {
|
|
156
|
+
expect(render(<Button {...props} type={POSITIVE} />).container).toMatchSnapshot();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('renders negative buttons', () => {
|
|
160
|
+
expect(render(<Button {...props} type={NEGATIVE} />).container).toMatchSnapshot();
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe('priorities', () => {
|
|
165
|
+
it('renders primary buttons', () => {
|
|
166
|
+
[ACCENT, POSITIVE, NEGATIVE].forEach((type) =>
|
|
167
|
+
expect(
|
|
168
|
+
render(<Button {...props} priority={PRIMARY} type={type} />).container,
|
|
169
|
+
).toMatchSnapshot(),
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('renders secondary buttons', () => {
|
|
174
|
+
[ACCENT, POSITIVE, NEGATIVE].forEach((type) =>
|
|
175
|
+
expect(
|
|
176
|
+
render(<Button {...props} priority={SECONDARY} type={type} />).container,
|
|
177
|
+
).toMatchSnapshot(),
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('renders tertiary buttons', () => {
|
|
182
|
+
expect(
|
|
183
|
+
render(<Button {...props} priority={TERTIARY} type={ACCENT} />).container,
|
|
184
|
+
).toMatchSnapshot();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('defaults tertiary buttons to secondary for positive buttons', () => {
|
|
188
|
+
[POSITIVE, NEGATIVE].forEach((type) =>
|
|
189
|
+
expect(
|
|
190
|
+
render(<Button {...props} priority={TERTIARY} type={type} />).container,
|
|
191
|
+
).toMatchSnapshot(),
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
describe('other states', () => {
|
|
197
|
+
it('renders as loading if `loading` is true', () => {
|
|
198
|
+
render(<Button {...props} loading />);
|
|
199
|
+
const button = screen.queryByRole('button', {
|
|
200
|
+
name: messages.loadingAriaLabel.defaultMessage,
|
|
201
|
+
});
|
|
202
|
+
expect(button).toBeInTheDocument();
|
|
203
|
+
expect(button).toBeEnabled();
|
|
204
|
+
expect(button).toHaveClass('btn-loading');
|
|
205
|
+
expect(button).toHaveAttribute('aria-disabled', 'true');
|
|
206
|
+
expect(button).toHaveAttribute('aria-busy', 'true');
|
|
207
|
+
expect(button).toHaveAttribute('aria-live', 'polite');
|
|
208
|
+
expect(screen.getByTestId('ButtonProgressIndicator')).toBeInTheDocument();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it('disables the button', () => {
|
|
212
|
+
render(<Button {...props} disabled />);
|
|
213
|
+
const button = screen.queryByRole('button');
|
|
214
|
+
expect(button).toBeDisabled();
|
|
215
|
+
expect(button).toHaveClass('disabled');
|
|
216
|
+
expect(button).toHaveAttribute('aria-disabled', 'false');
|
|
217
|
+
expect(button).toHaveAttribute('aria-busy', 'false');
|
|
218
|
+
expect(button).toHaveAttribute('aria-live', 'off');
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('renders as block if block is true', () => {
|
|
222
|
+
expect(render(<Button {...props} block />).container).toMatchSnapshot();
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe('deprecated types', () => {
|
|
227
|
+
it('renders primary as accent buttons and logs a warning', () => {
|
|
228
|
+
expect(render(<Button {...props} type={PRIMARY} />).container).toMatchSnapshot();
|
|
229
|
+
expect(mockedWarn).toHaveBeenCalledTimes(1);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('renders pay as positive buttons and logs a warning', () => {
|
|
233
|
+
expect(render(<Button {...props} type={PAY} />).container).toMatchSnapshot();
|
|
234
|
+
expect(mockedWarn).toHaveBeenCalledTimes(1);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('renders danger as negative buttons with priority secondary and logs a warning', () => {
|
|
238
|
+
expect(render(<Button {...props} type={DANGER} />).container).toMatchSnapshot();
|
|
239
|
+
expect(mockedWarn).toHaveBeenCalledTimes(1);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('renders link as accent buttons with priority tertiary and logs a warning', () => {
|
|
243
|
+
expect(render(<Button {...props} type={LINK} />).container).toMatchSnapshot();
|
|
244
|
+
});
|
|
93
245
|
});
|
|
94
246
|
});
|