@dhis2-ui/table 9.12.0 → 9.13.0
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/cjs/data-table/__tests__/data-table-cell.test.js +26 -26
- package/build/cjs/data-table/__tests__/data-table-column-header/filter-handle.test.js +3 -3
- package/build/cjs/data-table/__tests__/data-table-column-header/sorter.test.js +2 -2
- package/build/cjs/data-table/__tests__/data-table-column-header.test.js +18 -18
- package/build/cjs/data-table/__tests__/data-table-row/expand-handle-cell.js +3 -3
- package/build/cjs/data-table/__tests__/data-table-row/expanded-row.test.js +6 -6
- package/build/cjs/data-table/__tests__/data-table-row.test.js +13 -13
- package/build/cjs/data-table/__tests__/data-table.test.js +11 -11
- package/build/cjs/data-table/table-elements/__tests__/table-body.test.js +5 -5
- package/build/cjs/data-table/table-elements/__tests__/table-data-cell.test.js +19 -19
- package/build/cjs/data-table/table-elements/__tests__/table-foot.test.js +5 -5
- package/build/cjs/data-table/table-elements/__tests__/table-head.test.js +5 -5
- package/build/cjs/data-table/table-elements/__tests__/table-header-cell-action.test.js +6 -6
- package/build/cjs/data-table/table-elements/__tests__/table-header-cell.test.js +20 -20
- package/build/cjs/data-table/table-elements/__tests__/table-row.test.js +7 -7
- package/build/cjs/data-table/table-elements/__tests__/table-scroll-box.test.js +6 -6
- package/build/cjs/data-table/table-elements/__tests__/table-toolbar.test.js +7 -7
- package/build/cjs/data-table/table-elements/__tests__/table.test.js +8 -8
- package/build/cjs/stacked-table/stacked-table.test.js +3 -3
- package/build/es/data-table/__tests__/data-table-cell.test.js +26 -26
- package/build/es/data-table/__tests__/data-table-column-header/filter-handle.test.js +3 -3
- package/build/es/data-table/__tests__/data-table-column-header/sorter.test.js +2 -2
- package/build/es/data-table/__tests__/data-table-column-header.test.js +18 -18
- package/build/es/data-table/__tests__/data-table-row/expand-handle-cell.js +3 -3
- package/build/es/data-table/__tests__/data-table-row/expanded-row.test.js +6 -6
- package/build/es/data-table/__tests__/data-table-row.test.js +13 -13
- package/build/es/data-table/__tests__/data-table.test.js +11 -11
- package/build/es/data-table/table-elements/__tests__/table-body.test.js +5 -5
- package/build/es/data-table/table-elements/__tests__/table-data-cell.test.js +19 -19
- package/build/es/data-table/table-elements/__tests__/table-foot.test.js +5 -5
- package/build/es/data-table/table-elements/__tests__/table-head.test.js +5 -5
- package/build/es/data-table/table-elements/__tests__/table-header-cell-action.test.js +6 -6
- package/build/es/data-table/table-elements/__tests__/table-header-cell.test.js +20 -20
- package/build/es/data-table/table-elements/__tests__/table-row.test.js +7 -7
- package/build/es/data-table/table-elements/__tests__/table-scroll-box.test.js +6 -6
- package/build/es/data-table/table-elements/__tests__/table-toolbar.test.js +7 -7
- package/build/es/data-table/table-elements/__tests__/table.test.js +8 -8
- package/build/es/stacked-table/stacked-table.test.js +3 -3
- package/package.json +7 -7
|
@@ -7,53 +7,53 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
7
7
|
describe('<Table>', () => {
|
|
8
8
|
it('renders children', () => {
|
|
9
9
|
const children = 'children';
|
|
10
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
10
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, null, children));
|
|
11
11
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
12
12
|
});
|
|
13
13
|
it('accepts a ref', () => {
|
|
14
14
|
const ref = /*#__PURE__*/_react.default.createRef();
|
|
15
|
-
const wrapper = (0, _enzyme.mount)(
|
|
15
|
+
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
16
16
|
ref: ref
|
|
17
17
|
}));
|
|
18
18
|
expect(wrapper.find('table').getDOMNode()).toBe(ref.current);
|
|
19
19
|
});
|
|
20
20
|
it('accepts a borderless prop', () => {
|
|
21
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
21
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
22
22
|
borderless: true
|
|
23
23
|
}));
|
|
24
24
|
expect(wrapper.find('table').hasClass('borderless')).toBe(true);
|
|
25
25
|
});
|
|
26
26
|
it('accepts a className prop', () => {
|
|
27
27
|
const className = 'test';
|
|
28
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
28
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
29
29
|
className: className
|
|
30
30
|
}));
|
|
31
31
|
expect(wrapper.find('table').hasClass(className)).toBe(true);
|
|
32
32
|
});
|
|
33
33
|
it('accepts a dataTest prop', () => {
|
|
34
34
|
const dataTest = 'test';
|
|
35
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
35
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
36
36
|
dataTest: dataTest
|
|
37
37
|
}));
|
|
38
38
|
expect(wrapper.find('table').prop('data-test')).toBe(dataTest);
|
|
39
39
|
});
|
|
40
40
|
it('accepts a layout prop', () => {
|
|
41
41
|
const layout = 'fixed';
|
|
42
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
42
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
43
43
|
layout: layout
|
|
44
44
|
}));
|
|
45
45
|
expect(wrapper.html()).toContain(`table-layout: ${layout};`);
|
|
46
46
|
});
|
|
47
47
|
it('accepts a role prop', () => {
|
|
48
48
|
const role = 'test';
|
|
49
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
49
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
50
50
|
role: role
|
|
51
51
|
}));
|
|
52
52
|
expect(wrapper.find('table').prop('role')).toBe(role);
|
|
53
53
|
});
|
|
54
54
|
it('accepts a width prop', () => {
|
|
55
55
|
const width = '200px';
|
|
56
|
-
const wrapper = (0, _enzyme.shallow)(
|
|
56
|
+
const wrapper = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
57
57
|
width: width
|
|
58
58
|
}));
|
|
59
59
|
expect(wrapper.html()).toContain(`width: ${width};`);
|
|
@@ -78,7 +78,7 @@ describe('StackedTable', () => {
|
|
|
78
78
|
label: 'Incomplete'
|
|
79
79
|
}];
|
|
80
80
|
it('should add the headerLabels to each cell', () => {
|
|
81
|
-
const table = (0, _enzyme.mount)(
|
|
81
|
+
const table = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(Table, {
|
|
82
82
|
headerLabels: headerLabels,
|
|
83
83
|
bodyLabels: bodyLabels
|
|
84
84
|
}));
|
|
@@ -92,7 +92,7 @@ describe('StackedTable', () => {
|
|
|
92
92
|
it('should not add empty header labels to the body cells', () => {
|
|
93
93
|
const emptyLabelIndex = 2;
|
|
94
94
|
const headerLabelsWithEmpty = [...headerLabels.slice(0, emptyLabelIndex), '', ...headerLabels.slice(emptyLabelIndex + 1)];
|
|
95
|
-
const table = (0, _enzyme.mount)(
|
|
95
|
+
const table = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(Table, {
|
|
96
96
|
headerLabels: headerLabelsWithEmpty,
|
|
97
97
|
bodyLabels: bodyLabels
|
|
98
98
|
}));
|
|
@@ -109,7 +109,7 @@ describe('StackedTable', () => {
|
|
|
109
109
|
...originalHeaderLabel,
|
|
110
110
|
colSpan: `${colSpan}`
|
|
111
111
|
}, ...headerLabels.slice(indexWithColspan + colSpan)];
|
|
112
|
-
const table = (0, _enzyme.mount)(
|
|
112
|
+
const table = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(Table, {
|
|
113
113
|
headerLabels: headerLabelsWithColspan,
|
|
114
114
|
bodyLabels: bodyLabels
|
|
115
115
|
}));
|
|
@@ -5,64 +5,64 @@ import { TableDataCell, TableHeaderCell } from '../table-elements/index.js';
|
|
|
5
5
|
describe('<DataTableCell>', () => {
|
|
6
6
|
it('renders children', () => {
|
|
7
7
|
const children = 'children';
|
|
8
|
-
const wrapper = shallow(
|
|
8
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, null, children));
|
|
9
9
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
10
10
|
});
|
|
11
11
|
it('accepts a ref', () => {
|
|
12
12
|
const ref = /*#__PURE__*/React.createRef();
|
|
13
|
-
const wrapper = mount(
|
|
13
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement(DataTableCell, {
|
|
14
14
|
ref: ref
|
|
15
15
|
})))));
|
|
16
16
|
expect(wrapper.find('td').getDOMNode()).toBe(ref.current);
|
|
17
17
|
});
|
|
18
18
|
it('accepts an active prop', () => {
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
20
20
|
active: true
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find(TableDataCell).prop('active')).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts an align prop', () => {
|
|
25
25
|
const right = 'right';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
27
27
|
align: right
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find(TableDataCell).prop('align')).toBe(right);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a bordered prop', () => {
|
|
32
|
-
const wrapper = shallow(
|
|
32
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
33
33
|
bordered: true
|
|
34
34
|
}));
|
|
35
35
|
expect(wrapper.find(TableDataCell).prop('bordered')).toBe(true);
|
|
36
36
|
});
|
|
37
37
|
it('accepts a className prop', () => {
|
|
38
38
|
const className = 'test';
|
|
39
|
-
const wrapper = shallow(
|
|
39
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
40
40
|
className: className
|
|
41
41
|
}));
|
|
42
42
|
expect(wrapper.find(TableDataCell).prop('className')).toBe(className);
|
|
43
43
|
});
|
|
44
44
|
it('accepts a colSpan prop', () => {
|
|
45
45
|
const colSpan = '3';
|
|
46
|
-
const wrapper = shallow(
|
|
46
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
47
47
|
colSpan: colSpan
|
|
48
48
|
}));
|
|
49
49
|
expect(wrapper.find(TableDataCell).prop('colSpan')).toBe(colSpan);
|
|
50
50
|
});
|
|
51
51
|
it('accepts a dataTest prop', () => {
|
|
52
52
|
const dataTest = 'test';
|
|
53
|
-
const wrapper = shallow(
|
|
53
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
54
54
|
dataTest: dataTest
|
|
55
55
|
}));
|
|
56
56
|
expect(wrapper.find(TableDataCell).prop('dataTest')).toBe(dataTest);
|
|
57
57
|
});
|
|
58
58
|
it('accepts an error prop', () => {
|
|
59
|
-
const wrapper = shallow(
|
|
59
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
60
60
|
error: true
|
|
61
61
|
}));
|
|
62
62
|
expect(wrapper.find(TableDataCell).prop('error')).toBe(true);
|
|
63
63
|
});
|
|
64
64
|
it('accepts a fixed prop', () => {
|
|
65
|
-
const wrapper = shallow(
|
|
65
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
66
66
|
fixed: true
|
|
67
67
|
}));
|
|
68
68
|
expect(wrapper.find(TableDataCell)).toHaveLength(0);
|
|
@@ -71,91 +71,91 @@ describe('<DataTableCell>', () => {
|
|
|
71
71
|
expect(wrapper.find(TableHeaderCell).prop('fixed')).toBe(true);
|
|
72
72
|
});
|
|
73
73
|
it('accepts a large prop', () => {
|
|
74
|
-
const wrapper = shallow(
|
|
74
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
75
75
|
large: true
|
|
76
76
|
}));
|
|
77
77
|
expect(wrapper.find(TableDataCell).prop('large')).toBe(true);
|
|
78
78
|
});
|
|
79
79
|
it('accepts a left prop', () => {
|
|
80
80
|
const left = '200px';
|
|
81
|
-
const wrapper = shallow(
|
|
81
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
82
82
|
left: left
|
|
83
83
|
}));
|
|
84
84
|
expect(wrapper.find(TableDataCell).prop('left')).toBe(left);
|
|
85
85
|
});
|
|
86
86
|
it('accepts a muted prop', () => {
|
|
87
|
-
const wrapper = shallow(
|
|
87
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
88
88
|
muted: true
|
|
89
89
|
}));
|
|
90
90
|
expect(wrapper.find(TableDataCell).prop('muted')).toBe(true);
|
|
91
91
|
});
|
|
92
92
|
it('accepts a role prop', () => {
|
|
93
93
|
const role = 'test';
|
|
94
|
-
const wrapper = shallow(
|
|
94
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
95
95
|
role: role
|
|
96
96
|
}));
|
|
97
97
|
expect(wrapper.find(TableDataCell).prop('role')).toBe(role);
|
|
98
98
|
});
|
|
99
99
|
it('accepts a rowSpan prop', () => {
|
|
100
100
|
const rowSpan = '3';
|
|
101
|
-
const wrapper = shallow(
|
|
101
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
102
102
|
rowSpan: rowSpan
|
|
103
103
|
}));
|
|
104
104
|
expect(wrapper.find(TableDataCell).prop('rowSpan')).toBe(rowSpan);
|
|
105
105
|
});
|
|
106
106
|
it('accepts a scope prop', () => {
|
|
107
107
|
const scope = 'row';
|
|
108
|
-
const wrapper = shallow(
|
|
108
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
109
109
|
scope: scope
|
|
110
110
|
}));
|
|
111
111
|
expect(wrapper.find(TableDataCell).prop('scope')).toBe(scope);
|
|
112
112
|
});
|
|
113
113
|
it('accepts a staticStyle prop', () => {
|
|
114
|
-
const wrapper = shallow(
|
|
114
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
115
115
|
staticStyle: true
|
|
116
116
|
}));
|
|
117
117
|
expect(wrapper.find(TableDataCell).prop('staticStyle')).toBe(true);
|
|
118
118
|
});
|
|
119
119
|
it('can render either a td or th tag depending on the fixed and tag prop', () => {
|
|
120
120
|
// default
|
|
121
|
-
expect(shallow(
|
|
121
|
+
expect(shallow(/*#__PURE__*/React.createElement(DataTableCell, null)).dive().type()).toBe('td');
|
|
122
122
|
// using the tag prop
|
|
123
|
-
expect(shallow(
|
|
123
|
+
expect(shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
124
124
|
tag: "td"
|
|
125
125
|
})).dive().type()).toBe('td');
|
|
126
|
-
expect(shallow(
|
|
126
|
+
expect(shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
127
127
|
tag: "th"
|
|
128
128
|
})).dive().type()).toBe('th');
|
|
129
129
|
// with fixed prop
|
|
130
|
-
expect(shallow(
|
|
130
|
+
expect(shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
131
131
|
fixed: true
|
|
132
132
|
})).dive().type()).toBe('th');
|
|
133
133
|
// tag prop should take presedence over fixed prop
|
|
134
|
-
expect(shallow(
|
|
134
|
+
expect(shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
135
135
|
fixed: true,
|
|
136
136
|
tag: "td"
|
|
137
137
|
})).dive().type()).toBe('td');
|
|
138
|
-
expect(shallow(
|
|
138
|
+
expect(shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
139
139
|
fixed: true,
|
|
140
140
|
tag: "th"
|
|
141
141
|
})).dive().type()).toBe('th');
|
|
142
142
|
});
|
|
143
143
|
it('accepts a valid prop', () => {
|
|
144
|
-
const wrapper = shallow(
|
|
144
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
145
145
|
valid: true
|
|
146
146
|
}));
|
|
147
147
|
expect(wrapper.find(TableDataCell).prop('valid')).toBe(true);
|
|
148
148
|
});
|
|
149
149
|
it('accepts a width prop', () => {
|
|
150
150
|
const width = '200px';
|
|
151
|
-
const wrapper = shallow(
|
|
151
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
152
152
|
width: width
|
|
153
153
|
}));
|
|
154
154
|
expect(wrapper.find(TableDataCell).prop('width')).toBe(width);
|
|
155
155
|
});
|
|
156
156
|
it('accepts an onClick prop', () => {
|
|
157
157
|
const onClick = jest.fn();
|
|
158
|
-
const wrapper = shallow(
|
|
158
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableCell, {
|
|
159
159
|
onClick: onClick
|
|
160
160
|
}));
|
|
161
161
|
wrapper.simulate('click');
|
|
@@ -6,8 +6,8 @@ import { FilterHandle } from '../../data-table-column-header/filter-handle.js';
|
|
|
6
6
|
import { TableHeaderCellAction } from '../../table-elements/index.js';
|
|
7
7
|
describe('<FilterHandle>', () => {
|
|
8
8
|
it('accepts an active prop', () => {
|
|
9
|
-
const wrapper = shallow(
|
|
10
|
-
const wrapperActive = shallow(
|
|
9
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(FilterHandle, null));
|
|
10
|
+
const wrapperActive = shallow(/*#__PURE__*/React.createElement(FilterHandle, {
|
|
11
11
|
active: true
|
|
12
12
|
}));
|
|
13
13
|
expect(wrapper.find(IconSearch16).prop('color')).toBe(colors.grey600);
|
|
@@ -20,7 +20,7 @@ describe('<FilterHandle>', () => {
|
|
|
20
20
|
value: 'test'
|
|
21
21
|
};
|
|
22
22
|
const onClick = jest.fn();
|
|
23
|
-
const wrapper = shallow(
|
|
23
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(FilterHandle, {
|
|
24
24
|
onClick: onClick,
|
|
25
25
|
name: name
|
|
26
26
|
}));
|
|
@@ -4,7 +4,7 @@ import { Sorter, ASC, DESC } from '../../data-table-column-header/sorter.js';
|
|
|
4
4
|
import { TableHeaderCellAction } from '../../table-elements/index.js';
|
|
5
5
|
describe('<Sorter>', () => {
|
|
6
6
|
it('accepts a sortDirection prop', () => {
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Sorter, {
|
|
8
8
|
sortDirection: ASC
|
|
9
9
|
}));
|
|
10
10
|
expect(wrapper.find(TableHeaderCellAction).dive().find('svg').hasClass(ASC)).toBe(true);
|
|
@@ -16,7 +16,7 @@ describe('<Sorter>', () => {
|
|
|
16
16
|
value: 'test'
|
|
17
17
|
};
|
|
18
18
|
const onClick = jest.fn();
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Sorter, {
|
|
20
20
|
sortDirection: ASC,
|
|
21
21
|
onClick: onClick,
|
|
22
22
|
name: name
|
|
@@ -7,39 +7,39 @@ import { TableHeaderCell, TableHeaderCellAction } from '../table-elements/index.
|
|
|
7
7
|
describe('<DataTableColumnHeader>', () => {
|
|
8
8
|
it('renders children', () => {
|
|
9
9
|
const children = 'children';
|
|
10
|
-
const wrapper = shallow(
|
|
10
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, null, children));
|
|
11
11
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
12
12
|
});
|
|
13
13
|
it('accepts a ref', () => {
|
|
14
14
|
const ref = /*#__PURE__*/React.createRef();
|
|
15
|
-
const wrapper = mount(
|
|
15
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
16
16
|
ref: ref
|
|
17
17
|
})))));
|
|
18
18
|
expect(wrapper.find('th').getDOMNode()).toBe(ref.current);
|
|
19
19
|
});
|
|
20
20
|
it('accepts an align prop', () => {
|
|
21
21
|
const right = 'right';
|
|
22
|
-
const wrapper = shallow(
|
|
22
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
23
23
|
align: right
|
|
24
24
|
}));
|
|
25
25
|
expect(wrapper.find(TableHeaderCell).prop('align')).toBe(right);
|
|
26
26
|
});
|
|
27
27
|
it('accepts a className prop', () => {
|
|
28
|
-
const wrapper = shallow(
|
|
28
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
29
29
|
className: "test"
|
|
30
30
|
}));
|
|
31
31
|
expect(wrapper.find(TableHeaderCell).prop('className')).toBe('test DataTableColumnHeader');
|
|
32
32
|
});
|
|
33
33
|
it('accepts a colSpan prop', () => {
|
|
34
34
|
const colSpan = '3';
|
|
35
|
-
const wrapper = shallow(
|
|
35
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
36
36
|
colSpan: colSpan
|
|
37
37
|
}));
|
|
38
38
|
expect(wrapper.find(TableHeaderCell).prop('colSpan')).toBe(colSpan);
|
|
39
39
|
});
|
|
40
40
|
it('accepts a dataTest prop', () => {
|
|
41
41
|
const dataTest = 'test';
|
|
42
|
-
const wrapper = shallow(
|
|
42
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
43
43
|
dataTest: dataTest
|
|
44
44
|
}));
|
|
45
45
|
expect(wrapper.find(TableHeaderCell).prop('dataTest')).toBe(dataTest);
|
|
@@ -53,13 +53,13 @@ describe('<DataTableColumnHeader>', () => {
|
|
|
53
53
|
};
|
|
54
54
|
const onClickOpen = jest.fn();
|
|
55
55
|
const onClickClosed = jest.fn();
|
|
56
|
-
const wrapperOpen = shallow(
|
|
56
|
+
const wrapperOpen = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
57
57
|
name: name,
|
|
58
58
|
onFilterIconClick: onClickOpen,
|
|
59
59
|
filter: /*#__PURE__*/React.createElement("input", null),
|
|
60
60
|
showFilter: true
|
|
61
61
|
}));
|
|
62
|
-
const wrapperClosed = shallow(
|
|
62
|
+
const wrapperClosed = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
63
63
|
name: name,
|
|
64
64
|
onFilterIconClick: onClickClosed,
|
|
65
65
|
filter: /*#__PURE__*/React.createElement("input", null),
|
|
@@ -86,42 +86,42 @@ describe('<DataTableColumnHeader>', () => {
|
|
|
86
86
|
}, fakeEvent);
|
|
87
87
|
});
|
|
88
88
|
it('accepts a fixed prop', () => {
|
|
89
|
-
const wrapper = shallow(
|
|
89
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
90
90
|
fixed: true,
|
|
91
91
|
left: "200px"
|
|
92
92
|
}));
|
|
93
93
|
expect(wrapper.find(TableHeaderCell).prop('fixed')).toBe(true);
|
|
94
94
|
});
|
|
95
95
|
it('accepts a large prop', () => {
|
|
96
|
-
const wrapper = shallow(
|
|
96
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
97
97
|
large: true
|
|
98
98
|
}));
|
|
99
99
|
expect(wrapper.find(TableHeaderCell).prop('large')).toBe(true);
|
|
100
100
|
});
|
|
101
101
|
it('accepts a left prop', () => {
|
|
102
102
|
const left = '200px';
|
|
103
|
-
const wrapper = shallow(
|
|
103
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
104
104
|
left: left
|
|
105
105
|
}));
|
|
106
106
|
expect(wrapper.find(TableHeaderCell).prop('left')).toBe(left);
|
|
107
107
|
});
|
|
108
108
|
it('accepts a role prop', () => {
|
|
109
109
|
const role = 'test';
|
|
110
|
-
const wrapper = shallow(
|
|
110
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
111
111
|
role: role
|
|
112
112
|
}));
|
|
113
113
|
expect(wrapper.find(TableHeaderCell).prop('role')).toBe(role);
|
|
114
114
|
});
|
|
115
115
|
it('accepts a rowSpan prop', () => {
|
|
116
116
|
const rowSpan = '3';
|
|
117
|
-
const wrapper = shallow(
|
|
117
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
118
118
|
rowSpan: rowSpan
|
|
119
119
|
}));
|
|
120
120
|
expect(wrapper.find(TableHeaderCell).prop('rowSpan')).toBe(rowSpan);
|
|
121
121
|
});
|
|
122
122
|
it('accepts a scope prop', () => {
|
|
123
123
|
const scope = 'row';
|
|
124
|
-
const wrapper = shallow(
|
|
124
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
125
125
|
scope: scope
|
|
126
126
|
}));
|
|
127
127
|
expect(wrapper.find(TableHeaderCell).prop('scope')).toBe(scope);
|
|
@@ -135,7 +135,7 @@ describe('<DataTableColumnHeader>', () => {
|
|
|
135
135
|
value: 'test'
|
|
136
136
|
};
|
|
137
137
|
const onClick = jest.fn();
|
|
138
|
-
const wrapper = shallow(
|
|
138
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
139
139
|
name: name,
|
|
140
140
|
onSortIconClick: onClick,
|
|
141
141
|
sortDirection: 'asc',
|
|
@@ -152,7 +152,7 @@ describe('<DataTableColumnHeader>', () => {
|
|
|
152
152
|
expect(button.prop('title')).toBe(title);
|
|
153
153
|
});
|
|
154
154
|
it('has a default sort icon title', () => {
|
|
155
|
-
const wrapper = shallow(
|
|
155
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
156
156
|
name: 'test',
|
|
157
157
|
onSortIconClick: () => {},
|
|
158
158
|
sortDirection: 'asc'
|
|
@@ -163,14 +163,14 @@ describe('<DataTableColumnHeader>', () => {
|
|
|
163
163
|
});
|
|
164
164
|
it('accepts a top prop', () => {
|
|
165
165
|
const top = '200px';
|
|
166
|
-
const wrapper = shallow(
|
|
166
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
167
167
|
top: top
|
|
168
168
|
}));
|
|
169
169
|
expect(wrapper.find(TableHeaderCell).prop('top')).toBe(top);
|
|
170
170
|
});
|
|
171
171
|
it('accepts a width prop', () => {
|
|
172
172
|
const width = '200px';
|
|
173
|
-
const wrapper = shallow(
|
|
173
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableColumnHeader, {
|
|
174
174
|
width: width
|
|
175
175
|
}));
|
|
176
176
|
expect(wrapper.find(TableHeaderCell).prop('width')).toBe(width);
|
|
@@ -4,20 +4,20 @@ import React from 'react';
|
|
|
4
4
|
import { ExpandHandleCell } from '../../data-table-row/expand-handle-cell.js';
|
|
5
5
|
describe('<ExpandHandleCell>', () => {
|
|
6
6
|
it('renders an <IconChevronUp24> when expanded is true', () => {
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandHandleCell, {
|
|
8
8
|
expanded: true
|
|
9
9
|
}));
|
|
10
10
|
expect(wrapper.find(IconChevronUp24)).toHaveLength(1);
|
|
11
11
|
expect(wrapper.find(IconChevronDown24)).toHaveLength(0);
|
|
12
12
|
});
|
|
13
13
|
it('renders an <IconChevronDown24> when expanded is falsy', () => {
|
|
14
|
-
const wrapper = shallow(
|
|
14
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandHandleCell, null));
|
|
15
15
|
expect(wrapper.find(IconChevronUp24)).toHaveLength(0);
|
|
16
16
|
expect(wrapper.find(IconChevronDown24)).toHaveLength(1);
|
|
17
17
|
});
|
|
18
18
|
it('responds to clicks', () => {
|
|
19
19
|
const onClick = jest.fn();
|
|
20
|
-
const wrapper = shallow(
|
|
20
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandHandleCell, {
|
|
21
21
|
expanded: false,
|
|
22
22
|
onClick: onClick
|
|
23
23
|
}));
|
|
@@ -5,39 +5,39 @@ import { TableRow, TableDataCell } from '../../table-elements/index.js';
|
|
|
5
5
|
describe('<ExpandedRow>', () => {
|
|
6
6
|
it('renders children', () => {
|
|
7
7
|
const children = 'children';
|
|
8
|
-
const wrapper = shallow(
|
|
8
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandedRow, null, children));
|
|
9
9
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
10
10
|
});
|
|
11
11
|
it('accepts a colSpan prop', () => {
|
|
12
12
|
const colSpan = '4';
|
|
13
|
-
const wrapper = shallow(
|
|
13
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandedRow, {
|
|
14
14
|
colSpan: colSpan
|
|
15
15
|
}));
|
|
16
16
|
expect(wrapper.find(TableDataCell).prop('colSpan')).toBe(colSpan);
|
|
17
17
|
});
|
|
18
18
|
it('accepts a className prop', () => {
|
|
19
19
|
const className = 'test';
|
|
20
|
-
const wrapper = shallow(
|
|
20
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandedRow, {
|
|
21
21
|
className: className
|
|
22
22
|
}));
|
|
23
23
|
expect(wrapper.find(TableRow).prop('className')).toBe(`${className}-expandedrow`);
|
|
24
24
|
});
|
|
25
25
|
it('accepts a dataTest prop', () => {
|
|
26
26
|
const dataTest = 'test';
|
|
27
|
-
const wrapper = shallow(
|
|
27
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandedRow, {
|
|
28
28
|
dataTest: dataTest
|
|
29
29
|
}));
|
|
30
30
|
expect(wrapper.find(TableRow).prop('dataTest')).toBe(`${dataTest}-expandedrow`);
|
|
31
31
|
});
|
|
32
32
|
it('accepts a selected prop', () => {
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandedRow, {
|
|
34
34
|
selected: true
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.find(TableRow).prop('selected')).toBe(true);
|
|
37
37
|
});
|
|
38
38
|
it('accepts a setIsHoveringExpandedContent prop', () => {
|
|
39
39
|
const cb = jest.fn();
|
|
40
|
-
const wrapper = shallow(
|
|
40
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(ExpandedRow, {
|
|
41
41
|
setIsHoveringExpandedContent: cb
|
|
42
42
|
}));
|
|
43
43
|
const tr = wrapper.find(TableRow).dive().find('tr');
|
|
@@ -8,39 +8,39 @@ import { TableRow } from '../table-elements/index.js';
|
|
|
8
8
|
describe('<DataTableRow>', () => {
|
|
9
9
|
it('renders children', () => {
|
|
10
10
|
const children = 'children';
|
|
11
|
-
const wrapper = shallow(
|
|
11
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, null, children));
|
|
12
12
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
13
13
|
});
|
|
14
14
|
it('accepts a ref', () => {
|
|
15
15
|
const ref = /*#__PURE__*/React.createRef();
|
|
16
|
-
const wrapper = mount(
|
|
16
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(DataTableRow, {
|
|
17
17
|
ref: ref
|
|
18
18
|
}))));
|
|
19
19
|
expect(wrapper.find('tr').getDOMNode()).toBe(ref.current);
|
|
20
20
|
});
|
|
21
21
|
it('accepts a className prop', () => {
|
|
22
22
|
const className = 'test';
|
|
23
|
-
const wrapper = shallow(
|
|
23
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
24
24
|
className: className
|
|
25
25
|
}));
|
|
26
26
|
expect(wrapper.find(TableRow).prop('className')).toBe(className);
|
|
27
27
|
});
|
|
28
28
|
it('accepts a dataTest prop', () => {
|
|
29
29
|
const dataTest = 'test';
|
|
30
|
-
const wrapper = shallow(
|
|
30
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
31
31
|
dataTest: dataTest
|
|
32
32
|
}));
|
|
33
33
|
expect(wrapper.find(TableRow).prop('dataTest')).toBe(dataTest);
|
|
34
34
|
});
|
|
35
35
|
it('accepts a draggable prop', () => {
|
|
36
|
-
const wrapper = shallow(
|
|
36
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
37
37
|
draggable: true
|
|
38
38
|
}));
|
|
39
39
|
expect(wrapper.find(TableRow).prop('draggable')).toBe(true);
|
|
40
40
|
expect(wrapper.find(DragHandleCell)).toHaveLength(1);
|
|
41
41
|
});
|
|
42
42
|
it('accepts an expandable prop', () => {
|
|
43
|
-
const wrapper = shallow(
|
|
43
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
44
44
|
expandable: true,
|
|
45
45
|
expandableContent: "test",
|
|
46
46
|
onExpandToggle: () => {}
|
|
@@ -49,7 +49,7 @@ describe('<DataTableRow>', () => {
|
|
|
49
49
|
});
|
|
50
50
|
it('accepts an expandableContent prop', () => {
|
|
51
51
|
const expandableContent = /*#__PURE__*/React.createElement("div", null, "content");
|
|
52
|
-
const wrapper = shallow(
|
|
52
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
53
53
|
expandableContent: expandableContent,
|
|
54
54
|
expanded: true,
|
|
55
55
|
expandable: true,
|
|
@@ -67,12 +67,12 @@ describe('<DataTableRow>', () => {
|
|
|
67
67
|
expect(wrapper.find(TableRow).dive().find('tr').hasClass('isHoveringExpandedContent')).toBe(false);
|
|
68
68
|
});
|
|
69
69
|
it('accepts an expanded prop', () => {
|
|
70
|
-
const wrapperClosed = shallow(
|
|
70
|
+
const wrapperClosed = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
71
71
|
expandable: true,
|
|
72
72
|
expandableContent: "test",
|
|
73
73
|
onExpandToggle: () => {}
|
|
74
74
|
}));
|
|
75
|
-
const wrapperOpen = shallow(
|
|
75
|
+
const wrapperOpen = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
76
76
|
expanded: true,
|
|
77
77
|
expandable: true,
|
|
78
78
|
expandableContent: "test",
|
|
@@ -83,20 +83,20 @@ describe('<DataTableRow>', () => {
|
|
|
83
83
|
});
|
|
84
84
|
it('accepts a role prop', () => {
|
|
85
85
|
const role = 'test';
|
|
86
|
-
const wrapper = shallow(
|
|
86
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
87
87
|
role: role
|
|
88
88
|
}));
|
|
89
89
|
expect(wrapper.find(TableRow).prop('role')).toBe(role);
|
|
90
90
|
});
|
|
91
91
|
it('accepts a selected prop', () => {
|
|
92
|
-
const wrapper = shallow(
|
|
92
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
93
93
|
selected: true
|
|
94
94
|
}));
|
|
95
95
|
expect(wrapper.find(TableRow).prop('selected')).toBe(true);
|
|
96
96
|
});
|
|
97
97
|
it('accepts an onExpandToggle prop', () => {
|
|
98
98
|
const cb = jest.fn();
|
|
99
|
-
const wrapper = shallow(
|
|
99
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
100
100
|
expandable: true,
|
|
101
101
|
expandableContent: "test",
|
|
102
102
|
onExpandToggle: cb
|
|
@@ -109,7 +109,7 @@ describe('<DataTableRow>', () => {
|
|
|
109
109
|
});
|
|
110
110
|
it('accepts a hover prop', () => {
|
|
111
111
|
const cb = jest.fn();
|
|
112
|
-
const wrapper = mount(
|
|
112
|
+
const wrapper = mount(/*#__PURE__*/React.createElement(DataTableRow, {
|
|
113
113
|
expandable: true,
|
|
114
114
|
expandableContent: "test",
|
|
115
115
|
onExpandToggle: cb,
|