@patternfly/react-table 4.105.3 → 4.105.6
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/CHANGELOG.md +30 -0
- package/dist/umd/react-table.css +663 -662
- package/dist/umd/react-table.js +3 -5
- package/dist/umd/react-table.min.css +1589 -1588
- package/dist/umd/react-table.min.js +4 -4
- package/package.json +6 -6
- package/src/components/Table/utils/transformers.test.tsx +31 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.105.
|
|
3
|
+
"version": "4.105.6",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^4.236.
|
|
35
|
-
"@patternfly/react-icons": "^4.87.
|
|
36
|
-
"@patternfly/react-styles": "^4.86.
|
|
37
|
-
"@patternfly/react-tokens": "^4.88.
|
|
34
|
+
"@patternfly/react-core": "^4.236.6",
|
|
35
|
+
"@patternfly/react-icons": "^4.87.6",
|
|
36
|
+
"@patternfly/react-styles": "^4.86.6",
|
|
37
|
+
"@patternfly/react-tokens": "^4.88.6",
|
|
38
38
|
"lodash": "^4.17.19",
|
|
39
39
|
"tslib": "^2.0.0"
|
|
40
40
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react": "^16.8.0 || ^17.0.0",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "93b27d3315b0cb48b257beee955780016df60719"
|
|
50
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
ISeparator
|
|
31
31
|
} from '../TableTypes';
|
|
32
32
|
|
|
33
|
-
const testCellActions = ({
|
|
33
|
+
const testCellActions = async ({
|
|
34
34
|
actions,
|
|
35
35
|
actionResolver,
|
|
36
36
|
areActionsDisabled,
|
|
@@ -45,6 +45,7 @@ const testCellActions = ({
|
|
|
45
45
|
extraData?: IExtraData;
|
|
46
46
|
expectDisabled?: boolean;
|
|
47
47
|
}) => {
|
|
48
|
+
const user = userEvent.setup();
|
|
48
49
|
const returnedData = cellActions(
|
|
49
50
|
actions,
|
|
50
51
|
actionResolver,
|
|
@@ -70,14 +71,16 @@ const testCellActions = ({
|
|
|
70
71
|
expect(returnedData.children).toBeUndefined();
|
|
71
72
|
} else {
|
|
72
73
|
const { container } = render(returnedData.children as React.ReactElement<any>);
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
await user.click(screen.getAllByRole('button')[0]);
|
|
75
|
+
await waitFor(() =>
|
|
76
|
+
expect(container.querySelectorAll('.pf-c-dropdown__menu li button')).toHaveLength(expectDisabled ? 0 : 1)
|
|
77
|
+
);
|
|
75
78
|
}
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
describe('Transformer functions', () => {
|
|
79
82
|
describe('selectable', () => {
|
|
80
|
-
test('main select', () => {
|
|
83
|
+
test('main select', async () => {
|
|
81
84
|
const onSelect = jest.fn((_event, selected, rowId) => ({ selected, rowId }));
|
|
82
85
|
const column = {
|
|
83
86
|
extraParams: { onSelect }
|
|
@@ -85,24 +88,27 @@ describe('Transformer functions', () => {
|
|
|
85
88
|
const returnedData = selectable('', { column, rowData: {} } as IExtra);
|
|
86
89
|
expect(returnedData).toMatchObject({ className: 'pf-c-table__check' });
|
|
87
90
|
|
|
91
|
+
const user = userEvent.setup();
|
|
92
|
+
|
|
88
93
|
render(returnedData.children as React.ReactElement<any>);
|
|
89
94
|
|
|
90
|
-
|
|
95
|
+
await user.type(screen.getByRole('textbox'), 'a');
|
|
91
96
|
expect(onSelect).toHaveBeenCalledTimes(1);
|
|
92
97
|
expect(onSelect.mock.results[0].value).toMatchObject({ rowId: -1, selected: false });
|
|
93
98
|
});
|
|
94
99
|
|
|
95
|
-
test('selected', () => {
|
|
100
|
+
test('selected', async () => {
|
|
96
101
|
const onSelect = jest.fn((_event, selected, rowId) => ({ selected, rowId }));
|
|
97
102
|
const column = {
|
|
98
103
|
extraParams: { onSelect }
|
|
99
104
|
};
|
|
100
105
|
const returnedData = selectable('', { column, rowIndex: 0, rowData: { selected: true } } as IExtra);
|
|
101
106
|
expect(returnedData).toMatchObject({ className: 'pf-c-table__check' });
|
|
107
|
+
const user = userEvent.setup();
|
|
102
108
|
|
|
103
109
|
render(returnedData.children as React.ReactElement<any>);
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
await user.type(screen.getByRole('textbox'), 'a');
|
|
106
112
|
expect(onSelect).toHaveBeenCalledTimes(1);
|
|
107
113
|
expect(onSelect.mock.results[0].value).toMatchObject({ rowId: 0, selected: false });
|
|
108
114
|
});
|
|
@@ -118,41 +124,47 @@ describe('Transformer functions', () => {
|
|
|
118
124
|
});
|
|
119
125
|
|
|
120
126
|
describe('sortable', () => {
|
|
121
|
-
test('unsorted', () => {
|
|
127
|
+
test('unsorted', async () => {
|
|
122
128
|
const onSort = jest.fn();
|
|
123
129
|
const column = { extraParams: { sortBy: {}, onSort } };
|
|
124
130
|
const returnedData = sortable('', { column, columnIndex: 0 });
|
|
125
131
|
expect(returnedData).toMatchObject({ className: 'pf-c-table__sort' });
|
|
126
132
|
|
|
133
|
+
const user = userEvent.setup();
|
|
134
|
+
|
|
127
135
|
render(returnedData.children as React.ReactElement<any>);
|
|
128
|
-
|
|
136
|
+
await user.click(screen.getByRole('button'));
|
|
129
137
|
expect(onSort.mock.calls).toHaveLength(1);
|
|
130
138
|
});
|
|
131
139
|
|
|
132
|
-
test('asc', () => {
|
|
140
|
+
test('asc', async () => {
|
|
133
141
|
const onSort = jest.fn();
|
|
134
142
|
const column = { extraParams: { sortBy: { index: 0, direction: 'asc' }, onSort } };
|
|
135
143
|
const returnedData = sortable('', { column, columnIndex: 0 } as IExtra);
|
|
136
144
|
expect(returnedData).toMatchSnapshot();
|
|
137
145
|
|
|
146
|
+
const user = userEvent.setup();
|
|
147
|
+
|
|
138
148
|
render(returnedData.children as React.ReactElement<any>);
|
|
139
|
-
|
|
149
|
+
await user.click(screen.getByRole('button'));
|
|
140
150
|
expect(onSort.mock.calls).toHaveLength(1);
|
|
141
151
|
});
|
|
142
152
|
|
|
143
|
-
test('desc', () => {
|
|
153
|
+
test('desc', async () => {
|
|
144
154
|
const onSort = jest.fn();
|
|
145
155
|
const column = { extraParams: { sortBy: { index: 0, direction: 'desc' }, onSort } };
|
|
146
156
|
const returnedData = sortable('', { column, columnIndex: 0 } as IExtra);
|
|
147
157
|
expect(returnedData).toMatchObject({ className: 'pf-c-table__sort pf-m-selected' });
|
|
148
158
|
|
|
159
|
+
const user = userEvent.setup();
|
|
160
|
+
|
|
149
161
|
render(returnedData.children as React.ReactElement<any>);
|
|
150
|
-
|
|
162
|
+
await user.click(screen.getByRole('button'));
|
|
151
163
|
expect(onSort.mock.calls).toHaveLength(1);
|
|
152
164
|
});
|
|
153
165
|
});
|
|
154
166
|
|
|
155
|
-
test('simpleCellActions', () => {
|
|
167
|
+
test('simpleCellActions', async () => {
|
|
156
168
|
const actions: IActions = [
|
|
157
169
|
{
|
|
158
170
|
title: 'Some',
|
|
@@ -205,7 +217,7 @@ describe('Transformer functions', () => {
|
|
|
205
217
|
);
|
|
206
218
|
});
|
|
207
219
|
|
|
208
|
-
test('collapsible', () => {
|
|
220
|
+
test('collapsible', async () => {
|
|
209
221
|
const onCollapse = jest.fn();
|
|
210
222
|
const rowData = {
|
|
211
223
|
isOpen: true
|
|
@@ -216,8 +228,10 @@ describe('Transformer functions', () => {
|
|
|
216
228
|
const returnedData = collapsible('', { rowIndex: 0, rowData, column });
|
|
217
229
|
expect(returnedData).toMatchObject({ className: 'pf-c-table__toggle' });
|
|
218
230
|
|
|
231
|
+
const user = userEvent.setup();
|
|
232
|
+
|
|
219
233
|
render(returnedData.children as React.ReactElement<any>);
|
|
220
|
-
|
|
234
|
+
await user.click(screen.getByRole('button'));
|
|
221
235
|
expect(onCollapse.mock.calls).toHaveLength(1);
|
|
222
236
|
});
|
|
223
237
|
|