@veritone-ce/design-system 1.12.2 → 1.12.3
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/dist/assets/theme.js +10 -0
- package/dist/components/Button/__tests__/Button.test.js +21 -1
- package/dist/components/FileUploader/__tests__/FileUploader.test.js +29 -46
- package/dist/components/ProgressIndicator/__tests__/ProgressIndicator.test.js +9 -1
- package/dist/components/Select/__tests__/Select.test.js +2 -2
- package/dist/components/Select/index.js +1 -13
- package/dist/components/Tabs/__tests__/Tabs.test.js +9 -4
- package/package.json +1 -1
package/dist/assets/theme.js
CHANGED
|
@@ -256,6 +256,16 @@ theme = createTheme(theme, {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
+
}, MuiMenuItem: {
|
|
260
|
+
styleOverrides: {
|
|
261
|
+
root: {
|
|
262
|
+
color: theme.palette.text.primary,
|
|
263
|
+
padding: '10px 20px',
|
|
264
|
+
':hover, :focus': {
|
|
265
|
+
backgroundColor: theme.palette.misc.altBackground
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
259
269
|
} })
|
|
260
270
|
});
|
|
261
271
|
export default theme;
|
|
@@ -7,8 +7,28 @@ describe('<Button />', () => {
|
|
|
7
7
|
render(_jsx(Button, { children: "Button" }));
|
|
8
8
|
expect(screen.getByText('Button')).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
|
-
it('should
|
|
10
|
+
it('should render error Button component', () => {
|
|
11
|
+
render(_jsx(Button, Object.assign({ color: "error" }, { children: "Button" })));
|
|
12
|
+
expect(screen.getByText('Button')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
it('should render loading Button component', () => {
|
|
11
15
|
render(_jsx(Button, Object.assign({ isLoading: true }, { children: "Button" })));
|
|
12
16
|
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
|
|
13
17
|
});
|
|
18
|
+
it('should render outlined Button component', () => {
|
|
19
|
+
render(_jsx(Button, Object.assign({ variant: "outlined" }, { children: "Button" })));
|
|
20
|
+
expect(screen.getByText('Button')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
it('should render error outlined Button component', () => {
|
|
23
|
+
render(_jsx(Button, Object.assign({ variant: "outlined", color: "error" }, { children: "Button" })));
|
|
24
|
+
expect(screen.getByText('Button')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
it('should render text Button component', () => {
|
|
27
|
+
render(_jsx(Button, Object.assign({ variant: "text" }, { children: "Button" })));
|
|
28
|
+
expect(screen.getByText('Button')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
it('should render error text Button component', () => {
|
|
31
|
+
render(_jsx(Button, Object.assign({ variant: "text", color: "error" }, { children: "Button" })));
|
|
32
|
+
expect(screen.getByText('Button')).toBeInTheDocument();
|
|
33
|
+
});
|
|
14
34
|
});
|
|
@@ -79,7 +79,7 @@ describe('<FileUploader />', () => {
|
|
|
79
79
|
mockedAxios.default.mockImplementation(({
|
|
80
80
|
//@ts-ignore
|
|
81
81
|
onUploadProgress }) => {
|
|
82
|
-
onUploadProgress({ loaded:
|
|
82
|
+
onUploadProgress({ loaded: 100, total: 100 });
|
|
83
83
|
return Promise.resolve({});
|
|
84
84
|
});
|
|
85
85
|
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -87,9 +87,6 @@ describe('<FileUploader />', () => {
|
|
|
87
87
|
}));
|
|
88
88
|
yield waitFor(() => {
|
|
89
89
|
expect(screen.getAllByTestId('file-item')[0]).toBeInTheDocument();
|
|
90
|
-
expect(screen.getAllByTestId('file-progress-bar')[0]).toBeInTheDocument();
|
|
91
|
-
const progressStyles = getComputedStyle(screen.getAllByTestId('file-progress-bar')[0]);
|
|
92
|
-
expect(progressStyles.width).toBe('0%');
|
|
93
90
|
});
|
|
94
91
|
expect(onSuccess).toBeCalled();
|
|
95
92
|
}));
|
|
@@ -208,46 +205,32 @@ describe('<FileUploader />', () => {
|
|
|
208
205
|
|
|
209
206
|
expect(files).toBeCalled()
|
|
210
207
|
})
|
|
211
|
-
|
|
212
|
-
it('should delete a file on list',
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
})
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
expect(screen.getAllByTestId('file-item-size')[0]).toBeInTheDocument()
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
expect(files).toBeCalled()
|
|
244
|
-
|
|
245
|
-
await act(async () => {
|
|
246
|
-
fireEvent.click(screen.getAllByTestId('file-item-delete-button')[0])
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
await waitFor(() => {
|
|
250
|
-
expect(screen.queryAllByTestId('file-item')).toHaveLength(0)
|
|
251
|
-
})
|
|
252
|
-
}) */
|
|
208
|
+
*/
|
|
209
|
+
it('should delete a file on list', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
210
|
+
const files = jest.fn();
|
|
211
|
+
render(_jsx(FileUploader, { uploadUrl: "testing", files: files }));
|
|
212
|
+
const dropzone = screen.getByTestId('dropzone');
|
|
213
|
+
const exampleFile = new File(['file'], 'image.png', {
|
|
214
|
+
type: 'image/png'
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(dropzone, 'files', {
|
|
217
|
+
value: [exampleFile]
|
|
218
|
+
});
|
|
219
|
+
mockedAxios.default.mockImplementation(({
|
|
220
|
+
//@ts-ignore
|
|
221
|
+
onUploadProgress }) => {
|
|
222
|
+
onUploadProgress({ loaded: 0, total: 100 });
|
|
223
|
+
return Promise.resolve({});
|
|
224
|
+
});
|
|
225
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
226
|
+
fireEvent.drop(dropzone);
|
|
227
|
+
}));
|
|
228
|
+
expect(files).toBeCalled();
|
|
229
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
230
|
+
fireEvent.click(screen.getAllByTestId('file-item-delete-button')[0]);
|
|
231
|
+
}));
|
|
232
|
+
yield waitFor(() => {
|
|
233
|
+
expect(screen.queryAllByTestId('file-item')).toHaveLength(0);
|
|
234
|
+
});
|
|
235
|
+
}));
|
|
253
236
|
});
|
|
@@ -4,7 +4,15 @@ import { screen } from '@testing-library/react';
|
|
|
4
4
|
import ProgressIndicator from '../';
|
|
5
5
|
describe('<ProgressIndicator />', () => {
|
|
6
6
|
it('should render the ProgressIndicator component', () => {
|
|
7
|
-
render(_jsx(ProgressIndicator, { "data-testid": "progress-indicator" }));
|
|
7
|
+
render(_jsx(ProgressIndicator, { "data-testid": "progress-indicator", itemLoading: "true" }));
|
|
8
|
+
expect(screen.getByTestId('progress-indicator')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
it('should render component ProgressIndicator type medium', () => {
|
|
11
|
+
render(_jsx(ProgressIndicator, { "data-testid": "progress-indicator", type: "medium", itemLoading: "true" }));
|
|
12
|
+
expect(screen.getByTestId('progress-indicator')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
it('should render component ProgressIndicator type large', () => {
|
|
15
|
+
render(_jsx(ProgressIndicator, { "data-testid": "progress-indicator", type: "large", itemLoading: "true" }));
|
|
8
16
|
expect(screen.getByTestId('progress-indicator')).toBeInTheDocument();
|
|
9
17
|
});
|
|
10
18
|
});
|
|
@@ -8,11 +8,11 @@ const items = [
|
|
|
8
8
|
{ name: 'Three', value: 3 }
|
|
9
9
|
];
|
|
10
10
|
describe('<Select />', () => {
|
|
11
|
-
it
|
|
11
|
+
it('should render the Select component', () => {
|
|
12
12
|
render(_jsx(Select, { "data-testid": "select", label: 'Select', value: '', items: items }));
|
|
13
13
|
expect(screen.getByTestId('select')).toBeInTheDocument();
|
|
14
14
|
});
|
|
15
|
-
it
|
|
15
|
+
it('should render Select component with all properties', () => {
|
|
16
16
|
render(_jsx(Select, { "data-testid": "select", label: 'Select', value: '', helperText: "Helper Text", error: true, errorMessage: "Error Message", items: items }));
|
|
17
17
|
expect(screen.getByTestId('select')).toBeInTheDocument();
|
|
18
18
|
});
|
|
@@ -35,19 +35,7 @@ const Select = (_a) => {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
} }, { children: _jsxs(MuiSelect, Object.assign({}, props, { labelId: "label-select" }, { children: [_jsx(MenuItem, Object.assign({ value: "", sx: {
|
|
39
|
-
color: (theme) => theme.palette.text.primary,
|
|
40
|
-
padding: '10px 20px',
|
|
41
|
-
':hover, :focus': {
|
|
42
|
-
backgroundColor: (theme) => theme.palette.misc.altBackground
|
|
43
|
-
}
|
|
44
|
-
} }, { children: "Select" })), items.map((item, index) => (_jsx(MenuItem, Object.assign({ value: item.value, sx: {
|
|
45
|
-
color: (theme) => theme.palette.text.primary,
|
|
46
|
-
padding: '10px 20px',
|
|
47
|
-
':hover, :focus': {
|
|
48
|
-
backgroundColor: (theme) => theme.palette.misc.altBackground
|
|
49
|
-
}
|
|
50
|
-
} }, { children: _jsxs(Box, Object.assign({ sx: { lineHeight: '20px', fontSize: '14px', opacity: 0.9 } }, { children: [_jsx(Box, Object.assign({ sx: { fontWeight: 700 } }, { children: item.title })), _jsx(Box, { children: item.name })] })) }), index)))] })) })), helperText && (_jsx(FormHelperText, Object.assign({ sx: {
|
|
38
|
+
} }, { children: _jsxs(MuiSelect, Object.assign({}, props, { labelId: "label-select" }, { children: [_jsx(MenuItem, Object.assign({ value: "" }, { children: "Select" })), items.map((item, index) => (_jsx(MenuItem, Object.assign({ value: item.value }, { children: _jsxs(Box, Object.assign({ sx: { lineHeight: '20px', fontSize: '14px', opacity: 0.9 } }, { children: [_jsx(Box, Object.assign({ sx: { fontWeight: 700 } }, { children: item.title })), _jsx(Box, { children: item.name })] })) }), index)))] })) })), helperText && (_jsx(FormHelperText, Object.assign({ sx: {
|
|
51
39
|
lineHeight: '18px',
|
|
52
40
|
color: (theme) => theme.palette.text.disabled
|
|
53
41
|
} }, { children: helperText }))), props.error && (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(Circle, { sx: {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { render } from '../../../utils/tests/helpers';
|
|
3
|
+
import { Tabs } from '@mui/material';
|
|
3
4
|
import { screen } from '@testing-library/react';
|
|
4
|
-
import
|
|
5
|
+
import Tab from '../';
|
|
5
6
|
describe('<Tabs />', () => {
|
|
6
7
|
it('should render the Tabs component', () => {
|
|
7
|
-
render(
|
|
8
|
-
expect(screen.
|
|
8
|
+
render(_jsxs(Tabs, Object.assign({ value: 1 }, { children: [_jsx(Tab, { "data-testid": "tab", label: "test", value: 1 }), _jsx(Tab, { "data-testid": "tab", label: "test", value: 2 })] })));
|
|
9
|
+
expect(screen.getAllByTestId('tab')[0]).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
it('should render the Tabs component with badge', () => {
|
|
12
|
+
render(_jsxs(Tabs, Object.assign({ value: 1 }, { children: [_jsx(Tab, { "data-testid": "tab", label: "test", count: 2, value: 1 }), _jsx(Tab, { "data-testid": "tab", label: "test", count: 2, value: 2 })] })));
|
|
13
|
+
expect(screen.getAllByTestId('tab')[0]).toBeInTheDocument();
|
|
9
14
|
});
|
|
10
15
|
});
|