@patternfly/react-table 4.71.37 → 4.72.2

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.
@@ -14906,17 +14906,24 @@ ul.pf-c-list {
14906
14906
  grid-template-columns: 1fr auto;
14907
14907
  }
14908
14908
  }
14909
+ .pf-c-login__main-header-utilities,
14909
14910
  .pf-c-login__main-header .pf-c-dropdown {
14910
14911
  grid-column: auto;
14911
14912
  grid-row: auto;
14912
14913
  }
14913
14914
 
14914
14915
  @media (min-width: 768px) {
14915
- .pf-c-login__main-header .pf-c-dropdown {
14916
+ .pf-c-login__main-header-utilities,
14917
+ .pf-c-login__main-header .pf-c-dropdown {
14916
14918
  grid-column: 2/3;
14917
14919
  grid-row: 1;
14918
14920
  }
14919
14921
  }
14922
+ .pf-c-login__main-header-utilities .pf-c-dropdown {
14923
+ grid-column: auto;
14924
+ grid-row: auto;
14925
+ }
14926
+
14920
14927
  .pf-c-login__main-header-desc {
14921
14928
  margin-bottom: var(--pf-c-login__main-header-desc--MarginBottom);
14922
14929
  font-size: var(--pf-c-login__main-header-desc--FontSize);
@@ -22379,6 +22386,8 @@ label.pf-c-radio, .pf-c-radio__label,
22379
22386
  --pf-c-tabs--m-color-scheme--light-300__link--disabled--BackgroundColor: var(--pf-global--palette--black-150);
22380
22387
  --pf-c-tabs__list--Display: flex;
22381
22388
  --pf-c-tabs__list--Visibility: visible;
22389
+ --pf-c-tabs__item--m-action--before--ZIndex: var(--pf-global--ZIndex--xs);
22390
+ --pf-c-tabs__item--m-action__link--PaddingRight: var(--pf-global--spacer--sm);
22382
22391
  --pf-c-tabs__link--Color: var(--pf-global--Color--200);
22383
22392
  --pf-c-tabs__link--FontSize: var(--pf-global--FontSize--md);
22384
22393
  --pf-c-tabs__link--BackgroundColor: transparent;
@@ -22394,11 +22403,14 @@ label.pf-c-radio, .pf-c-radio__label,
22394
22403
  --pf-c-tabs--m-vertical__link--PaddingBottom: var(--pf-global--spacer--md);
22395
22404
  --pf-c-tabs--m-box__link--BackgroundColor: var(--pf-global--BackgroundColor--200);
22396
22405
  --pf-c-tabs--m-box__link--disabled--BackgroundColor: var(--pf-global--disabled-color--200);
22406
+ --pf-c-tabs--m-box__item-close--c-button--disabled--BackgroundColor: var(--pf-global--palette--black-400);
22397
22407
  --pf-c-tabs--m-secondary__link--FontSize: var(--pf-global--FontSize--sm);
22398
22408
  --pf-c-tabs__link--before--border-color--base: var(--pf-global--BorderColor--100);
22409
+ --pf-c-tabs__link--before--border-width--base: var(--pf-global--BorderWidth--sm);
22410
+ --pf-c-tabs__link--before--BorderTopColor: var(--pf-c-tabs__link--before--border-color--base);
22399
22411
  --pf-c-tabs__link--before--BorderRightColor: var(--pf-c-tabs__link--before--border-color--base);
22400
22412
  --pf-c-tabs__link--before--BorderBottomColor: var(--pf-c-tabs__link--before--border-color--base);
22401
- --pf-c-tabs__link--before--border-width--base: var(--pf-global--BorderWidth--sm);
22413
+ --pf-c-tabs__link--before--BorderLeftColor: var(--pf-c-tabs__link--before--border-color--base);
22402
22414
  --pf-c-tabs__link--before--BorderTopWidth: 0;
22403
22415
  --pf-c-tabs__link--before--BorderRightWidth: 0;
22404
22416
  --pf-c-tabs__link--before--BorderBottomWidth: 0;
@@ -22456,6 +22468,19 @@ label.pf-c-radio, .pf-c-radio__label,
22456
22468
  --pf-c-tabs__toggle-button--MarginLeft: calc(-1 * var(--pf-global--spacer--md));
22457
22469
  --pf-c-tabs--m-expanded__toggle-icon--Color: var(--pf-global--Color--100);
22458
22470
  --pf-c-tabs--m-expanded__toggle-icon--Rotate: 90deg;
22471
+ --pf-c-tabs__item-close--c-button--FontSize: var(--pf-global--FontSize--xs);
22472
+ --pf-c-tabs--m-secondary__item-close--c-button--FontSize: var(--pf-global--icon--FontSize--sm);
22473
+ --pf-c-tabs__item-close--c-button--PaddingTop: var(--pf-global--spacer--sm);
22474
+ --pf-c-tabs__item-close--c-button--PaddingBottom: var(--pf-global--spacer--sm);
22475
+ --pf-c-tabs__item-close--c-button--PaddingLeft: var(--pf-global--spacer--sm);
22476
+ --pf-c-tabs__item-close--c-button--OutlineOffset: -0.1875rem;
22477
+ --pf-c-tabs__item-close-icon--MarginTop: 0.125rem;
22478
+ --pf-c-tabs__add--before--BorderColor: var(--pf-c-tabs__link--before--border-color--base);
22479
+ --pf-c-tabs__add--before--BorderLeftWidth: var(--pf-c-tabs__link--before--border-width--base);
22480
+ --pf-c-tabs__add--c-button--FontSize: var(--pf-global--FontSize--sm);
22481
+ --pf-c-tabs--m-secondary__add--c-button--FontSize: var(--pf-global--FontSize--xs);
22482
+ --pf-c-tabs__add--c-button--PaddingTop: var(--pf-c-tabs__link--PaddingTop);
22483
+ --pf-c-tabs__add--c-button--PaddingBottom: var(--pf-c-tabs__link--PaddingBottom);
22459
22484
  position: relative;
22460
22485
  display: flex;
22461
22486
  width: var(--pf-c-tabs--Width);
@@ -22577,6 +22602,10 @@ label.pf-c-radio, .pf-c-radio__label,
22577
22602
  --pf-c-tabs__link--disabled--BackgroundColor: var(--pf-c-tabs--m-color-scheme--light-300__link--disabled--BackgroundColor);
22578
22603
  }
22579
22604
 
22605
+ .pf-c-tabs.pf-m-box .pf-c-tabs__item-close .pf-c-button {
22606
+ --pf-c-button--m-plain--disabled--Color: var(--pf-c-tabs--m-box__item-close--c-button--disabled--BackgroundColor);
22607
+ }
22608
+
22580
22609
  .pf-c-tabs.pf-m-vertical {
22581
22610
  --pf-c-tabs--Width: var(--pf-c-tabs--m-vertical--Width);
22582
22611
  --pf-c-tabs--inset: var(--pf-c-tabs--m-vertical--inset);
@@ -22772,6 +22801,8 @@ label.pf-c-radio, .pf-c-radio__label,
22772
22801
 
22773
22802
  .pf-c-tabs.pf-m-secondary {
22774
22803
  --pf-c-tabs__link--FontSize: var(--pf-c-tabs--m-secondary__link--FontSize);
22804
+ --pf-c-tabs__item-close--c-button--FontSize: var(--pf-c-tabs--m-secondary__item-close--c-button--FontSize);
22805
+ --pf-c-tabs__add--c-button--FontSize: var(--pf-c-tabs--m-secondary__add--c-button--FontSize);
22775
22806
  }
22776
22807
 
22777
22808
  .pf-c-tabs.pf-m-page-insets {
@@ -22840,11 +22871,28 @@ label.pf-c-radio, .pf-c-radio__label,
22840
22871
  --pf-c-tabs__link--after--BorderWidth: var(--pf-c-tabs__item--m-current__link--after--BorderWidth);
22841
22872
  }
22842
22873
 
22874
+ .pf-c-tabs__item.pf-m-action {
22875
+ --pf-c-tabs__link--PaddingRight: var(--pf-c-tabs__item--m-action__link--PaddingRight);
22876
+ position: relative;
22877
+ }
22878
+
22879
+ .pf-c-tabs__item.pf-m-action::before {
22880
+ z-index: var(--pf-c-tabs__item--m-action--before--ZIndex);
22881
+ }
22882
+
22883
+ .pf-c-tabs__item.pf-m-action .pf-c-tabs__link::before,
22884
+ .pf-c-tabs__item.pf-m-action .pf-c-tabs__link::after {
22885
+ content: revert;
22886
+ }
22887
+
22843
22888
  .pf-c-tabs::before,
22844
22889
  .pf-c-tabs__list::before,
22845
22890
  .pf-c-tabs__link::before,
22846
22891
  .pf-c-tabs__link::after,
22847
- .pf-c-tabs__scroll-button::before {
22892
+ .pf-c-tabs__item.pf-m-action::before,
22893
+ .pf-c-tabs__item.pf-m-action::after,
22894
+ .pf-c-tabs__scroll-button::before,
22895
+ .pf-c-tabs__add::before {
22848
22896
  position: absolute;
22849
22897
  right: 0;
22850
22898
  bottom: 0;
@@ -22856,18 +22904,21 @@ label.pf-c-radio, .pf-c-radio__label,
22856
22904
  .pf-c-tabs__list::before,
22857
22905
  .pf-c-tabs__link::before,
22858
22906
  .pf-c-tabs__link::after,
22859
- .pf-c-tabs__scroll-button::before {
22907
+ .pf-c-tabs__item.pf-m-action::before,
22908
+ .pf-c-tabs__item.pf-m-action::after,
22909
+ .pf-c-tabs__scroll-button::before,
22910
+ .pf-c-tabs__add::before {
22860
22911
  top: 0;
22861
22912
  }
22862
22913
 
22863
22914
  .pf-c-tabs__link,
22864
22915
  .pf-c-tabs__scroll-button,
22865
- .pf-c-tabs__list::before {
22916
+ .pf-c-tabs__list::before,
22917
+ .pf-c-tabs__add::before {
22866
22918
  border: 0;
22867
22919
  }
22868
22920
 
22869
22921
  .pf-c-tabs__link {
22870
- --pf-c-tabs__link--after--BorderBottomWidth: var(--pf-c-tabs__link--after--BorderWidth);
22871
22922
  position: relative;
22872
22923
  display: flex;
22873
22924
  flex: 1;
@@ -22875,19 +22926,24 @@ label.pf-c-radio, .pf-c-radio__label,
22875
22926
  font-size: var(--pf-c-tabs__link--FontSize);
22876
22927
  color: var(--pf-c-tabs__link--Color);
22877
22928
  text-decoration: none;
22878
- background-color: var(--pf-c-tabs__link--BackgroundColor);
22879
22929
  outline-offset: var(--pf-c-tabs__link--OutlineOffset);
22880
22930
  }
22881
22931
 
22882
- .pf-c-tabs__link::before {
22932
+ .pf-c-tabs__item.pf-m-action, .pf-c-tabs__link {
22933
+ --pf-c-tabs__link--after--BorderBottomWidth: var(--pf-c-tabs__link--after--BorderWidth);
22934
+ background-color: var(--pf-c-tabs__link--BackgroundColor);
22935
+ }
22936
+
22937
+ .pf-c-tabs__item.pf-m-action::before, .pf-c-tabs__link::before {
22883
22938
  pointer-events: none;
22884
- border-color: var(--pf-c-tabs__link--before--border-color--base);
22885
22939
  border-width: var(--pf-c-tabs__link--before--BorderTopWidth) var(--pf-c-tabs__link--before--BorderRightWidth) var(--pf-c-tabs__link--before--BorderBottomWidth) var(--pf-c-tabs__link--before--BorderLeftWidth);
22940
+ border-top-color: var(--pf-c-tabs__link--before--BorderTopColor);
22886
22941
  border-right-color: var(--pf-c-tabs__link--before--BorderRightColor);
22887
22942
  border-bottom-color: var(--pf-c-tabs__link--before--BorderBottomColor);
22943
+ border-left-color: var(--pf-c-tabs__link--before--BorderLeftColor);
22888
22944
  }
22889
22945
 
22890
- .pf-c-tabs__link::after {
22946
+ .pf-c-tabs__item.pf-m-action::after, .pf-c-tabs__link::after {
22891
22947
  top: var(--pf-c-tabs__link--after--Top);
22892
22948
  right: var(--pf-c-tabs__link--after--Right);
22893
22949
  bottom: var(--pf-c-tabs__link--after--Bottom);
@@ -22896,15 +22952,15 @@ label.pf-c-radio, .pf-c-radio__label,
22896
22952
  border-width: var(--pf-c-tabs__link--after--BorderTopWidth) var(--pf-c-tabs__link--after--BorderRightWidth) var(--pf-c-tabs__link--after--BorderBottomWidth) var(--pf-c-tabs__link--after--BorderLeftWidth);
22897
22953
  }
22898
22954
 
22899
- .pf-c-tabs__link:hover {
22955
+ .pf-c-tabs__item.pf-m-action:hover, .pf-c-tabs__link:hover {
22900
22956
  --pf-c-tabs__link--after--BorderWidth: var(--pf-c-tabs__link--hover--after--BorderWidth);
22901
22957
  }
22902
22958
 
22903
- .pf-c-tabs__link:focus {
22959
+ .pf-c-tabs__item.pf-m-action:focus-within, .pf-c-tabs__link:focus {
22904
22960
  --pf-c-tabs__link--after--BorderWidth: var(--pf-c-tabs__link--focus--after--BorderWidth);
22905
22961
  }
22906
22962
 
22907
- .pf-c-tabs__link:active {
22963
+ .pf-c-tabs__item.pf-m-action:active, .pf-c-tabs__link:active {
22908
22964
  --pf-c-tabs__link--after--BorderWidth: var(--pf-c-tabs__link--active--after--BorderWidth);
22909
22965
  }
22910
22966
 
@@ -22912,7 +22968,7 @@ label.pf-c-radio, .pf-c-radio__label,
22912
22968
  pointer-events: none;
22913
22969
  }
22914
22970
 
22915
- .pf-c-tabs__link:disabled, .pf-c-tabs__link.pf-m-disabled, .pf-c-tabs__link.pf-m-aria-disabled {
22971
+ .pf-c-tabs__item.pf-m-action.pf-m-disabled, .pf-c-tabs__link:disabled, .pf-c-tabs__link.pf-m-disabled, .pf-c-tabs__link.pf-m-aria-disabled {
22916
22972
  --pf-c-tabs__link--BackgroundColor: var(--pf-c-tabs__link--disabled--BackgroundColor);
22917
22973
  --pf-c-tabs__link--before--BorderRightWidth: var(--pf-c-tabs__link--disabled--before--BorderRightWidth);
22918
22974
  --pf-c-tabs__link--before--BorderBottomWidth: var(--pf-c-tabs__link--disabled--before--BorderBottomWidth);
@@ -22934,6 +22990,23 @@ label.pf-c-radio, .pf-c-radio__label,
22934
22990
  --pf-c-tabs__link--child--MarginRight: 0;
22935
22991
  }
22936
22992
 
22993
+ .pf-c-tabs__item-close {
22994
+ display: flex;
22995
+ }
22996
+
22997
+ .pf-c-tabs__item-close .pf-c-button {
22998
+ --pf-c-button--FontSize: var(--pf-c-tabs__item-close--c-button--FontSize);
22999
+ --pf-c-button--PaddingTop: var(--pf-c-tabs__item-close--c-button--PaddingTop);
23000
+ --pf-c-button--PaddingBottom: var(--pf-c-tabs__item-close--c-button--PaddingBottom);
23001
+ --pf-c-button--PaddingLeft: var(--pf-c-tabs__item-close--c-button--PaddingLeft);
23002
+ outline-offset: var(--pf-c-tabs__item-close--c-button--OutlineOffset);
23003
+ }
23004
+
23005
+ .pf-c-tabs__item-close-icon {
23006
+ display: inline-block;
23007
+ margin-top: var(--pf-c-tabs__item-close-icon--MarginTop);
23008
+ }
23009
+
22937
23010
  .pf-c-tabs__scroll-button {
22938
23011
  flex: none;
22939
23012
  width: var(--pf-c-tabs__scroll-button--Width);
@@ -22971,6 +23044,21 @@ label.pf-c-radio, .pf-c-radio__label,
22971
23044
  pointer-events: none;
22972
23045
  }
22973
23046
 
23047
+ .pf-c-tabs__add {
23048
+ position: relative;
23049
+ display: flex;
23050
+ }
23051
+
23052
+ .pf-c-tabs__add::before {
23053
+ border-left: var(--pf-c-tabs__add--before--BorderLeftWidth) solid var(--pf-c-tabs__add--before--BorderColor);
23054
+ }
23055
+
23056
+ .pf-c-tabs__add .pf-c-button {
23057
+ --pf-c-button--FontSize: var(--pf-c-tabs__add--c-button--FontSize);
23058
+ --pf-c-button--PaddingTop: var(--pf-c-tabs__add--c-button--PaddingTop);
23059
+ --pf-c-button--PaddingBottom: var(--pf-c-tabs__add--c-button--PaddingBottom);
23060
+ }
23061
+
22974
23062
  .pf-c-tabs.pf-m-inset-none {
22975
23063
  --pf-c-tabs--inset: 0;
22976
23064
  --pf-c-tabs--m-vertical--inset: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "4.71.37",
3
+ "version": "4.72.2",
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.202.37",
35
- "@patternfly/react-icons": "^4.53.37",
36
- "@patternfly/react-styles": "^4.52.37",
37
- "@patternfly/react-tokens": "^4.54.37",
34
+ "@patternfly/react-core": "^4.203.2",
35
+ "@patternfly/react-icons": "^4.54.2",
36
+ "@patternfly/react-styles": "^4.53.2",
37
+ "@patternfly/react-tokens": "^4.55.2",
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": "0a79929febeda57b9988658d258f10f39c47bde4"
49
+ "gitHead": "ca5c716646e391e92b954b9cb3bbbe52b16834b7"
50
50
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { render } from '@testing-library/react';
3
- import { RowWrapper, RowWrapperProps } from './RowWrapper';
3
+ import { RowWrapper, RowWrapperProps } from '../RowWrapper';
4
4
 
5
5
  const getRowWrapper = (props: RowWrapperProps) => (
6
6
  <table>
@@ -13,12 +13,14 @@ const getRowWrapper = (props: RowWrapperProps) => (
13
13
  describe('RowWrapper', () => {
14
14
  test('renders correctly', () => {
15
15
  const trRef = jest.fn();
16
- const view = render(getRowWrapper({ onScroll: jest.fn(), onResize: jest.fn(), trRef }));
17
- expect(view.container).toMatchSnapshot();
16
+ const { asFragment } = render(getRowWrapper({ onScroll: jest.fn(), onResize: jest.fn(), trRef }));
17
+
18
+ expect(asFragment()).toMatchSnapshot();
18
19
  expect(trRef.mock.calls).toHaveLength(1);
19
20
  });
21
+
20
22
  test('renders expanded correctly', () => {
21
- const view = render(getRowWrapper({ row: { isExpanded: true } }));
22
- expect(view.container).toMatchSnapshot();
23
+ const { asFragment } = render(getRowWrapper({ row: { isExpanded: true } }));
24
+ expect(asFragment()).toMatchSnapshot();
23
25
  });
24
26
  });
@@ -0,0 +1,358 @@
1
+ import React from 'react';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+
6
+ import {
7
+ Table,
8
+ TableHeader,
9
+ TableBody,
10
+ TableGridBreakpoint,
11
+ TableVariant,
12
+ RowSelectVariant,
13
+ cellWidth,
14
+ headerCol,
15
+ sortable,
16
+ expandable,
17
+ compoundExpand,
18
+ IRow,
19
+ OnCollapse,
20
+ OnExpand,
21
+ OnSelect,
22
+ OnRowEdit,
23
+ OnSort,
24
+ wrappable,
25
+ nowrap,
26
+ truncate,
27
+ breakWord,
28
+ fitContent,
29
+ ICell
30
+ } from '../index';
31
+ import { rows, columns, editableRows, editableColumns, actions } from '../../../test-helpers/data-sets';
32
+ import { ColumnsType } from '../base';
33
+
34
+ describe('Table', () => {
35
+ describe('simple', () => {
36
+ test('caption', () => {
37
+ const { asFragment } = render(
38
+ <Table caption="Simple Table" cells={columns} rows={rows}>
39
+ <TableHeader />
40
+ <TableBody />
41
+ </Table>
42
+ );
43
+ expect(asFragment()).toMatchSnapshot();
44
+ });
45
+
46
+ test('header', () => {
47
+ const { asFragment } = render(
48
+ <Table header={<h4>Header title</h4>} cells={columns} rows={rows}>
49
+ <TableHeader />
50
+ <TableBody />
51
+ </Table>
52
+ );
53
+ expect(asFragment()).toMatchSnapshot();
54
+ });
55
+
56
+ test('aria-label', () => {
57
+ const { asFragment } = render(
58
+ <Table aria-label="Aria labeled" cells={columns} rows={rows}>
59
+ <TableHeader />
60
+ <TableBody />
61
+ </Table>
62
+ );
63
+ expect(asFragment()).toMatchSnapshot();
64
+ });
65
+
66
+ test('Editable table', () => {
67
+ const onRowEdit: OnRowEdit = () => undefined;
68
+ const { asFragment } = render(
69
+ <Table caption="Editable Table" cells={editableColumns} rows={editableRows} onRowEdit={onRowEdit}>
70
+ <TableHeader />
71
+ <TableBody />
72
+ </Table>
73
+ );
74
+
75
+ expect(asFragment()).toMatchSnapshot();
76
+ });
77
+
78
+ test('Sortable table', () => {
79
+ columns[0] = { ...(columns[0] as object), transforms: [sortable] };
80
+
81
+ const onSortCall: OnSort = () => undefined;
82
+ const { asFragment } = render(
83
+ <Table aria-label="Aria labeled" onSort={onSortCall} sortBy={{}} cells={columns} rows={rows}>
84
+ <TableHeader />
85
+ <TableBody />
86
+ </Table>
87
+ );
88
+
89
+ expect(asFragment()).toMatchSnapshot();
90
+ });
91
+
92
+ test('Row click table', () => {
93
+ const rowClickHandler = jest.fn();
94
+ const { asFragment } = render(
95
+ <Table aria-label="Row click table" cells={columns} rows={rows}>
96
+ <TableHeader />
97
+ <TableBody onRowClick={rowClickHandler} />
98
+ </Table>
99
+ );
100
+
101
+ expect(asFragment()).toMatchSnapshot();
102
+ });
103
+ });
104
+
105
+ describe('Table variants', () => {
106
+ Object.values(TableGridBreakpoint).forEach(oneBreakpoint => {
107
+ test(`Breakpoint - ${oneBreakpoint}`, () => {
108
+ const { asFragment } = render(
109
+ <Table aria-label="Aria labeled" gridBreakPoint={oneBreakpoint} cells={columns} rows={rows}>
110
+ <TableHeader />
111
+ <TableBody />
112
+ </Table>
113
+ );
114
+ expect(asFragment()).toMatchSnapshot();
115
+ });
116
+ });
117
+
118
+ Object.values(TableVariant).forEach(onevariant => {
119
+ test(`Size - ${onevariant}`, () => {
120
+ const { asFragment } = render(
121
+ <Table aria-label="Aria labeled" variant={onevariant} cells={columns} rows={rows}>
122
+ <TableHeader />
123
+ <TableBody />
124
+ </Table>
125
+ );
126
+ expect(asFragment()).toMatchSnapshot();
127
+ });
128
+ });
129
+ });
130
+
131
+ test('Simple Actions table', () => {
132
+ const rowsWithDisabledAction = [
133
+ ...rows,
134
+ {
135
+ cells: ['one', 'two', 'three', 'four', 'five'],
136
+ disableActions: true
137
+ }
138
+ ];
139
+ const { asFragment } = render(
140
+ <Table aria-label="Aria labeled" actions={actions} cells={columns} rows={rowsWithDisabledAction}>
141
+ <TableHeader />
142
+ <TableBody />
143
+ </Table>
144
+ );
145
+
146
+ expect(asFragment()).toMatchSnapshot();
147
+ });
148
+
149
+ test('Actions table', () => {
150
+ const { asFragment } = render(
151
+ <Table
152
+ aria-label="Aria labeled"
153
+ actionResolver={() => actions}
154
+ areActionsDisabled={() => false}
155
+ cells={columns}
156
+ rows={rows}
157
+ >
158
+ <TableHeader />
159
+ <TableBody />
160
+ </Table>
161
+ );
162
+ expect(asFragment()).toMatchSnapshot();
163
+ });
164
+
165
+ test('Cell header table', () => {
166
+ columns[0] = { ...(columns[0] as object), cellTransforms: [headerCol('test-headercol-')] };
167
+ const { asFragment } = render(
168
+ <Table aria-label="Aria labeled" cells={columns} rows={rows}>
169
+ <TableHeader />
170
+ <TableBody />
171
+ </Table>
172
+ );
173
+
174
+ expect(asFragment()).toMatchSnapshot();
175
+ });
176
+
177
+ test('Collapsible table', () => {
178
+ rows[0] = { ...rows[0], isOpen: true };
179
+ rows[1] = { ...rows[1], parent: 0 };
180
+ rows[3] = { ...rows[3], isOpen: false };
181
+ rows[4] = { ...rows[4], parent: 3 };
182
+ columns[0] = { ...(columns[0] as object), cellFormatters: [expandable] };
183
+
184
+ const onCollapse: OnCollapse = () => undefined;
185
+ const { asFragment } = render(
186
+ <Table aria-label="Aria labeled" onCollapse={onCollapse} cells={columns} rows={rows}>
187
+ <TableHeader />
188
+ <TableBody />
189
+ </Table>
190
+ );
191
+
192
+ expect(asFragment()).toMatchSnapshot();
193
+ });
194
+
195
+ test('Compound Expandable table', () => {
196
+ const compoundColumns: ColumnsType = [
197
+ { title: 'col1', cellTransforms: [compoundExpand] },
198
+ { title: 'col2', cellTransforms: [compoundExpand] }
199
+ ];
200
+ const compoundRows: IRow[] = [
201
+ {
202
+ isOpen: true,
203
+ cells: [
204
+ { title: '1', props: { isOpen: true } },
205
+ { title: '2', props: { isOpen: false } }
206
+ ]
207
+ },
208
+ { parent: 0, compoundParent: 0, cells: [{ title: 'expanded', props: { colSpan: 2 } }] },
209
+ {
210
+ isOpen: false,
211
+ cells: [
212
+ { title: '3', props: { isOpen: false } },
213
+ { title: '4', props: { isOpen: false } }
214
+ ]
215
+ },
216
+ { parent: 2, compoundParent: 0, cells: [{ title: 'expanded', props: { colSpan: 2 } }] }
217
+ ];
218
+
219
+ const onExpand: OnExpand = () => undefined;
220
+ const { asFragment } = render(
221
+ <Table aria-label="Aria labeled" onExpand={onExpand} cells={compoundColumns} rows={compoundRows}>
222
+ <TableHeader />
223
+ <TableBody />
224
+ </Table>
225
+ );
226
+
227
+ expect(asFragment()).toMatchSnapshot();
228
+ });
229
+
230
+ test('Collapsible nested table', () => {
231
+ rows[0] = { ...rows[0], isOpen: false };
232
+ rows[1] = { ...rows[1], parent: 0, isOpen: true };
233
+ rows[2] = { ...rows[2], parent: 1 };
234
+
235
+ const onCollapse: OnCollapse = () => undefined;
236
+ const { asFragment } = render(
237
+ <Table aria-label="Aria labeled" onCollapse={onCollapse} cells={columns} rows={rows}>
238
+ <TableHeader />
239
+ <TableBody />
240
+ </Table>
241
+ );
242
+
243
+ expect(asFragment()).toMatchSnapshot();
244
+ });
245
+
246
+ test('Selectable table', () => {
247
+ const onSelect: OnSelect = () => undefined;
248
+ const { asFragment } = render(
249
+ <Table aria-label="Aria labeled" onSelect={onSelect} cells={columns} rows={rows}>
250
+ <TableHeader />
251
+ <TableBody />
252
+ </Table>
253
+ );
254
+
255
+ expect(asFragment()).toMatchSnapshot();
256
+ });
257
+
258
+ test('Selectable table with Radio', () => {
259
+ const onSelect: OnSelect = () => undefined;
260
+ const { asFragment } = render(
261
+ <Table
262
+ aria-label="Aria labeled"
263
+ selectVariant={RowSelectVariant.radio}
264
+ onSelect={onSelect}
265
+ cells={columns}
266
+ rows={rows}
267
+ >
268
+ <TableHeader />
269
+ <TableBody />
270
+ </Table>
271
+ );
272
+
273
+ expect(asFragment()).toMatchSnapshot();
274
+ });
275
+
276
+ test('Control text table', () => {
277
+ const controlTextColumns: ICell[] = [
278
+ { ...(columns[0] as object), transforms: [nowrap] },
279
+ { title: 'new object column', transforms: [wrappable] },
280
+ { ...(columns[2] as object), transforms: [breakWord] },
281
+ { title: 'new object column', transforms: [truncate] },
282
+ { ...(columns[4] as object), transforms: [fitContent] }
283
+ ];
284
+
285
+ const { asFragment } = render(
286
+ <Table aria-label="Aria labeled" cells={controlTextColumns} rows={rows}>
287
+ <TableHeader />
288
+ <TableBody />
289
+ </Table>
290
+ );
291
+ expect(asFragment()).toMatchSnapshot();
292
+ });
293
+
294
+ test('Header width table', () => {
295
+ columns[0] = { ...(columns[0] as object), transforms: [cellWidth(10)] };
296
+ columns[2] = { ...(columns[2] as object), transforms: [cellWidth(30)] };
297
+ columns[4] = { ...(columns[4] as object), transforms: [cellWidth(100)] };
298
+ const { asFragment } = render(
299
+ <Table aria-label="Aria labeled" cells={columns} rows={rows}>
300
+ <TableHeader />
301
+ <TableBody />
302
+ </Table>
303
+ );
304
+ expect(asFragment()).toMatchSnapshot();
305
+ });
306
+
307
+ test('Selectable table with selected expandable row', () => {
308
+ const data = {
309
+ cells: ['column'],
310
+ rows: [
311
+ {
312
+ cells: ['one'],
313
+ selected: true
314
+ },
315
+ {
316
+ cells: ['one'],
317
+ parent: 0
318
+ }
319
+ ],
320
+ onSelect: (e: React.FormEvent<HTMLInputElement>) => e
321
+ };
322
+
323
+ const { asFragment } = render(
324
+ <Table aria-label="Aria labeled" {...data}>
325
+ <TableHeader />
326
+ <TableBody />
327
+ </Table>
328
+ );
329
+
330
+ expect(asFragment()).toMatchSnapshot();
331
+ });
332
+
333
+ test('Empty state table', () => {
334
+ const data = {
335
+ cells: ['Hostname', 'IP address', 'Role', 'Team'],
336
+ rows: [
337
+ {
338
+ heightAuto: true,
339
+ cells: [
340
+ {
341
+ title: <div>Empty State Component</div>,
342
+ props: { colSpan: 8 }
343
+ }
344
+ ]
345
+ }
346
+ ]
347
+ };
348
+
349
+ render(
350
+ <Table aria-label="Aria labeled" {...data}>
351
+ <TableHeader />
352
+ <TableBody />
353
+ </Table>
354
+ );
355
+
356
+ expect(screen.getByText('Empty State Component').parentElement.getAttribute('colspan')).toEqual('8');
357
+ });
358
+ });
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`RowWrapper renders correctly 1`] = `
4
- <div>
4
+ <DocumentFragment>
5
5
  <table>
6
6
  <tbody>
7
7
  <tr
@@ -12,11 +12,11 @@ exports[`RowWrapper renders correctly 1`] = `
12
12
  />
13
13
  </tbody>
14
14
  </table>
15
- </div>
15
+ </DocumentFragment>
16
16
  `;
17
17
 
18
18
  exports[`RowWrapper renders expanded correctly 1`] = `
19
- <div>
19
+ <DocumentFragment>
20
20
  <table>
21
21
  <tbody>
22
22
  <tr
@@ -27,5 +27,5 @@ exports[`RowWrapper renders expanded correctly 1`] = `
27
27
  />
28
28
  </tbody>
29
29
  </table>
30
- </div>
30
+ </DocumentFragment>
31
31
  `;