@dhis2/analytics 28.0.4 → 28.0.5
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/__demo__/OpenFileDialog.stories.js +19 -1
- package/build/cjs/components/DimensionsPanel/List/DimensionList.js +3 -1
- package/build/cjs/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +48 -41
- package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +110 -114
- package/build/cjs/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +36 -33
- package/build/cjs/components/FileMenu/__tests__/DeleteDialog.spec.js +24 -27
- package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +51 -31
- package/build/cjs/components/FileMenu/__tests__/GetLinkDialog.spec.js +28 -31
- package/build/cjs/components/FileMenu/__tests__/RenameDialog.spec.js +17 -11
- package/build/cjs/components/FileMenu/__tests__/SaveAsDialog.spec.js +44 -37
- package/build/cjs/components/Filter/__tests__/Filter.spec.js +29 -34
- package/build/cjs/components/OpenFileDialog/CreatedByFilter.js +9 -1
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +14 -34
- package/build/cjs/components/OpenFileDialog/VisTypeFilter.js +39 -1
- package/build/cjs/components/OpenFileDialog/__tests__/OpenFileDialog.spec.js +51 -0
- package/build/cjs/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +78 -44
- package/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +1 -0
- package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +3 -2
- package/build/cjs/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +14 -21
- package/build/cjs/components/PeriodDimension/__tests__/PeriodDimension.spec.js +27 -23
- package/build/cjs/components/RichText/Editor/__tests__/Editor.spec.js +6 -7
- package/build/cjs/components/RichText/Parser/__tests__/MdParser.spec.js +1 -1
- package/build/cjs/components/RichText/Parser/__tests__/Parser.spec.js +22 -23
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +52 -42
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +8 -8
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +23 -18
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +23 -17
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/__snapshots__/HoverMenuList.spec.js.snap +63 -0
- package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +3 -1
- package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +19 -18
- package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +8 -8
- package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +14 -11
- package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +16 -14
- package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModal.js +2 -1
- package/build/cjs/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js +25 -16
- package/build/es/__demo__/OpenFileDialog.stories.js +17 -0
- package/build/es/components/DimensionsPanel/List/DimensionList.js +3 -1
- package/build/es/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +47 -40
- package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +110 -114
- package/build/es/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +35 -32
- package/build/es/components/FileMenu/__tests__/DeleteDialog.spec.js +23 -26
- package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +52 -32
- package/build/es/components/FileMenu/__tests__/GetLinkDialog.spec.js +27 -30
- package/build/es/components/FileMenu/__tests__/RenameDialog.spec.js +18 -12
- package/build/es/components/FileMenu/__tests__/SaveAsDialog.spec.js +43 -36
- package/build/es/components/Filter/__tests__/Filter.spec.js +28 -33
- package/build/es/components/OpenFileDialog/CreatedByFilter.js +7 -0
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +14 -35
- package/build/es/components/OpenFileDialog/VisTypeFilter.js +38 -1
- package/build/es/components/OpenFileDialog/__tests__/OpenFileDialog.spec.js +49 -0
- package/build/es/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +77 -43
- package/build/es/components/PeriodDimension/FixedPeriodFilter.js +1 -0
- package/build/es/components/PeriodDimension/RelativePeriodFilter.js +3 -2
- package/build/es/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +13 -20
- package/build/es/components/PeriodDimension/__tests__/PeriodDimension.spec.js +26 -22
- package/build/es/components/RichText/Editor/__tests__/Editor.spec.js +7 -8
- package/build/es/components/RichText/Parser/__tests__/MdParser.spec.js +1 -1
- package/build/es/components/RichText/Parser/__tests__/Parser.spec.js +21 -22
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +53 -43
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +7 -7
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +23 -18
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +21 -15
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/__snapshots__/HoverMenuList.spec.js.snap +63 -0
- package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +3 -1
- package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +18 -17
- package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +7 -7
- package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +13 -10
- package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +15 -13
- package/build/es/components/TranslationDialog/TranslationModal/TranslationModal.js +2 -1
- package/build/es/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js +24 -15
- package/package.json +2 -4
- package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -89
- package/build/cjs/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -29
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -92
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodDimension.spec.js.snap +0 -16
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +0 -89
- package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -89
- package/build/es/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -26
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -92
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodDimension.spec.js.snap +0 -16
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +0 -89
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.NoConnection = exports.ListOfVisualizationsWithVisTypeFilterWithGroupTypeDividerAndDisabledOptionNoDefaultVisType = exports.ListOfVisualizationsWithVisTypeFilterAndDividerNoDefaultVisType = exports.ListOfMapsNoVisTypeFilter = exports.ListOfEventVisualizationsWithVisTypeFilterDisabledTypeAndDefaultVisType = void 0;
|
|
6
|
+
exports.default = exports.NoConnection = exports.ListOfVisualizationsWithVisTypeGroupFilterNoDefaultVisType = exports.ListOfVisualizationsWithVisTypeFilterWithGroupTypeDividerAndDisabledOptionNoDefaultVisType = exports.ListOfVisualizationsWithVisTypeFilterAndDividerNoDefaultVisType = exports.ListOfMapsNoVisTypeFilter = exports.ListOfEventVisualizationsWithVisTypeFilterDisabledTypeAndDefaultVisType = void 0;
|
|
7
7
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _OpenFileDialog = require("../components/OpenFileDialog/OpenFileDialog.js");
|
|
@@ -48,6 +48,24 @@ exports.ListOfVisualizationsWithVisTypeFilterAndDividerNoDefaultVisType = ListOf
|
|
|
48
48
|
ListOfVisualizationsWithVisTypeFilterAndDividerNoDefaultVisType.story = {
|
|
49
49
|
name: 'List of visualizations with vis type filter and divider (no default vis type)'
|
|
50
50
|
};
|
|
51
|
+
const filterVisTypesWithGroups = [{
|
|
52
|
+
type: _visTypes.VIS_TYPE_GROUP_ALL
|
|
53
|
+
}, {
|
|
54
|
+
type: _visTypes.VIS_TYPE_GROUP_CHARTS
|
|
55
|
+
}];
|
|
56
|
+
const ListOfVisualizationsWithVisTypeGroupFilterNoDefaultVisType = () => /*#__PURE__*/_react.default.createElement(_OpenFileDialog.OpenFileDialog, {
|
|
57
|
+
type: "visualization",
|
|
58
|
+
filterVisTypes: filterVisTypesWithGroups,
|
|
59
|
+
onClose: Function.prototype,
|
|
60
|
+
onFileSelect: onFileSelect,
|
|
61
|
+
onNew: Function.prototype,
|
|
62
|
+
open: true,
|
|
63
|
+
currentUser: user
|
|
64
|
+
});
|
|
65
|
+
exports.ListOfVisualizationsWithVisTypeGroupFilterNoDefaultVisType = ListOfVisualizationsWithVisTypeGroupFilterNoDefaultVisType;
|
|
66
|
+
ListOfVisualizationsWithVisTypeGroupFilterNoDefaultVisType.story = {
|
|
67
|
+
name: 'List of visualizations with only vis type group filter (no default vis type)'
|
|
68
|
+
};
|
|
51
69
|
const ListOfMapsNoVisTypeFilter = () => /*#__PURE__*/_react.default.createElement(_OpenFileDialog.OpenFileDialog, {
|
|
52
70
|
type: "map",
|
|
53
71
|
onClose: Function.prototype,
|
|
@@ -33,7 +33,8 @@ class DimensionList extends _react.Component {
|
|
|
33
33
|
isDeactivated: this.isDisabled(dimension.id),
|
|
34
34
|
onClick: this.props.onDimensionClick,
|
|
35
35
|
onOptionsClick: this.props.onDimensionOptionsClick,
|
|
36
|
-
onDragStart: this.props.onDimensionDragStart
|
|
36
|
+
onDragStart: this.props.onDimensionDragStart,
|
|
37
|
+
dataTest: "dimension-item"
|
|
37
38
|
}));
|
|
38
39
|
_defineProperty(this, "getDimensionItemsByFilter", filter => this.props.dimensions.filter(filter).filter(this.nameContainsFilterText).map(this.renderItem));
|
|
39
40
|
}
|
|
@@ -41,6 +42,7 @@ class DimensionList extends _react.Component {
|
|
|
41
42
|
const fixedDimensions = this.getDimensionItemsByFilter(dimension => Object.values((0, _predefinedDimensions.getFixedDimensions)()).some(fixedDim => fixedDim.id === dimension.id));
|
|
42
43
|
const nonPredefinedDimensions = this.getDimensionItemsByFilter(dimension => !Object.values((0, _predefinedDimensions.getPredefinedDimensions)()).some(predefDim => predefDim.id === dimension.id));
|
|
43
44
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
"data-test": "dhis2-analytics-dimension-list",
|
|
44
46
|
className: `jsx-${_DimensionListStyle.default.__hash}` + " " + "container"
|
|
45
47
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
46
48
|
className: `jsx-${_DimensionListStyle.default.__hash}` + " " + "wrapper"
|
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
5
5
|
var _DimensionItem = _interopRequireDefault(require("../DimensionItem.js"));
|
|
6
6
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
7
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
8
|
+
const props = {
|
|
9
|
+
id: 'pe',
|
|
10
|
+
name: 'Period',
|
|
11
|
+
isDeactivated: false,
|
|
12
|
+
isSelected: false,
|
|
13
|
+
isRecommended: false,
|
|
14
|
+
isLocked: false
|
|
15
|
+
};
|
|
16
|
+
test('DimensionItem matches the snapshot', () => {
|
|
17
|
+
const {
|
|
18
|
+
container
|
|
19
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionItem.default, props));
|
|
20
|
+
expect(container).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
test('DimensionItem matches the snapshot with recommended', () => {
|
|
23
|
+
const {
|
|
24
|
+
container
|
|
25
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionItem.default, _extends({}, props, {
|
|
26
|
+
isRecommended: true
|
|
27
|
+
})));
|
|
28
|
+
expect(container).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
test('DimensionItem matches the snapshot with selected', () => {
|
|
31
|
+
const {
|
|
32
|
+
container
|
|
33
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionItem.default, _extends({}, props, {
|
|
34
|
+
isSelected: true
|
|
35
|
+
})));
|
|
36
|
+
expect(container).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
test('DimensionItem matches the snapshot with locked', () => {
|
|
39
|
+
const {
|
|
40
|
+
container
|
|
41
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionItem.default, _extends({}, props, {
|
|
42
|
+
isLocked: true
|
|
43
|
+
})));
|
|
44
|
+
expect(container).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
test('DimensionItem matches the snapshot with onOptionsClick', () => {
|
|
47
|
+
const {
|
|
48
|
+
container
|
|
49
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionItem.default, _extends({}, props, {
|
|
50
|
+
onOptionsClick: jest.fn()
|
|
51
|
+
})));
|
|
52
|
+
expect(container).toMatchSnapshot();
|
|
46
53
|
});
|
package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`DimensionItem matches the snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<CssVariables
|
|
6
|
-
colors={true}
|
|
7
|
-
/>
|
|
4
|
+
<div>
|
|
8
5
|
<li
|
|
9
|
-
|
|
6
|
+
class="item"
|
|
10
7
|
name="Period"
|
|
11
|
-
onClick={[Function]}
|
|
12
|
-
onMouseLeave={[Function]}
|
|
13
|
-
onMouseOver={[Function]}
|
|
14
|
-
style={Object {}}
|
|
15
8
|
>
|
|
16
9
|
<div
|
|
17
|
-
|
|
10
|
+
class="label"
|
|
18
11
|
data-test="undefined-button-pe"
|
|
19
|
-
|
|
12
|
+
tabindex="0"
|
|
20
13
|
>
|
|
21
14
|
<div
|
|
22
|
-
|
|
15
|
+
class="iconWrapper"
|
|
23
16
|
>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
<svg
|
|
18
|
+
height="16"
|
|
19
|
+
viewBox="0 0 16 16"
|
|
20
|
+
width="16"
|
|
21
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
+
>
|
|
23
|
+
<path
|
|
24
|
+
d="M8 1a7 7 0 110 14A7 7 0 018 1zm0 1a6 6 0 100 12A6 6 0 008 2zm.5 1.5v4.293l2.854 2.853-.708.708L7.5 8.207V3.5z"
|
|
25
|
+
fill="currentColor"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
27
28
|
</div>
|
|
28
29
|
<div
|
|
29
|
-
|
|
30
|
+
class="labelWrapper"
|
|
30
31
|
>
|
|
31
32
|
<span
|
|
32
|
-
|
|
33
|
+
class="labelText"
|
|
33
34
|
>
|
|
34
35
|
<span
|
|
35
36
|
data-dimensionid="pe"
|
|
@@ -37,47 +38,44 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
37
38
|
Period
|
|
38
39
|
</span>
|
|
39
40
|
</span>
|
|
40
|
-
<RecommendedIcon
|
|
41
|
-
dataTest="undefined-recommended-icon"
|
|
42
|
-
isRecommended={false}
|
|
43
|
-
/>
|
|
44
41
|
</div>
|
|
45
42
|
</div>
|
|
46
43
|
</li>
|
|
47
44
|
<style />
|
|
48
|
-
</
|
|
45
|
+
</div>
|
|
49
46
|
`;
|
|
50
47
|
|
|
51
48
|
exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
52
|
-
<
|
|
53
|
-
<CssVariables
|
|
54
|
-
colors={true}
|
|
55
|
-
/>
|
|
49
|
+
<div>
|
|
56
50
|
<li
|
|
57
|
-
|
|
51
|
+
class="item"
|
|
58
52
|
name="Period"
|
|
59
|
-
onClick={[Function]}
|
|
60
|
-
onMouseLeave={[Function]}
|
|
61
|
-
onMouseOver={[Function]}
|
|
62
|
-
style={Object {}}
|
|
63
53
|
>
|
|
64
54
|
<div
|
|
65
|
-
|
|
55
|
+
class="label"
|
|
66
56
|
data-test="undefined-button-pe"
|
|
67
|
-
|
|
57
|
+
tabindex="0"
|
|
68
58
|
>
|
|
69
59
|
<div
|
|
70
|
-
|
|
60
|
+
class="iconWrapper"
|
|
71
61
|
>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
<svg
|
|
63
|
+
height="16"
|
|
64
|
+
viewBox="0 0 16 16"
|
|
65
|
+
width="16"
|
|
66
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
+
>
|
|
68
|
+
<path
|
|
69
|
+
d="M8 1a7 7 0 110 14A7 7 0 018 1zm0 1a6 6 0 100 12A6 6 0 008 2zm.5 1.5v4.293l2.854 2.853-.708.708L7.5 8.207V3.5z"
|
|
70
|
+
fill="currentColor"
|
|
71
|
+
/>
|
|
72
|
+
</svg>
|
|
75
73
|
</div>
|
|
76
74
|
<div
|
|
77
|
-
|
|
75
|
+
class="labelWrapper"
|
|
78
76
|
>
|
|
79
77
|
<span
|
|
80
|
-
|
|
78
|
+
class="labelText"
|
|
81
79
|
>
|
|
82
80
|
<span
|
|
83
81
|
data-dimensionid="pe"
|
|
@@ -85,14 +83,10 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
85
83
|
Period
|
|
86
84
|
</span>
|
|
87
85
|
</span>
|
|
88
|
-
<RecommendedIcon
|
|
89
|
-
dataTest="undefined-recommended-icon"
|
|
90
|
-
isRecommended={false}
|
|
91
|
-
/>
|
|
92
86
|
</div>
|
|
93
87
|
</div>
|
|
94
88
|
<div
|
|
95
|
-
|
|
89
|
+
class="lockWrapper"
|
|
96
90
|
>
|
|
97
91
|
<svg
|
|
98
92
|
fill="none"
|
|
@@ -101,49 +95,50 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
101
95
|
xmlns="http://www.w3.org/2000/svg"
|
|
102
96
|
>
|
|
103
97
|
<path
|
|
104
|
-
|
|
98
|
+
clip-rule="evenodd"
|
|
105
99
|
d="M3.5 1A1.5 1.5 0 0 0 2 2.5V3h3v-.5A1.5 1.5 0 0 0 3.5 1ZM1 2.5V3H0v6h7V3H6v-.5a2.5 2.5 0 0 0-5 0ZM1 8V4h5v4H1Zm3-1V5H3v2h1Z"
|
|
106
100
|
fill="none"
|
|
107
|
-
|
|
101
|
+
fill-rule="evenodd"
|
|
108
102
|
/>
|
|
109
103
|
</svg>
|
|
110
104
|
</div>
|
|
111
105
|
<style />
|
|
112
106
|
</li>
|
|
113
107
|
<style />
|
|
114
|
-
</
|
|
108
|
+
</div>
|
|
115
109
|
`;
|
|
116
110
|
|
|
117
111
|
exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
118
|
-
<
|
|
119
|
-
<CssVariables
|
|
120
|
-
colors={true}
|
|
121
|
-
/>
|
|
112
|
+
<div>
|
|
122
113
|
<li
|
|
123
|
-
|
|
114
|
+
class="item"
|
|
124
115
|
name="Period"
|
|
125
|
-
onClick={[Function]}
|
|
126
|
-
onMouseLeave={[Function]}
|
|
127
|
-
onMouseOver={[Function]}
|
|
128
|
-
style={Object {}}
|
|
129
116
|
>
|
|
130
117
|
<div
|
|
131
|
-
|
|
118
|
+
class="label"
|
|
132
119
|
data-test="undefined-button-pe"
|
|
133
|
-
|
|
120
|
+
tabindex="0"
|
|
134
121
|
>
|
|
135
122
|
<div
|
|
136
|
-
|
|
123
|
+
class="iconWrapper"
|
|
137
124
|
>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
<svg
|
|
126
|
+
height="16"
|
|
127
|
+
viewBox="0 0 16 16"
|
|
128
|
+
width="16"
|
|
129
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
130
|
+
>
|
|
131
|
+
<path
|
|
132
|
+
d="M8 1a7 7 0 110 14A7 7 0 018 1zm0 1a6 6 0 100 12A6 6 0 008 2zm.5 1.5v4.293l2.854 2.853-.708.708L7.5 8.207V3.5z"
|
|
133
|
+
fill="currentColor"
|
|
134
|
+
/>
|
|
135
|
+
</svg>
|
|
141
136
|
</div>
|
|
142
137
|
<div
|
|
143
|
-
|
|
138
|
+
class="labelWrapper"
|
|
144
139
|
>
|
|
145
140
|
<span
|
|
146
|
-
|
|
141
|
+
class="labelText"
|
|
147
142
|
>
|
|
148
143
|
<span
|
|
149
144
|
data-dimensionid="pe"
|
|
@@ -151,51 +146,48 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
151
146
|
Period
|
|
152
147
|
</span>
|
|
153
148
|
</span>
|
|
154
|
-
<RecommendedIcon
|
|
155
|
-
dataTest="undefined-recommended-icon"
|
|
156
|
-
isRecommended={false}
|
|
157
|
-
/>
|
|
158
149
|
</div>
|
|
159
150
|
</div>
|
|
160
151
|
<div
|
|
161
|
-
|
|
152
|
+
class="optionsWrapper"
|
|
162
153
|
data-test="undefined-menu-pe"
|
|
163
154
|
/>
|
|
164
155
|
</li>
|
|
165
156
|
<style />
|
|
166
|
-
</
|
|
157
|
+
</div>
|
|
167
158
|
`;
|
|
168
159
|
|
|
169
160
|
exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
170
|
-
<
|
|
171
|
-
<CssVariables
|
|
172
|
-
colors={true}
|
|
173
|
-
/>
|
|
161
|
+
<div>
|
|
174
162
|
<li
|
|
175
|
-
|
|
163
|
+
class="item"
|
|
176
164
|
name="Period"
|
|
177
|
-
onClick={[Function]}
|
|
178
|
-
onMouseLeave={[Function]}
|
|
179
|
-
onMouseOver={[Function]}
|
|
180
|
-
style={Object {}}
|
|
181
165
|
>
|
|
182
166
|
<div
|
|
183
|
-
|
|
167
|
+
class="label"
|
|
184
168
|
data-test="undefined-button-pe"
|
|
185
|
-
|
|
169
|
+
tabindex="0"
|
|
186
170
|
>
|
|
187
171
|
<div
|
|
188
|
-
|
|
172
|
+
class="iconWrapper"
|
|
189
173
|
>
|
|
190
|
-
<
|
|
191
|
-
|
|
192
|
-
|
|
174
|
+
<svg
|
|
175
|
+
height="16"
|
|
176
|
+
viewBox="0 0 16 16"
|
|
177
|
+
width="16"
|
|
178
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
179
|
+
>
|
|
180
|
+
<path
|
|
181
|
+
d="M8 1a7 7 0 110 14A7 7 0 018 1zm0 1a6 6 0 100 12A6 6 0 008 2zm.5 1.5v4.293l2.854 2.853-.708.708L7.5 8.207V3.5z"
|
|
182
|
+
fill="currentColor"
|
|
183
|
+
/>
|
|
184
|
+
</svg>
|
|
193
185
|
</div>
|
|
194
186
|
<div
|
|
195
|
-
|
|
187
|
+
class="labelWrapper"
|
|
196
188
|
>
|
|
197
189
|
<span
|
|
198
|
-
|
|
190
|
+
class="labelText"
|
|
199
191
|
>
|
|
200
192
|
<span
|
|
201
193
|
data-dimensionid="pe"
|
|
@@ -203,47 +195,55 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
203
195
|
Period
|
|
204
196
|
</span>
|
|
205
197
|
</span>
|
|
206
|
-
<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
198
|
+
<span
|
|
199
|
+
aria-describedby=""
|
|
200
|
+
class="jsx-237564060"
|
|
201
|
+
data-test="dhis2-uicore-tooltip-reference"
|
|
202
|
+
tabindex="0"
|
|
203
|
+
>
|
|
204
|
+
<div
|
|
205
|
+
data-test="undefined-recommended-icon"
|
|
206
|
+
style="background-color: rgb(0, 150, 136); height: 6px; width: 6px; border-radius: 4px; margin-left: 6px; display: inline-block; cursor: pointer;"
|
|
207
|
+
/>
|
|
208
|
+
</span>
|
|
210
209
|
</div>
|
|
211
210
|
</div>
|
|
212
211
|
</li>
|
|
213
212
|
<style />
|
|
214
|
-
</
|
|
213
|
+
</div>
|
|
215
214
|
`;
|
|
216
215
|
|
|
217
216
|
exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
218
|
-
<
|
|
219
|
-
<CssVariables
|
|
220
|
-
colors={true}
|
|
221
|
-
/>
|
|
217
|
+
<div>
|
|
222
218
|
<li
|
|
223
|
-
|
|
219
|
+
class="item selected"
|
|
224
220
|
name="Period"
|
|
225
|
-
onClick={[Function]}
|
|
226
|
-
onMouseLeave={[Function]}
|
|
227
|
-
onMouseOver={[Function]}
|
|
228
|
-
style={Object {}}
|
|
229
221
|
>
|
|
230
222
|
<div
|
|
231
|
-
|
|
223
|
+
class="label"
|
|
232
224
|
data-test="undefined-button-pe"
|
|
233
|
-
|
|
225
|
+
tabindex="0"
|
|
234
226
|
>
|
|
235
227
|
<div
|
|
236
|
-
|
|
228
|
+
class="iconWrapper"
|
|
237
229
|
>
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
<svg
|
|
231
|
+
height="16"
|
|
232
|
+
viewBox="0 0 16 16"
|
|
233
|
+
width="16"
|
|
234
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
235
|
+
>
|
|
236
|
+
<path
|
|
237
|
+
d="M8 1a7 7 0 110 14A7 7 0 018 1zm0 1a6 6 0 100 12A6 6 0 008 2zm.5 1.5v4.293l2.854 2.853-.708.708L7.5 8.207V3.5z"
|
|
238
|
+
fill="currentColor"
|
|
239
|
+
/>
|
|
240
|
+
</svg>
|
|
241
241
|
</div>
|
|
242
242
|
<div
|
|
243
|
-
|
|
243
|
+
class="labelWrapper"
|
|
244
244
|
>
|
|
245
245
|
<span
|
|
246
|
-
|
|
246
|
+
class="labelText"
|
|
247
247
|
>
|
|
248
248
|
<span
|
|
249
249
|
data-dimensionid="pe"
|
|
@@ -251,13 +251,9 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
251
251
|
Period
|
|
252
252
|
</span>
|
|
253
253
|
</span>
|
|
254
|
-
<RecommendedIcon
|
|
255
|
-
dataTest="undefined-recommended-icon"
|
|
256
|
-
isRecommended={false}
|
|
257
|
-
/>
|
|
258
254
|
</div>
|
|
259
255
|
</div>
|
|
260
256
|
</li>
|
|
261
257
|
<style />
|
|
262
|
-
</
|
|
258
|
+
</div>
|
|
263
259
|
`;
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
5
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
5
6
|
var _DimensionsPanel = _interopRequireDefault(require("../DimensionsPanel.js"));
|
|
6
|
-
var _DimensionList = _interopRequireDefault(require("../List/DimensionList.js"));
|
|
7
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
const props = {
|
|
9
|
+
dimensions: [{
|
|
10
|
+
id: 'id1',
|
|
11
|
+
name: 'Dimension 1'
|
|
12
|
+
}, {
|
|
13
|
+
id: 'id2',
|
|
14
|
+
name: 'Dimension 2'
|
|
15
|
+
}]
|
|
16
|
+
};
|
|
17
|
+
test('DimensionsPanel renders a DimensionList component', () => {
|
|
18
|
+
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionsPanel.default, props));
|
|
19
|
+
const dimensionListComponent = _react.screen.getByTestId('dhis2-analytics-dimension-list');
|
|
20
|
+
expect(dimensionListComponent).toBeInTheDocument();
|
|
21
|
+
const liElements = _react.screen.getAllByTestId('dimension-item');
|
|
22
|
+
expect(liElements).toHaveLength(2);
|
|
23
|
+
const dim1Element = _react.screen.getByText(props.dimensions[0].name);
|
|
24
|
+
expect(dim1Element).toBeInTheDocument();
|
|
25
|
+
const dim2Element = _react.screen.getByText(props.dimensions[1].name);
|
|
26
|
+
expect(dim2Element).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
test('DimensionsPanel can filter the dimension list', async () => {
|
|
29
|
+
const user = _userEvent.default.setup();
|
|
30
|
+
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DimensionsPanel.default, props));
|
|
31
|
+
const filterComponent = _react.screen.getByPlaceholderText('Filter dimensions');
|
|
32
|
+
expect(filterComponent).toBeInTheDocument();
|
|
33
|
+
await user.click(filterComponent);
|
|
34
|
+
await user.keyboard('1');
|
|
35
|
+
const liElements = _react.screen.getAllByTestId('dimension-item');
|
|
36
|
+
expect(liElements).toHaveLength(1);
|
|
37
|
+
const dim1Element = _react.screen.getByText(props.dimensions[0].name);
|
|
38
|
+
expect(dim1Element).toBeInTheDocument();
|
|
39
|
+
const dim2Element = _react.screen.queryByText(props.dimensions[1].name);
|
|
40
|
+
expect(dim2Element).not.toBeInTheDocument();
|
|
38
41
|
});
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
5
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
6
6
|
var _DeleteDialog = require("../DeleteDialog.js");
|
|
7
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
describe('
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!shallowDeleteDialog) {
|
|
14
|
-
shallowDeleteDialog = (0, _enzyme.shallow)(/*#__PURE__*/_react.default.createElement(_DeleteDialog.DeleteDialog, props));
|
|
15
|
-
}
|
|
16
|
-
return shallowDeleteDialog;
|
|
8
|
+
describe('FileMenu - DeleteDialog component', () => {
|
|
9
|
+
const props = {
|
|
10
|
+
type: 'visualization',
|
|
11
|
+
id: 'delete-test',
|
|
12
|
+
onClose: jest.fn()
|
|
17
13
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
id: 'delete-test',
|
|
23
|
-
onClose
|
|
24
|
-
};
|
|
14
|
+
test('renders a Modal component', () => {
|
|
15
|
+
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DeleteDialog.DeleteDialog, props));
|
|
16
|
+
const modalComponent = _react.screen.getByTestId('file-menu-delete-modal');
|
|
17
|
+
expect(modalComponent).toBeInTheDocument();
|
|
25
18
|
});
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
test('renders a ModalTitle containing the type prop', () => {
|
|
20
|
+
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DeleteDialog.DeleteDialog, props));
|
|
21
|
+
const modalTitleComponent = _react.screen.getByText(`Delete ${props.type}`);
|
|
22
|
+
expect(modalTitleComponent).toBeInTheDocument();
|
|
28
23
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
test('calls the onClose callback when the Cancel button is clicked', async () => {
|
|
25
|
+
const user = _userEvent.default.setup();
|
|
26
|
+
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_DeleteDialog.DeleteDialog, props));
|
|
27
|
+
const cancelButton = _react.screen.getByRole('button', {
|
|
28
|
+
name: 'Cancel'
|
|
29
|
+
});
|
|
30
|
+
await user.click(cancelButton);
|
|
31
|
+
expect(props.onClose).toHaveBeenCalledTimes(1);
|
|
35
32
|
});
|
|
36
33
|
});
|