@dhis2-ui/table 10.0.0-alpha.7 → 10.0.0-alpha.8
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
|
@@ -5,52 +5,52 @@ import { Table, TableScrollBox } from '../table-elements/index.js';
|
|
|
5
5
|
describe('<DataTable>', () => {
|
|
6
6
|
it('renders children', () => {
|
|
7
7
|
const children = 'children';
|
|
8
|
-
const wrapper = shallow(
|
|
8
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, 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(DataTable, {
|
|
14
14
|
ref: ref
|
|
15
15
|
}));
|
|
16
16
|
expect(wrapper.find('table').getDOMNode()).toBe(ref.current);
|
|
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(DataTable, {
|
|
21
21
|
className: className
|
|
22
22
|
}));
|
|
23
23
|
expect(wrapper.find(Table).prop('className')).toBe(className);
|
|
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(DataTable, {
|
|
28
28
|
dataTest: dataTest
|
|
29
29
|
}));
|
|
30
30
|
expect(wrapper.find(Table).prop('dataTest')).toBe(dataTest);
|
|
31
31
|
});
|
|
32
32
|
it('accepts a layout prop', () => {
|
|
33
33
|
const layout = 'fixed';
|
|
34
|
-
const wrapper = shallow(
|
|
34
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, {
|
|
35
35
|
layout: layout
|
|
36
36
|
}));
|
|
37
37
|
expect(wrapper.find(Table).prop('layout')).toBe(layout);
|
|
38
38
|
});
|
|
39
39
|
it('accepts a role prop', () => {
|
|
40
40
|
const role = 'test';
|
|
41
|
-
const wrapper = shallow(
|
|
41
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, {
|
|
42
42
|
role: role
|
|
43
43
|
}));
|
|
44
44
|
expect(wrapper.find(Table).prop('role')).toBe(role);
|
|
45
45
|
});
|
|
46
46
|
it('renders a datatable when no scrollHeight or scrollWidth are provided', () => {
|
|
47
|
-
const wrapper = shallow(
|
|
47
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, null));
|
|
48
48
|
expect(wrapper.find(Table)).toHaveLength(1);
|
|
49
49
|
expect(wrapper.find(TableScrollBox)).toHaveLength(0);
|
|
50
50
|
});
|
|
51
51
|
it('wraps the datatable in a scroll box when scrollHeight is provided', () => {
|
|
52
52
|
const height = '200px';
|
|
53
|
-
const wrapper = shallow(
|
|
53
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, {
|
|
54
54
|
scrollHeight: height
|
|
55
55
|
}));
|
|
56
56
|
expect(wrapper.dive().type()).toBe('div');
|
|
@@ -60,7 +60,7 @@ describe('<DataTable>', () => {
|
|
|
60
60
|
});
|
|
61
61
|
it('wraps the datatable in a scroll box when scrollWidth is provided', () => {
|
|
62
62
|
const width = '200px';
|
|
63
|
-
const wrapper = shallow(
|
|
63
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, {
|
|
64
64
|
scrollWidth: width
|
|
65
65
|
}));
|
|
66
66
|
expect(wrapper.dive().type()).toBe('div');
|
|
@@ -70,7 +70,7 @@ describe('<DataTable>', () => {
|
|
|
70
70
|
});
|
|
71
71
|
it('wraps the datatable in a scroll box when both scrollHeight and scrollWidth are provided', () => {
|
|
72
72
|
const size = '200px';
|
|
73
|
-
const wrapper = shallow(
|
|
73
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, {
|
|
74
74
|
scrollHeight: size,
|
|
75
75
|
scrollWidth: size
|
|
76
76
|
}));
|
|
@@ -82,7 +82,7 @@ describe('<DataTable>', () => {
|
|
|
82
82
|
});
|
|
83
83
|
it('accepts a width prop', () => {
|
|
84
84
|
const width = '200px';
|
|
85
|
-
const wrapper = shallow(
|
|
85
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(DataTable, {
|
|
86
86
|
width: width
|
|
87
87
|
}));
|
|
88
88
|
expect(wrapper.find(Table).prop('width')).toBe(width);
|
|
@@ -4,33 +4,33 @@ import { TableBody } from '../table-body.js';
|
|
|
4
4
|
describe('<TableBody>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableBody, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement(TableBody, {
|
|
13
13
|
ref: ref
|
|
14
14
|
})));
|
|
15
15
|
expect(wrapper.find('tbody').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableBody, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('tbody').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableBody, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('tbody').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a role prop', () => {
|
|
32
32
|
const role = 'test';
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableBody, {
|
|
34
34
|
role: role
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.find('tbody').prop('role')).toBe(role);
|
|
@@ -4,124 +4,124 @@ import { TableDataCell } from '../table-data-cell/table-data-cell.js';
|
|
|
4
4
|
describe('<TableDataCell>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement(TableDataCell, {
|
|
13
13
|
ref: ref
|
|
14
14
|
})))));
|
|
15
15
|
expect(wrapper.find('td').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts an active prop', () => {
|
|
18
|
-
const wrapper = shallow(
|
|
18
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
19
19
|
active: true
|
|
20
20
|
}));
|
|
21
21
|
expect(wrapper.find('td').hasClass('active')).toBe(true);
|
|
22
22
|
});
|
|
23
23
|
it('accepts an align prop', () => {
|
|
24
24
|
const align = 'right';
|
|
25
|
-
const wrapper = shallow(
|
|
25
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
26
26
|
align: align
|
|
27
27
|
}));
|
|
28
28
|
expect(wrapper.html()).toContain(`text-align: ${align};`);
|
|
29
29
|
});
|
|
30
30
|
it('accepts a bordered prop', () => {
|
|
31
|
-
const wrapper = shallow(
|
|
31
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
32
32
|
bordered: true
|
|
33
33
|
}));
|
|
34
34
|
expect(wrapper.find('td').hasClass('bordered')).toBe(true);
|
|
35
35
|
});
|
|
36
36
|
it('accepts a className prop', () => {
|
|
37
37
|
const className = 'test';
|
|
38
|
-
const wrapper = shallow(
|
|
38
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
39
39
|
className: className
|
|
40
40
|
}));
|
|
41
41
|
expect(wrapper.find('td').hasClass(className)).toBe(true);
|
|
42
42
|
});
|
|
43
43
|
it('accepts a colSpan prop', () => {
|
|
44
44
|
const colSpan = '3';
|
|
45
|
-
const wrapper = shallow(
|
|
45
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
46
46
|
colSpan: colSpan
|
|
47
47
|
}));
|
|
48
48
|
expect(wrapper.find('td').prop('colSpan')).toBe(colSpan);
|
|
49
49
|
});
|
|
50
50
|
it('accepts a dataTest prop', () => {
|
|
51
51
|
const dataTest = 'test';
|
|
52
|
-
const wrapper = shallow(
|
|
52
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
53
53
|
dataTest: dataTest
|
|
54
54
|
}));
|
|
55
55
|
expect(wrapper.find('td').prop('data-test')).toBe(dataTest);
|
|
56
56
|
});
|
|
57
57
|
it('accepts an error prop', () => {
|
|
58
|
-
const wrapper = shallow(
|
|
58
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
59
59
|
error: true
|
|
60
60
|
}));
|
|
61
61
|
expect(wrapper.find('td').hasClass('error')).toBe(true);
|
|
62
62
|
});
|
|
63
63
|
it('accepts a large prop', () => {
|
|
64
|
-
const wrapper = shallow(
|
|
64
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
65
65
|
large: true
|
|
66
66
|
}));
|
|
67
67
|
expect(wrapper.find('td').hasClass('large')).toBe(true);
|
|
68
68
|
});
|
|
69
69
|
it('accepts a left prop', () => {
|
|
70
70
|
const left = '200px';
|
|
71
|
-
const wrapper = shallow(
|
|
71
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
72
72
|
left: left
|
|
73
73
|
}));
|
|
74
74
|
expect(wrapper.html()).toContain(`inset-inline-start: ${left};`);
|
|
75
75
|
});
|
|
76
76
|
it('accepts a muted prop', () => {
|
|
77
|
-
const wrapper = shallow(
|
|
77
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
78
78
|
muted: true
|
|
79
79
|
}));
|
|
80
80
|
expect(wrapper.find('td').hasClass('muted')).toBe(true);
|
|
81
81
|
});
|
|
82
82
|
it('accepts a role prop', () => {
|
|
83
83
|
const role = 'test';
|
|
84
|
-
const wrapper = shallow(
|
|
84
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
85
85
|
role: role
|
|
86
86
|
}));
|
|
87
87
|
expect(wrapper.find('td').prop('role')).toBe(role);
|
|
88
88
|
});
|
|
89
89
|
it('accepts a rowSpan prop', () => {
|
|
90
90
|
const rowSpan = '3';
|
|
91
|
-
const wrapper = shallow(
|
|
91
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
92
92
|
rowSpan: rowSpan
|
|
93
93
|
}));
|
|
94
94
|
expect(wrapper.find('td').prop('rowSpan')).toBe(rowSpan);
|
|
95
95
|
});
|
|
96
96
|
it('accepts a scope prop', () => {
|
|
97
97
|
const scope = 'row';
|
|
98
|
-
const wrapper = shallow(
|
|
98
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
99
99
|
scope: scope
|
|
100
100
|
}));
|
|
101
101
|
expect(wrapper.find('td').prop('scope')).toBe(scope);
|
|
102
102
|
});
|
|
103
103
|
it('accepts a staticStyle prop', () => {
|
|
104
|
-
const wrapper = shallow(
|
|
104
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
105
105
|
staticStyle: true
|
|
106
106
|
}));
|
|
107
107
|
expect(wrapper.find('td').hasClass('staticStyle')).toBe(true);
|
|
108
108
|
});
|
|
109
109
|
it('accepts a valid prop', () => {
|
|
110
|
-
const wrapper = shallow(
|
|
110
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
111
111
|
valid: true
|
|
112
112
|
}));
|
|
113
113
|
expect(wrapper.find('td').hasClass('valid')).toBe(true);
|
|
114
114
|
});
|
|
115
115
|
it('accepts a width prop', () => {
|
|
116
116
|
const width = '200px';
|
|
117
|
-
const wrapper = shallow(
|
|
117
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
118
118
|
width: width
|
|
119
119
|
}));
|
|
120
120
|
expect(wrapper.html()).toContain(`width: ${width};`);
|
|
121
121
|
});
|
|
122
122
|
it('accepts an onClick prop', () => {
|
|
123
123
|
const onClick = jest.fn();
|
|
124
|
-
const wrapper = shallow(
|
|
124
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableDataCell, {
|
|
125
125
|
onClick: onClick
|
|
126
126
|
}));
|
|
127
127
|
wrapper.simulate('click');
|
|
@@ -4,33 +4,33 @@ import { TableFoot } from '../table-foot.js';
|
|
|
4
4
|
describe('<TableFoot>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableFoot, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement(TableFoot, {
|
|
13
13
|
ref: ref
|
|
14
14
|
})));
|
|
15
15
|
expect(wrapper.find('tfoot').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableFoot, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('tfoot').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableFoot, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('tfoot').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a role prop', () => {
|
|
32
32
|
const role = 'test';
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableFoot, {
|
|
34
34
|
role: role
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.find('tfoot').prop('role')).toBe(role);
|
|
@@ -4,33 +4,33 @@ import { TableHead } from '../table-head.js';
|
|
|
4
4
|
describe('<TableHead>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHead, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement(TableHead, {
|
|
13
13
|
ref: ref
|
|
14
14
|
})));
|
|
15
15
|
expect(wrapper.find('thead').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHead, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('thead').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHead, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('thead').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a role prop', () => {
|
|
32
32
|
const role = 'test';
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHead, {
|
|
34
34
|
role: role
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.find('thead').prop('role')).toBe(role);
|
|
@@ -4,40 +4,40 @@ import { TableHeaderCellAction } from '../table-header-cell-action.js';
|
|
|
4
4
|
describe('<TableHeaderCellAction>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCellAction, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement(TableHeaderCellAction, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}));
|
|
15
15
|
expect(wrapper.find('button').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCellAction, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('button').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCellAction, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('button').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a title prop', () => {
|
|
32
32
|
const title = 'test';
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCellAction, {
|
|
34
34
|
title: title
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.find('button').prop('title')).toBe(title);
|
|
37
37
|
});
|
|
38
38
|
it('accepts an onClick prop', () => {
|
|
39
39
|
const onClick = jest.fn();
|
|
40
|
-
const wrapper = shallow(
|
|
40
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCellAction, {
|
|
41
41
|
onClick: onClick
|
|
42
42
|
}));
|
|
43
43
|
wrapper.simulate('click');
|
|
@@ -4,132 +4,132 @@ import { TableHeaderCell } from '../table-header-cell/table-header-cell.js';
|
|
|
4
4
|
describe('<TableHeaderCell>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
13
13
|
ref: ref
|
|
14
14
|
})))));
|
|
15
15
|
expect(wrapper.find('th').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts an active prop', () => {
|
|
18
|
-
const wrapper = shallow(
|
|
18
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
19
19
|
active: true
|
|
20
20
|
}));
|
|
21
21
|
expect(wrapper.find('th').hasClass('active')).toBe(true);
|
|
22
22
|
});
|
|
23
23
|
it('accepts an align prop', () => {
|
|
24
24
|
const align = 'right';
|
|
25
|
-
const wrapper = shallow(
|
|
25
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
26
26
|
align: align
|
|
27
27
|
}));
|
|
28
28
|
expect(wrapper.html()).toContain(`text-align: ${align};`);
|
|
29
29
|
});
|
|
30
30
|
it('accepts a bordered prop', () => {
|
|
31
|
-
const wrapper = shallow(
|
|
31
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
32
32
|
bordered: true
|
|
33
33
|
}));
|
|
34
34
|
expect(wrapper.find('th').hasClass('bordered')).toBe(true);
|
|
35
35
|
});
|
|
36
36
|
it('accepts a className prop', () => {
|
|
37
37
|
const className = 'test';
|
|
38
|
-
const wrapper = shallow(
|
|
38
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
39
39
|
className: className
|
|
40
40
|
}));
|
|
41
41
|
expect(wrapper.find('th').hasClass(className)).toBe(true);
|
|
42
42
|
});
|
|
43
43
|
it('accepts a colSpan prop', () => {
|
|
44
44
|
const colSpan = '3';
|
|
45
|
-
const wrapper = shallow(
|
|
45
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
46
46
|
colSpan: colSpan
|
|
47
47
|
}));
|
|
48
48
|
expect(wrapper.find('th').prop('colSpan')).toBe(colSpan);
|
|
49
49
|
});
|
|
50
50
|
it('accepts a dataTest prop', () => {
|
|
51
51
|
const dataTest = 'test';
|
|
52
|
-
const wrapper = shallow(
|
|
52
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
53
53
|
dataTest: dataTest
|
|
54
54
|
}));
|
|
55
55
|
expect(wrapper.find('th').prop('data-test')).toBe(dataTest);
|
|
56
56
|
});
|
|
57
57
|
it('accepts an error prop', () => {
|
|
58
|
-
const wrapper = shallow(
|
|
58
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
59
59
|
error: true
|
|
60
60
|
}));
|
|
61
61
|
expect(wrapper.find('th').hasClass('error')).toBe(true);
|
|
62
62
|
});
|
|
63
63
|
it('accepts a fixed prop', () => {
|
|
64
|
-
const wrapper = shallow(
|
|
64
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
65
65
|
fixed: true
|
|
66
66
|
}));
|
|
67
67
|
expect(wrapper.type()).toBe('th');
|
|
68
68
|
expect(wrapper.find('th').hasClass('fixed')).toBe(true);
|
|
69
69
|
});
|
|
70
70
|
it('accepts a large prop', () => {
|
|
71
|
-
const wrapper = shallow(
|
|
71
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
72
72
|
large: true
|
|
73
73
|
}));
|
|
74
74
|
expect(wrapper.find('th').hasClass('large')).toBe(true);
|
|
75
75
|
});
|
|
76
76
|
it('accepts a left prop', () => {
|
|
77
77
|
const left = '200px';
|
|
78
|
-
const wrapper = shallow(
|
|
78
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
79
79
|
left: left
|
|
80
80
|
}));
|
|
81
81
|
expect(wrapper.html()).toContain(`inset-inline-start: ${left};`);
|
|
82
82
|
});
|
|
83
83
|
it('accepts an muted prop', () => {
|
|
84
|
-
const wrapper = shallow(
|
|
84
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
85
85
|
muted: true
|
|
86
86
|
}));
|
|
87
87
|
expect(wrapper.find('th').hasClass('muted')).toBe(true);
|
|
88
88
|
});
|
|
89
89
|
it('accepts a role prop', () => {
|
|
90
90
|
const role = 'test';
|
|
91
|
-
const wrapper = shallow(
|
|
91
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
92
92
|
role: role
|
|
93
93
|
}));
|
|
94
94
|
expect(wrapper.find('th').prop('role')).toBe(role);
|
|
95
95
|
});
|
|
96
96
|
it('accepts a rowSpan prop', () => {
|
|
97
97
|
const rowSpan = '3';
|
|
98
|
-
const wrapper = shallow(
|
|
98
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
99
99
|
rowSpan: rowSpan
|
|
100
100
|
}));
|
|
101
101
|
expect(wrapper.find('th').prop('rowSpan')).toBe(rowSpan);
|
|
102
102
|
});
|
|
103
103
|
it('accepts a scope prop', () => {
|
|
104
104
|
const scope = 'row';
|
|
105
|
-
const wrapper = shallow(
|
|
105
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
106
106
|
scope: scope
|
|
107
107
|
}));
|
|
108
108
|
expect(wrapper.find('th').prop('scope')).toBe(scope);
|
|
109
109
|
});
|
|
110
110
|
it('accepts a top prop', () => {
|
|
111
111
|
const top = '200px';
|
|
112
|
-
const wrapper = shallow(
|
|
112
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
113
113
|
top: top
|
|
114
114
|
}));
|
|
115
115
|
expect(wrapper.html()).toContain(`top: ${top};`);
|
|
116
116
|
});
|
|
117
117
|
it('accepts a valid prop', () => {
|
|
118
|
-
const wrapper = shallow(
|
|
118
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
119
119
|
valid: true
|
|
120
120
|
}));
|
|
121
121
|
expect(wrapper.find('th').hasClass('valid')).toBe(true);
|
|
122
122
|
});
|
|
123
123
|
it('accepts a width prop', () => {
|
|
124
124
|
const width = '200px';
|
|
125
|
-
const wrapper = shallow(
|
|
125
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
126
126
|
width: width
|
|
127
127
|
}));
|
|
128
128
|
expect(wrapper.html()).toContain(`width: ${width};`);
|
|
129
129
|
});
|
|
130
130
|
it('accepts an onClick prop', () => {
|
|
131
131
|
const onClick = jest.fn();
|
|
132
|
-
const wrapper = shallow(
|
|
132
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
133
133
|
onClick: onClick
|
|
134
134
|
}));
|
|
135
135
|
wrapper.simulate('click');
|
|
@@ -4,45 +4,45 @@ import { TableRow } from '../table-row.js';
|
|
|
4
4
|
describe('<TableRow>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(TableRow, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}))));
|
|
15
15
|
expect(wrapper.find('tr').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('tr').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('tr').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a draggable prop', () => {
|
|
32
|
-
const wrapper = shallow(
|
|
32
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
33
33
|
draggable: true
|
|
34
34
|
}));
|
|
35
35
|
expect(wrapper.find('tr').hasClass('draggable')).toBe(true);
|
|
36
36
|
});
|
|
37
37
|
it('accepts a role prop', () => {
|
|
38
38
|
const role = 'test';
|
|
39
|
-
const wrapper = shallow(
|
|
39
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
40
40
|
role: role
|
|
41
41
|
}));
|
|
42
42
|
expect(wrapper.find('tr').prop('role')).toBe(role);
|
|
43
43
|
});
|
|
44
44
|
it('accepts a selected prop', () => {
|
|
45
|
-
const wrapper = shallow(
|
|
45
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
46
46
|
selected: true
|
|
47
47
|
}));
|
|
48
48
|
expect(wrapper.find('tr').hasClass('selected')).toBe(true);
|
|
@@ -4,40 +4,40 @@ import { TableScrollBox } from '../table-scroll-box.js';
|
|
|
4
4
|
describe('<TableScrollBox>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}));
|
|
15
15
|
expect(wrapper.find('div').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('div').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('div').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a maxHeight prop', () => {
|
|
32
32
|
const maxHeight = '200px';
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
34
34
|
maxHeight: maxHeight
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.html()).toContain('max-height: 200px;');
|
|
37
37
|
});
|
|
38
38
|
it('accepts a maxWidth prop', () => {
|
|
39
39
|
const maxWidth = '200px';
|
|
40
|
-
const wrapper = shallow(
|
|
40
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
41
41
|
maxWidth: maxWidth
|
|
42
42
|
}));
|
|
43
43
|
expect(wrapper.html()).toContain('max-width: 200px;');
|