@dhis2-ui/table 10.0.0-alpha.7 → 10.0.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
|
@@ -4,36 +4,36 @@ import { TableToolbar } from '../table-toolbar.js';
|
|
|
4
4
|
describe('<TableToolbar>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableToolbar, 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(TableToolbar, {
|
|
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(TableToolbar, {
|
|
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(TableToolbar, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('div').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a position prop', () => {
|
|
32
|
-
const wrapperDefault = shallow(
|
|
33
|
-
const wrapperTop = shallow(
|
|
32
|
+
const wrapperDefault = shallow(/*#__PURE__*/React.createElement(TableToolbar, null));
|
|
33
|
+
const wrapperTop = shallow(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
34
34
|
position: "top"
|
|
35
35
|
}));
|
|
36
|
-
const wrapperBottom = shallow(
|
|
36
|
+
const wrapperBottom = shallow(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
37
37
|
position: "bottom"
|
|
38
38
|
}));
|
|
39
39
|
expect(wrapperDefault.find('div').hasClass('top')).toBe(true);
|
|
@@ -4,53 +4,53 @@ import { Table } from '../table.js';
|
|
|
4
4
|
describe('<Table>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, 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, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}));
|
|
15
15
|
expect(wrapper.find('table').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a borderless prop', () => {
|
|
18
|
-
const wrapper = shallow(
|
|
18
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
19
19
|
borderless: true
|
|
20
20
|
}));
|
|
21
21
|
expect(wrapper.find('table').hasClass('borderless')).toBe(true);
|
|
22
22
|
});
|
|
23
23
|
it('accepts a className prop', () => {
|
|
24
24
|
const className = 'test';
|
|
25
|
-
const wrapper = shallow(
|
|
25
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
26
26
|
className: className
|
|
27
27
|
}));
|
|
28
28
|
expect(wrapper.find('table').hasClass(className)).toBe(true);
|
|
29
29
|
});
|
|
30
30
|
it('accepts a dataTest prop', () => {
|
|
31
31
|
const dataTest = 'test';
|
|
32
|
-
const wrapper = shallow(
|
|
32
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
33
33
|
dataTest: dataTest
|
|
34
34
|
}));
|
|
35
35
|
expect(wrapper.find('table').prop('data-test')).toBe(dataTest);
|
|
36
36
|
});
|
|
37
37
|
it('accepts a layout prop', () => {
|
|
38
38
|
const layout = 'fixed';
|
|
39
|
-
const wrapper = shallow(
|
|
39
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
40
40
|
layout: layout
|
|
41
41
|
}));
|
|
42
42
|
expect(wrapper.html()).toContain(`table-layout: ${layout};`);
|
|
43
43
|
});
|
|
44
44
|
it('accepts a role prop', () => {
|
|
45
45
|
const role = 'test';
|
|
46
|
-
const wrapper = shallow(
|
|
46
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
47
47
|
role: role
|
|
48
48
|
}));
|
|
49
49
|
expect(wrapper.find('table').prop('role')).toBe(role);
|
|
50
50
|
});
|
|
51
51
|
it('accepts a width prop', () => {
|
|
52
52
|
const width = '200px';
|
|
53
|
-
const wrapper = shallow(
|
|
53
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
54
54
|
width: width
|
|
55
55
|
}));
|
|
56
56
|
expect(wrapper.html()).toContain(`width: ${width};`);
|
|
@@ -76,7 +76,7 @@ describe('StackedTable', () => {
|
|
|
76
76
|
label: 'Incomplete'
|
|
77
77
|
}];
|
|
78
78
|
it('should add the headerLabels to each cell', () => {
|
|
79
|
-
const table = mount(
|
|
79
|
+
const table = mount(/*#__PURE__*/React.createElement(Table, {
|
|
80
80
|
headerLabels: headerLabels,
|
|
81
81
|
bodyLabels: bodyLabels
|
|
82
82
|
}));
|
|
@@ -90,7 +90,7 @@ describe('StackedTable', () => {
|
|
|
90
90
|
it('should not add empty header labels to the body cells', () => {
|
|
91
91
|
const emptyLabelIndex = 2;
|
|
92
92
|
const headerLabelsWithEmpty = [...headerLabels.slice(0, emptyLabelIndex), '', ...headerLabels.slice(emptyLabelIndex + 1)];
|
|
93
|
-
const table = mount(
|
|
93
|
+
const table = mount(/*#__PURE__*/React.createElement(Table, {
|
|
94
94
|
headerLabels: headerLabelsWithEmpty,
|
|
95
95
|
bodyLabels: bodyLabels
|
|
96
96
|
}));
|
|
@@ -107,7 +107,7 @@ describe('StackedTable', () => {
|
|
|
107
107
|
...originalHeaderLabel,
|
|
108
108
|
colSpan: `${colSpan}`
|
|
109
109
|
}, ...headerLabels.slice(indexWithColspan + colSpan)];
|
|
110
|
-
const table = mount(
|
|
110
|
+
const table = mount(/*#__PURE__*/React.createElement(Table, {
|
|
111
111
|
headerLabels: headerLabelsWithColspan,
|
|
112
112
|
bodyLabels: bodyLabels
|
|
113
113
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/table",
|
|
3
|
-
"version": "10.0.0
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "UI Table",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@dhis2/d2-i18n": "^1",
|
|
31
|
-
"react": "^16.13",
|
|
32
|
-
"react-dom": "^16.13",
|
|
31
|
+
"react": "^16.13 || ^18",
|
|
32
|
+
"react-dom": "^16.13 || ^18",
|
|
33
33
|
"styled-jsx": "^4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@dhis2/prop-types": "^3.1.2",
|
|
37
|
-
"@dhis2/ui-constants": "10.0.0
|
|
38
|
-
"@dhis2/ui-icons": "10.0.0
|
|
37
|
+
"@dhis2/ui-constants": "10.0.0",
|
|
38
|
+
"@dhis2/ui-icons": "10.0.0",
|
|
39
39
|
"classnames": "^2.3.1",
|
|
40
40
|
"prop-types": "^15.7.2"
|
|
41
41
|
},
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
],
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
48
|
-
"react": "
|
|
49
|
-
"react-dom": "
|
|
48
|
+
"react": "^18.3.1",
|
|
49
|
+
"react-dom": "^18.3.1",
|
|
50
50
|
"styled-jsx": "^4.0.1"
|
|
51
51
|
},
|
|
52
52
|
"types": "types"
|