@patternfly/react-table 4.67.11 → 4.67.12

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.67.12 (2022-03-02)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-table
9
+
10
+
11
+
12
+
13
+
6
14
  ## 4.67.11 (2022-03-02)
7
15
 
8
16
  **Note:** Version bump only for package @patternfly/react-table
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "4.67.11",
3
+ "version": "4.67.12",
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.198.11",
35
- "@patternfly/react-icons": "^4.49.11",
36
- "@patternfly/react-styles": "^4.48.11",
37
- "@patternfly/react-tokens": "^4.50.11",
34
+ "@patternfly/react-core": "^4.198.12",
35
+ "@patternfly/react-icons": "^4.49.12",
36
+ "@patternfly/react-styles": "^4.48.12",
37
+ "@patternfly/react-tokens": "^4.50.12",
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": "ec9f6804157ea17da2e5bc77cee14428867f878f"
49
+ "gitHead": "2f37e9854ab448a91848398d42e93c6d31fb07d1"
50
50
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import { RowWrapper, RowWrapperProps } from './RowWrapper';
4
4
 
5
5
  const getRowWrapper = (props: RowWrapperProps) => (
@@ -13,12 +13,12 @@ const getRowWrapper = (props: RowWrapperProps) => (
13
13
  describe('RowWrapper', () => {
14
14
  test('renders correctly', () => {
15
15
  const trRef = jest.fn();
16
- const view = mount(getRowWrapper({ onScroll: jest.fn(), onResize: jest.fn(), trRef }));
17
- expect(view).toMatchSnapshot();
16
+ const view = render(getRowWrapper({ onScroll: jest.fn(), onResize: jest.fn(), trRef }));
17
+ expect(view.container).toMatchSnapshot();
18
18
  expect(trRef.mock.calls).toHaveLength(1);
19
19
  });
20
20
  test('renders expanded correctly', () => {
21
- const view = mount(getRowWrapper({ row: { isExpanded: true } }));
22
- expect(view).toMatchSnapshot();
21
+ const view = render(getRowWrapper({ row: { isExpanded: true } }));
22
+ expect(view.container).toMatchSnapshot();
23
23
  });
24
24
  });
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { render } from '@testing-library/react';
2
3
  import { mount } from 'enzyme';
3
4
  import {
4
5
  Table,
@@ -30,90 +31,90 @@ import { ColumnsType } from './base';
30
31
 
31
32
  describe('Simple table', () => {
32
33
  test('caption', () => {
33
- const view = mount(
34
+ const view = render(
34
35
  <Table caption="Simple Table" cells={columns} rows={rows}>
35
36
  <TableHeader />
36
37
  <TableBody />
37
38
  </Table>
38
39
  );
39
- expect(view).toMatchSnapshot();
40
+ expect(view.container).toMatchSnapshot();
40
41
  });
41
42
 
42
43
  test('header', () => {
43
- const view = mount(
44
+ const view = render(
44
45
  <Table header={<h4>Header title</h4>} cells={columns} rows={rows}>
45
46
  <TableHeader />
46
47
  <TableBody />
47
48
  </Table>
48
49
  );
49
- expect(view).toMatchSnapshot();
50
+ expect(view.container).toMatchSnapshot();
50
51
  });
51
52
  test('aria-label', () => {
52
- const view = mount(
53
+ const view = render(
53
54
  <Table aria-label="Aria labeled" cells={columns} rows={rows}>
54
55
  <TableHeader />
55
56
  <TableBody />
56
57
  </Table>
57
58
  );
58
- expect(view).toMatchSnapshot();
59
+ expect(view.container).toMatchSnapshot();
59
60
  });
60
61
  });
61
62
 
62
63
  test('Editable table', () => {
63
64
  const onRowEdit: OnRowEdit = () => undefined;
64
- const view = mount(
65
+ const view = render(
65
66
  <Table caption="Editable Table" cells={editableColumns} rows={editableRows} onRowEdit={onRowEdit}>
66
67
  <TableHeader />
67
68
  <TableBody />
68
69
  </Table>
69
70
  );
70
- expect(view).toMatchSnapshot();
71
+ expect(view.container).toMatchSnapshot();
71
72
  });
72
73
 
73
74
  test('Sortable table', () => {
74
75
  const onSortCall: OnSort = () => undefined;
75
76
  columns[0] = { ...(columns[0] as object), transforms: [sortable] };
76
- const view = mount(
77
+ const view = render(
77
78
  <Table aria-label="Aria labeled" onSort={onSortCall} sortBy={{}} cells={columns} rows={rows}>
78
79
  <TableHeader />
79
80
  <TableBody />
80
81
  </Table>
81
82
  );
82
- expect(view).toMatchSnapshot();
83
+ expect(view.container).toMatchSnapshot();
83
84
  });
84
85
 
85
86
  test('Row click table', () => {
86
87
  const rowClickHandler = jest.fn();
87
- const view = mount(
88
+ const view = render(
88
89
  <Table aria-label="Row click table" cells={columns} rows={rows}>
89
90
  <TableHeader />
90
91
  <TableBody onRowClick={rowClickHandler} />
91
92
  </Table>
92
93
  );
93
- expect(view).toMatchSnapshot();
94
+ expect(view.container).toMatchSnapshot();
94
95
  });
95
96
 
96
97
  describe('Table variants', () => {
97
98
  Object.values(TableGridBreakpoint).forEach(oneBreakpoint => {
98
99
  test(`Breakpoint - ${oneBreakpoint}`, () => {
99
- const view = mount(
100
+ const view = render(
100
101
  <Table aria-label="Aria labeled" gridBreakPoint={oneBreakpoint} cells={columns} rows={rows}>
101
102
  <TableHeader />
102
103
  <TableBody />
103
104
  </Table>
104
105
  );
105
- expect(view).toMatchSnapshot();
106
+ expect(view.container).toMatchSnapshot();
106
107
  });
107
108
  });
108
109
  Object.values(TableVariant).forEach(onevariant => {
109
110
  test(`Size - ${onevariant}`, () => {
110
- const view = mount(
111
+ const view = render(
111
112
  <Table aria-label="Aria labeled" variant={onevariant} cells={columns} rows={rows}>
112
113
  <TableHeader />
113
114
  <TableBody />
114
115
  </Table>
115
116
  );
116
- expect(view).toMatchSnapshot();
117
+ expect(view.container).toMatchSnapshot();
117
118
  });
118
119
  });
119
120
  });
@@ -127,17 +128,17 @@ test('Simple Actions table', () => {
127
128
  }
128
129
  ];
129
130
 
130
- const view = mount(
131
+ const view = render(
131
132
  <Table aria-label="Aria labeled" actions={actions} cells={columns} rows={rowsWithDisabledAction}>
132
133
  <TableHeader />
133
134
  <TableBody />
134
135
  </Table>
135
136
  );
136
- expect(view).toMatchSnapshot();
137
+ expect(view.container).toMatchSnapshot();
137
138
  });
138
139
 
139
140
  test('Actions table', () => {
140
- const view = mount(
141
+ const view = render(
141
142
  <Table
142
143
  aria-label="Aria labeled"
143
144
  actionResolver={() => actions}
@@ -149,18 +150,18 @@ test('Actions table', () => {
149
150
  <TableBody />
150
151
  </Table>
151
152
  );
152
- expect(view).toMatchSnapshot();
153
+ expect(view.container).toMatchSnapshot();
153
154
  });
154
155
 
155
156
  test('Cell header table', () => {
156
157
  columns[0] = { ...(columns[0] as object), cellTransforms: [headerCol('test-headercol-')] };
157
- const view = mount(
158
+ const view = render(
158
159
  <Table aria-label="Aria labeled" cells={columns} rows={rows}>
159
160
  <TableHeader />
160
161
  <TableBody />
161
162
  </Table>
162
163
  );
163
- expect(view).toMatchSnapshot();
164
+ expect(view.container).toMatchSnapshot();
164
165
  });
165
166
 
166
167
  test('Collapsible table', () => {
@@ -170,13 +171,13 @@ test('Collapsible table', () => {
170
171
  rows[4] = { ...rows[4], parent: 3 };
171
172
  columns[0] = { ...(columns[0] as object), cellFormatters: [expandable] };
172
173
  const onCollapse: OnCollapse = () => undefined;
173
- const view = mount(
174
+ const view = render(
174
175
  <Table aria-label="Aria labeled" onCollapse={onCollapse} cells={columns} rows={rows}>
175
176
  <TableHeader />
176
177
  <TableBody />
177
178
  </Table>
178
179
  );
179
- expect(view).toMatchSnapshot();
180
+ expect(view.container).toMatchSnapshot();
180
181
  });
181
182
 
182
183
  test('Compound Expandable table', () => {
@@ -203,13 +204,13 @@ test('Compound Expandable table', () => {
203
204
  { parent: 2, compoundParent: 0, cells: [{ title: 'expanded', props: { colSpan: 2 } }] }
204
205
  ];
205
206
  const onExpand: OnExpand = () => undefined;
206
- const view = mount(
207
+ const view = render(
207
208
  <Table aria-label="Aria labeled" onExpand={onExpand} cells={compoundColumns} rows={compoundRows}>
208
209
  <TableHeader />
209
210
  <TableBody />
210
211
  </Table>
211
212
  );
212
- expect(view).toMatchSnapshot();
213
+ expect(view.container).toMatchSnapshot();
213
214
  });
214
215
 
215
216
  test('Collapsible nested table', () => {
@@ -217,29 +218,29 @@ test('Collapsible nested table', () => {
217
218
  rows[1] = { ...rows[1], parent: 0, isOpen: true };
218
219
  rows[2] = { ...rows[2], parent: 1 };
219
220
  const onCollapse: OnCollapse = () => undefined;
220
- const view = mount(
221
+ const view = render(
221
222
  <Table aria-label="Aria labeled" onCollapse={onCollapse} cells={columns} rows={rows}>
222
223
  <TableHeader />
223
224
  <TableBody />
224
225
  </Table>
225
226
  );
226
- expect(view).toMatchSnapshot();
227
+ expect(view.container).toMatchSnapshot();
227
228
  });
228
229
 
229
230
  test('Selectable table', () => {
230
231
  const onSelect: OnSelect = () => undefined;
231
- const view = mount(
232
+ const view = render(
232
233
  <Table aria-label="Aria labeled" onSelect={onSelect} cells={columns} rows={rows}>
233
234
  <TableHeader />
234
235
  <TableBody />
235
236
  </Table>
236
237
  );
237
- expect(view).toMatchSnapshot();
238
+ expect(view.container).toMatchSnapshot();
238
239
  });
239
240
 
240
241
  test('Selectable table with Radio', () => {
241
242
  const onSelect: OnSelect = () => undefined;
242
- const view = mount(
243
+ const view = render(
243
244
  <Table
244
245
  aria-label="Aria labeled"
245
246
  selectVariant={RowSelectVariant.radio}
@@ -251,7 +252,7 @@ test('Selectable table with Radio', () => {
251
252
  <TableBody />
252
253
  </Table>
253
254
  );
254
- expect(view).toMatchSnapshot();
255
+ expect(view.container).toMatchSnapshot();
255
256
  });
256
257
 
257
258
  test('Control text table', () => {
@@ -263,26 +264,26 @@ test('Control text table', () => {
263
264
  { ...(columns[4] as object), transforms: [fitContent] }
264
265
  ];
265
266
 
266
- const view = mount(
267
+ const view = render(
267
268
  <Table aria-label="Aria labeled" cells={controlTextColumns} rows={rows}>
268
269
  <TableHeader />
269
270
  <TableBody />
270
271
  </Table>
271
272
  );
272
- expect(view).toMatchSnapshot();
273
+ expect(view.container).toMatchSnapshot();
273
274
  });
274
275
 
275
276
  test('Header width table', () => {
276
277
  columns[0] = { ...(columns[0] as object), transforms: [cellWidth(10)] };
277
278
  columns[2] = { ...(columns[2] as object), transforms: [cellWidth(30)] };
278
279
  columns[4] = { ...(columns[4] as object), transforms: [cellWidth(100)] };
279
- const view = mount(
280
+ const view = render(
280
281
  <Table aria-label="Aria labeled" cells={columns} rows={rows}>
281
282
  <TableHeader />
282
283
  <TableBody />
283
284
  </Table>
284
285
  );
285
- expect(view).toMatchSnapshot();
286
+ expect(view.container).toMatchSnapshot();
286
287
  });
287
288
 
288
289
  test('Selectable table with selected expandable row', () => {
@@ -1,113 +1,31 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`RowWrapper renders correctly 1`] = `
4
- <table>
5
- <tbody>
6
- <RowWrapper
7
- className=""
8
- onResize={[MockFunction]}
9
- onScroll={[MockFunction]}
10
- row={
11
- Object {
12
- "isEditable": undefined,
13
- "isExpanded": undefined,
14
- "isHeightAuto": undefined,
15
- "isOpen": undefined,
16
- }
17
- }
18
- rowProps={null}
19
- trRef={
20
- [MockFunction] {
21
- "calls": Array [
22
- Array [
23
- <tr
24
- class=""
25
- data-ouia-component-id="OUIA-Generated-TableRow-1"
26
- data-ouia-component-type="PF4/TableRow"
27
- data-ouia-safe="true"
28
- />,
29
- ],
30
- ],
31
- "results": Array [
32
- Object {
33
- "type": "return",
34
- "value": undefined,
35
- },
36
- ],
37
- }
38
- }
39
- >
40
- <Tr
41
- className=""
42
- >
43
- <TrBase
44
- className=""
45
- innerRef={
46
- [MockFunction] {
47
- "calls": Array [
48
- Array [
49
- <tr
50
- class=""
51
- data-ouia-component-id="OUIA-Generated-TableRow-1"
52
- data-ouia-component-type="PF4/TableRow"
53
- data-ouia-safe="true"
54
- />,
55
- ],
56
- ],
57
- "results": Array [
58
- Object {
59
- "type": "return",
60
- "value": undefined,
61
- },
62
- ],
63
- }
64
- }
65
- >
66
- <tr
67
- className=""
68
- data-ouia-component-id="OUIA-Generated-TableRow-1"
69
- data-ouia-component-type="PF4/TableRow"
70
- data-ouia-safe={true}
71
- hidden={false}
72
- />
73
- </TrBase>
74
- </Tr>
75
- </RowWrapper>
76
- </tbody>
77
- </table>
4
+ <div>
5
+ <table>
6
+ <tbody>
7
+ <tr
8
+ class=""
9
+ data-ouia-component-id="OUIA-Generated-TableRow-1"
10
+ data-ouia-component-type="PF4/TableRow"
11
+ data-ouia-safe="true"
12
+ />
13
+ </tbody>
14
+ </table>
15
+ </div>
78
16
  `;
79
17
 
80
18
  exports[`RowWrapper renders expanded correctly 1`] = `
81
- <table>
82
- <tbody>
83
- <RowWrapper
84
- className=""
85
- row={
86
- Object {
87
- "isExpanded": true,
88
- }
89
- }
90
- rowProps={null}
91
- >
92
- <Tr
93
- className=""
94
- isExpanded={true}
95
- >
96
- <TrBase
97
- className=""
98
- innerRef={null}
99
- isExpanded={true}
100
- >
101
- <tr
102
- className="pf-c-table__expandable-row pf-m-expanded"
103
- data-ouia-component-id="OUIA-Generated-TableRow-2"
104
- data-ouia-component-type="PF4/TableRow"
105
- data-ouia-safe={true}
106
- hidden={false}
107
- />
108
- </TrBase>
109
- </Tr>
110
- </RowWrapper>
111
- </tbody>
112
- </table>
19
+ <div>
20
+ <table>
21
+ <tbody>
22
+ <tr
23
+ class="pf-c-table__expandable-row pf-m-expanded"
24
+ data-ouia-component-id="OUIA-Generated-TableRow-2"
25
+ data-ouia-component-type="PF4/TableRow"
26
+ data-ouia-safe="true"
27
+ />
28
+ </tbody>
29
+ </table>
30
+ </div>
113
31
  `;