@dhis2/analytics 25.2.0 → 25.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4065 -0
- package/build/cjs/__demo__/FileMenu.stories.js +6 -8
- package/build/cjs/components/FileMenu/FileMenu.js +59 -21
- package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +194 -318
- package/build/cjs/components/Options/VisualizationOptions.js +1 -3
- package/build/cjs/index.js +46 -304
- package/build/cjs/locales/en/translations.json +0 -1
- package/build/cjs/locales/nl/translations.json +5 -4
- package/build/es/__demo__/FileMenu.stories.js +6 -7
- package/build/es/components/FileMenu/FileMenu.js +57 -20
- package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +189 -293
- package/build/es/components/Options/VisualizationOptions.js +1 -3
- package/build/es/index.js +0 -1
- package/build/es/locales/en/translations.json +0 -1
- package/build/es/locales/nl/translations.json +5 -4
- package/package.json +1 -3
- package/build/cjs/__demo__/Toolbar.stories.js +0 -77
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +0 -107
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +0 -66
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +0 -94
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +0 -99
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +0 -13
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +0 -219
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +0 -23
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +0 -56
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +0 -50
- package/build/cjs/components/Toolbar/HoverMenuBar/index.js +0 -37
- package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +0 -50
- package/build/cjs/components/Toolbar/MenuButton.styles.js +0 -13
- package/build/cjs/components/Toolbar/Toolbar.js +0 -39
- package/build/cjs/components/Toolbar/ToolbarSidebar.js +0 -45
- package/build/cjs/components/Toolbar/UpdateButton.js +0 -57
- package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +0 -50
- package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +0 -24
- package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +0 -30
- package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +0 -44
- package/build/cjs/components/Toolbar/index.js +0 -57
- package/build/es/__demo__/Toolbar.stories.js +0 -69
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuBar.js +0 -90
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +0 -44
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +0 -75
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +0 -78
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +0 -4
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +0 -168
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +0 -16
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +0 -49
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +0 -41
- package/build/es/components/Toolbar/HoverMenuBar/index.js +0 -4
- package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +0 -33
- package/build/es/components/Toolbar/MenuButton.styles.js +0 -4
- package/build/es/components/Toolbar/Toolbar.js +0 -24
- package/build/es/components/Toolbar/ToolbarSidebar.js +0 -29
- package/build/es/components/Toolbar/UpdateButton.js +0 -38
- package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +0 -43
- package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +0 -17
- package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +0 -23
- package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +0 -37
- package/build/es/components/Toolbar/index.js +0 -5
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _enzyme = require("enzyme");
|
|
4
|
-
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _index = require("../index.js");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
describe('<ToolbarSidebar/>', () => {
|
|
12
|
-
it('renders children', () => {
|
|
13
|
-
const childNode = 'text node';
|
|
14
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.ToolbarSidebar, null, childNode));
|
|
15
|
-
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
16
|
-
});
|
|
17
|
-
it('accepts a `dataTest` prop', () => {
|
|
18
|
-
const dataTest = 'test';
|
|
19
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.ToolbarSidebar, {
|
|
20
|
-
dataTest: dataTest
|
|
21
|
-
}));
|
|
22
|
-
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
23
|
-
});
|
|
24
|
-
it('accepts a `isHidden` prop', () => {
|
|
25
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.ToolbarSidebar, {
|
|
26
|
-
isHidden: true
|
|
27
|
-
}));
|
|
28
|
-
expect(wrapper.find('div').hasClass('isHidden')).toEqual(true);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _enzyme = require("enzyme");
|
|
4
|
-
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _index = require("../index.js");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
describe('<UpdateButton/>', () => {
|
|
12
|
-
const noop = () => {};
|
|
13
|
-
|
|
14
|
-
it('accepts an `onClick` prop', () => {
|
|
15
|
-
const onClick = jest.fn();
|
|
16
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
17
|
-
onClick: onClick
|
|
18
|
-
}));
|
|
19
|
-
wrapper.simulate('click');
|
|
20
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
21
|
-
});
|
|
22
|
-
it('accepts a `dataTest` prop', () => {
|
|
23
|
-
const dataTest = 'test';
|
|
24
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
25
|
-
onClick: noop,
|
|
26
|
-
dataTest: dataTest
|
|
27
|
-
}));
|
|
28
|
-
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
29
|
-
});
|
|
30
|
-
it('accepts a `disabled` prop', () => {
|
|
31
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
32
|
-
disabled: true,
|
|
33
|
-
onClick: noop
|
|
34
|
-
}));
|
|
35
|
-
expect(wrapper.find('button').prop('disabled')).toEqual(true);
|
|
36
|
-
});
|
|
37
|
-
it('accepts an `loading` prop', () => {
|
|
38
|
-
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
39
|
-
onClick: noop,
|
|
40
|
-
loading: true
|
|
41
|
-
}));
|
|
42
|
-
expect(wrapper.find('CircularLoader')).toHaveLength(1);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
InterpretationsAndDetailsToggler: true,
|
|
8
|
-
Toolbar: true,
|
|
9
|
-
ToolbarSidebar: true,
|
|
10
|
-
UpdateButton: true
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "InterpretationsAndDetailsToggler", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _InterpretationsAndDetailsToggler.InterpretationsAndDetailsToggler;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "Toolbar", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _Toolbar.Toolbar;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "ToolbarSidebar", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _ToolbarSidebar.ToolbarSidebar;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "UpdateButton", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _UpdateButton.UpdateButton;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
var _InterpretationsAndDetailsToggler = require("./InterpretationsAndDetailsToggler.js");
|
|
38
|
-
|
|
39
|
-
var _Toolbar = require("./Toolbar.js");
|
|
40
|
-
|
|
41
|
-
var _ToolbarSidebar = require("./ToolbarSidebar.js");
|
|
42
|
-
|
|
43
|
-
var _UpdateButton = require("./UpdateButton.js");
|
|
44
|
-
|
|
45
|
-
var _index = require("./HoverMenuBar/index.js");
|
|
46
|
-
|
|
47
|
-
Object.keys(_index).forEach(function (key) {
|
|
48
|
-
if (key === "default" || key === "__esModule") return;
|
|
49
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
51
|
-
Object.defineProperty(exports, key, {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () {
|
|
54
|
-
return _index[key];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from '@storybook/react';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { HoverMenuBar, HoverMenuDropdown, HoverMenuList, HoverMenuListItem, InterpretationsAndDetailsToggler, Toolbar, ToolbarSidebar, UpdateButton } from '../components/Toolbar/index.js';
|
|
4
|
-
|
|
5
|
-
function ToolbarWithState() {
|
|
6
|
-
const [isHidden, setIsHidden] = useState(false);
|
|
7
|
-
const [isSidebarShowing, setIsSidebarShowing] = useState(false);
|
|
8
|
-
return /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(ToolbarSidebar, {
|
|
9
|
-
isHidden: isHidden
|
|
10
|
-
}, /*#__PURE__*/React.createElement("span", null, "Toolbar side bar"), /*#__PURE__*/React.createElement("a", {
|
|
11
|
-
style: {
|
|
12
|
-
paddingLeft: 12,
|
|
13
|
-
textDecoration: 'underline',
|
|
14
|
-
cursor: 'pointer'
|
|
15
|
-
},
|
|
16
|
-
onClick: () => setIsHidden(true)
|
|
17
|
-
}, "click to hide")), /*#__PURE__*/React.createElement(UpdateButton, null), /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
18
|
-
label: "Menu A"
|
|
19
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
20
|
-
label: "Menu item A.1"
|
|
21
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
22
|
-
label: "Menu item A.2"
|
|
23
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
24
|
-
label: "Menu item A.3"
|
|
25
|
-
}))), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
26
|
-
label: "Menu B"
|
|
27
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
28
|
-
label: "Menu item B.1"
|
|
29
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
30
|
-
label: "Menu item B.1.1"
|
|
31
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
32
|
-
label: "Menu item B.1.2"
|
|
33
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
34
|
-
label: "Menu item B.1.3"
|
|
35
|
-
})), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
36
|
-
label: "Menu item B.2"
|
|
37
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
38
|
-
label: "Menu item B.2.1"
|
|
39
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
40
|
-
label: "Menu item B.2.2"
|
|
41
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
42
|
-
label: "Menu item B.2.3"
|
|
43
|
-
})), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
44
|
-
label: "Menu item B.3",
|
|
45
|
-
disabled: true
|
|
46
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
47
|
-
label: "Menu item B.3.1"
|
|
48
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
49
|
-
label: "Menu item B.3.2"
|
|
50
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
51
|
-
label: "Menu item B.3.3"
|
|
52
|
-
})))), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
53
|
-
label: "Menu C",
|
|
54
|
-
disabled: true
|
|
55
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
56
|
-
label: "Menu item C.1"
|
|
57
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
58
|
-
label: "Menu item C.2"
|
|
59
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
60
|
-
label: "Menu item C.3"
|
|
61
|
-
})))), /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
62
|
-
isShowing: isSidebarShowing,
|
|
63
|
-
onClick: () => setIsSidebarShowing(current => !current)
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
storiesOf('Toolbar', module).add('default', () => {
|
|
68
|
-
return /*#__PURE__*/React.createElement(ToolbarWithState, null);
|
|
69
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
|
4
|
-
|
|
5
|
-
const throwErrorIfNotInitialized = () => {
|
|
6
|
-
throw new Error('`HoverMenubarContext` has not been initialised');
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const HoverMenubarContext = /*#__PURE__*/createContext({
|
|
10
|
-
closeMenu: throwErrorIfNotInitialized,
|
|
11
|
-
onDropDownButtonClick: throwErrorIfNotInitialized,
|
|
12
|
-
onDropDownButtonMouseOver: throwErrorIfNotInitialized,
|
|
13
|
-
setLastHoveredSubMenuEl: throwErrorIfNotInitialized,
|
|
14
|
-
openedDropdownEl: null
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const useHoverMenubarContext = () => useContext(HoverMenubarContext);
|
|
18
|
-
|
|
19
|
-
const HoverMenuBar = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
children,
|
|
22
|
-
dataTest
|
|
23
|
-
} = _ref;
|
|
24
|
-
const [openedDropdownEl, setOpenedDropdownEl] = useState(null);
|
|
25
|
-
const [lastHoveredSubMenuEl, setLastHoveredSubMenuEl] = useState(null);
|
|
26
|
-
const [isInHoverMode, setIsInHoverMode] = useState(false);
|
|
27
|
-
const closeMenu = useCallback(() => {
|
|
28
|
-
setIsInHoverMode(false);
|
|
29
|
-
setOpenedDropdownEl(null);
|
|
30
|
-
}, []);
|
|
31
|
-
const onDocumentClick = useCallback(event => {
|
|
32
|
-
const isClickOnOpenedSubMenuAnchor = lastHoveredSubMenuEl && (lastHoveredSubMenuEl === event.target || lastHoveredSubMenuEl.contains(event.target));
|
|
33
|
-
|
|
34
|
-
if (!isClickOnOpenedSubMenuAnchor) {
|
|
35
|
-
closeMenu();
|
|
36
|
-
}
|
|
37
|
-
}, [closeMenu, lastHoveredSubMenuEl]);
|
|
38
|
-
const onDropDownButtonClick = useCallback(event => {
|
|
39
|
-
if (!isInHoverMode) {
|
|
40
|
-
setIsInHoverMode(true);
|
|
41
|
-
setOpenedDropdownEl(event.currentTarget);
|
|
42
|
-
} else {
|
|
43
|
-
closeMenu();
|
|
44
|
-
}
|
|
45
|
-
}, [closeMenu, isInHoverMode]);
|
|
46
|
-
const onDropDownButtonMouseOver = useCallback(event => {
|
|
47
|
-
if (isInHoverMode) {
|
|
48
|
-
setOpenedDropdownEl(event.currentTarget);
|
|
49
|
-
}
|
|
50
|
-
}, [isInHoverMode]);
|
|
51
|
-
const closeMenuWithEsc = useCallback(event => {
|
|
52
|
-
if (event.keyCode === 27) {
|
|
53
|
-
closeMenu();
|
|
54
|
-
}
|
|
55
|
-
}, [closeMenu]);
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (isInHoverMode) {
|
|
58
|
-
document.addEventListener('click', onDocumentClick, {
|
|
59
|
-
once: true
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return () => {
|
|
64
|
-
document.removeEventListener('click', onDocumentClick);
|
|
65
|
-
};
|
|
66
|
-
}, [onDocumentClick, isInHoverMode]);
|
|
67
|
-
return /*#__PURE__*/React.createElement(HoverMenubarContext.Provider, {
|
|
68
|
-
value: {
|
|
69
|
-
onDropDownButtonClick,
|
|
70
|
-
onDropDownButtonMouseOver,
|
|
71
|
-
openedDropdownEl,
|
|
72
|
-
setLastHoveredSubMenuEl
|
|
73
|
-
}
|
|
74
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
75
|
-
onKeyDown: closeMenuWithEsc,
|
|
76
|
-
"data-test": dataTest,
|
|
77
|
-
className: "jsx-3020154784"
|
|
78
|
-
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
79
|
-
id: "3020154784"
|
|
80
|
-
}, [".jsx-3020154784{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}"])));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
HoverMenuBar.defaultProps = {
|
|
84
|
-
dataTest: 'dhis2-analytics-hovermenubar'
|
|
85
|
-
};
|
|
86
|
-
HoverMenuBar.propTypes = {
|
|
87
|
-
children: PropTypes.node.isRequired,
|
|
88
|
-
dataTest: PropTypes.string
|
|
89
|
-
};
|
|
90
|
-
export { HoverMenuBar, useHoverMenubarContext };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { Popper } from '@dhis2-ui/popper';
|
|
3
|
-
import { Portal } from '@dhis2-ui/portal';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import React, { useRef } from 'react';
|
|
6
|
-
import menuButtonStyles from '../MenuButton.styles.js';
|
|
7
|
-
import { useHoverMenubarContext } from './HoverMenuBar.js';
|
|
8
|
-
export const HoverMenuDropdown = _ref => {
|
|
9
|
-
let {
|
|
10
|
-
children,
|
|
11
|
-
label,
|
|
12
|
-
dataTest,
|
|
13
|
-
disabled
|
|
14
|
-
} = _ref;
|
|
15
|
-
const buttonRef = useRef();
|
|
16
|
-
const {
|
|
17
|
-
onDropDownButtonClick,
|
|
18
|
-
onDropDownButtonMouseOver,
|
|
19
|
-
openedDropdownEl
|
|
20
|
-
} = useHoverMenubarContext();
|
|
21
|
-
const isOpen = openedDropdownEl === buttonRef.current;
|
|
22
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
23
|
-
ref: buttonRef,
|
|
24
|
-
onClick: onDropDownButtonClick,
|
|
25
|
-
disabled: disabled,
|
|
26
|
-
onMouseOver: disabled ? undefined : onDropDownButtonMouseOver,
|
|
27
|
-
"data-test": dataTest,
|
|
28
|
-
className: "jsx-".concat(menuButtonStyles.__hash)
|
|
29
|
-
}, label, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
30
|
-
id: menuButtonStyles.__hash
|
|
31
|
-
}, menuButtonStyles)), isOpen && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Popper, {
|
|
32
|
-
placement: "bottom-start",
|
|
33
|
-
reference: buttonRef
|
|
34
|
-
}, children)));
|
|
35
|
-
};
|
|
36
|
-
HoverMenuDropdown.defaultProps = {
|
|
37
|
-
dataTest: 'dhis2-analytics-hovermenudropdown'
|
|
38
|
-
};
|
|
39
|
-
HoverMenuDropdown.propTypes = {
|
|
40
|
-
children: PropTypes.node.isRequired,
|
|
41
|
-
label: PropTypes.node.isRequired,
|
|
42
|
-
dataTest: PropTypes.string,
|
|
43
|
-
disabled: PropTypes.bool
|
|
44
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { colors, elevations, spacers } from '@dhis2/ui-constants';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
5
|
-
import { useHoverMenubarContext } from './HoverMenuBar.js';
|
|
6
|
-
|
|
7
|
-
const throwErrorIfNotInitialized = () => {
|
|
8
|
-
throw new Error('`HoverMenuListContext` has not been initialised');
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const HoverMenuListContext = /*#__PURE__*/createContext({
|
|
12
|
-
onSubmenuAnchorMouseEnter: throwErrorIfNotInitialized,
|
|
13
|
-
onMenuItemMouseEnter: throwErrorIfNotInitialized,
|
|
14
|
-
openedSubMenuEl: null,
|
|
15
|
-
dense: false
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const useHoverMenuListContext = () => useContext(HoverMenuListContext);
|
|
19
|
-
|
|
20
|
-
const HoverMenuList = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
children,
|
|
23
|
-
className,
|
|
24
|
-
dataTest,
|
|
25
|
-
dense,
|
|
26
|
-
maxHeight,
|
|
27
|
-
maxWidth
|
|
28
|
-
} = _ref;
|
|
29
|
-
const {
|
|
30
|
-
setLastHoveredSubMenuEl
|
|
31
|
-
} = useHoverMenubarContext();
|
|
32
|
-
const [openedSubMenuEl, setOpenedSubMenuEl] = useState(null);
|
|
33
|
-
const onSubmenuAnchorMouseEnter = useCallback(event => {
|
|
34
|
-
if (openedSubMenuEl !== event.currentTarget) {
|
|
35
|
-
setOpenedSubMenuEl(event.currentTarget);
|
|
36
|
-
setLastHoveredSubMenuEl(event.currentTarget);
|
|
37
|
-
}
|
|
38
|
-
}, [openedSubMenuEl, setLastHoveredSubMenuEl]);
|
|
39
|
-
const onMenuItemMouseEnter = useCallback(() => {
|
|
40
|
-
setOpenedSubMenuEl(null);
|
|
41
|
-
setLastHoveredSubMenuEl(null);
|
|
42
|
-
}, [setLastHoveredSubMenuEl]);
|
|
43
|
-
return /*#__PURE__*/React.createElement(HoverMenuListContext.Provider, {
|
|
44
|
-
value: {
|
|
45
|
-
onSubmenuAnchorMouseEnter,
|
|
46
|
-
onMenuItemMouseEnter,
|
|
47
|
-
openedSubMenuEl,
|
|
48
|
-
dense
|
|
49
|
-
}
|
|
50
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
51
|
-
"data-test": dataTest,
|
|
52
|
-
className: _JSXStyle.dynamic([["3026610659", [colors.white, colors.grey200, elevations.e300, dense ? '128' : '180', maxWidth, maxHeight, spacers.dp4]]]) + " " + (className || "")
|
|
53
|
-
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
54
|
-
id: "3026610659",
|
|
55
|
-
dynamic: [colors.white, colors.grey200, elevations.e300, dense ? '128' : '180', maxWidth, maxHeight, spacers.dp4]
|
|
56
|
-
}, ["ul.__jsx-style-dynamic-selector{position:relative;margin:0;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:".concat(colors.white, ";border:1px solid ").concat(colors.grey200, ";border-radius:3px;box-shadow:").concat(elevations.e300, ";display:inline-block;min-width:").concat(dense ? '128' : '180', "px;max-width:").concat(maxWidth, ";max-height:").concat(maxHeight, ";padding:").concat(spacers.dp4, " 0;overflow:auto;list-style:none;}")])));
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
HoverMenuList.defaultProps = {
|
|
60
|
-
dataTest: 'dhis2-analytics-hovermenulist',
|
|
61
|
-
maxWidth: '380px',
|
|
62
|
-
maxHeight: 'auto'
|
|
63
|
-
};
|
|
64
|
-
HoverMenuList.propTypes = {
|
|
65
|
-
/** Typically `MenuItem`, `MenuDivider`, and `MenuSectionHeader` */
|
|
66
|
-
children: PropTypes.node,
|
|
67
|
-
className: PropTypes.string,
|
|
68
|
-
dataTest: PropTypes.string,
|
|
69
|
-
|
|
70
|
-
/** Gives all HoverMenuListItem children a dense style */
|
|
71
|
-
dense: PropTypes.bool,
|
|
72
|
-
maxHeight: PropTypes.string,
|
|
73
|
-
maxWidth: PropTypes.string
|
|
74
|
-
};
|
|
75
|
-
export { HoverMenuList, useHoverMenuListContext };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { Popper } from '@dhis2-ui/popper';
|
|
3
|
-
import { Portal } from '@dhis2-ui/portal';
|
|
4
|
-
import { IconChevronRight24 } from '@dhis2/ui-icons';
|
|
5
|
-
import cx from 'classnames';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React, { useRef } from 'react';
|
|
8
|
-
import { HoverMenuList, useHoverMenuListContext } from './HoverMenuList.js';
|
|
9
|
-
import styles from './HoverMenuListItem.styles.js';
|
|
10
|
-
|
|
11
|
-
const HoverMenuListItem = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
onClick,
|
|
14
|
-
children,
|
|
15
|
-
icon,
|
|
16
|
-
className,
|
|
17
|
-
destructive,
|
|
18
|
-
disabled,
|
|
19
|
-
dataTest,
|
|
20
|
-
label
|
|
21
|
-
} = _ref;
|
|
22
|
-
const ref = useRef();
|
|
23
|
-
const {
|
|
24
|
-
onSubmenuAnchorMouseEnter,
|
|
25
|
-
onMenuItemMouseEnter,
|
|
26
|
-
openedSubMenuEl,
|
|
27
|
-
dense
|
|
28
|
-
} = useHoverMenuListContext();
|
|
29
|
-
const isSubMenuOpen = openedSubMenuEl === ref.current;
|
|
30
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("li", {
|
|
31
|
-
ref: ref,
|
|
32
|
-
"data-test": dataTest,
|
|
33
|
-
onClick: !disabled && !children && onClick ? onClick : undefined,
|
|
34
|
-
onMouseEnter: disabled ? undefined : children ? onSubmenuAnchorMouseEnter : onMenuItemMouseEnter,
|
|
35
|
-
className: "jsx-".concat(styles.__hash) + " " + (cx(className, {
|
|
36
|
-
destructive,
|
|
37
|
-
disabled,
|
|
38
|
-
dense,
|
|
39
|
-
active: isSubMenuOpen,
|
|
40
|
-
'with-chevron': children
|
|
41
|
-
}) || "")
|
|
42
|
-
}, icon && /*#__PURE__*/React.createElement("span", {
|
|
43
|
-
className: "jsx-".concat(styles.__hash) + " " + "icon"
|
|
44
|
-
}, icon), /*#__PURE__*/React.createElement("span", {
|
|
45
|
-
className: "jsx-".concat(styles.__hash) + " " + "label"
|
|
46
|
-
}, label), !!children && /*#__PURE__*/React.createElement("span", {
|
|
47
|
-
className: "jsx-".concat(styles.__hash) + " " + "chevron"
|
|
48
|
-
}, /*#__PURE__*/React.createElement(IconChevronRight24, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
49
|
-
id: styles.__hash
|
|
50
|
-
}, styles)), children && isSubMenuOpen && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Popper, {
|
|
51
|
-
placement: "right-start",
|
|
52
|
-
reference: ref
|
|
53
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, {
|
|
54
|
-
dense: dense
|
|
55
|
-
}, children))));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
HoverMenuListItem.defaultProps = {
|
|
59
|
-
dataTest: 'dhis2-uicore-hovermenulistitem'
|
|
60
|
-
};
|
|
61
|
-
HoverMenuListItem.propTypes = {
|
|
62
|
-
// Nested menu items become submenus
|
|
63
|
-
children: PropTypes.node,
|
|
64
|
-
className: PropTypes.string,
|
|
65
|
-
dataTest: PropTypes.string,
|
|
66
|
-
destructive: PropTypes.bool,
|
|
67
|
-
disabled: PropTypes.bool,
|
|
68
|
-
|
|
69
|
-
/** An icon for the left side of the menu item */
|
|
70
|
-
icon: PropTypes.node,
|
|
71
|
-
|
|
72
|
-
/** Text in the menu item */
|
|
73
|
-
label: PropTypes.node,
|
|
74
|
-
|
|
75
|
-
/** Click handler */
|
|
76
|
-
onClick: PropTypes.func
|
|
77
|
-
};
|
|
78
|
-
export { HoverMenuListItem };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { colors, spacers } from '@dhis2/ui-constants';
|
|
2
|
-
const _defaultExport = ["li.jsx-1056713124{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0px ".concat(spacers.dp24, ";cursor:pointer;list-style:none;background-color:").concat(colors.white, ";color:").concat(colors.grey900, ";fill:").concat(colors.grey900, ";font-size:14px;line-height:16px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"), "li.jsx-1056713124:hover{background-color:".concat(colors.grey200, ";}"), "li.jsx-1056713124:active,li.active.jsx-1056713124{background-color:".concat(colors.grey300, ";}"), "li.destructive.jsx-1056713124{color:".concat(colors.red700, ";fill:").concat(colors.red600, ";}"), "li.destructive.jsx-1056713124:hover{background-color:".concat(colors.red050, ";}"), "li.destructive.jsx-1056713124:active,li.destructive.active.jsx-1056713124{background-color:".concat(colors.red100, ";}"), "li.disabled.jsx-1056713124{cursor:not-allowed;color:".concat(colors.grey500, ";fill:").concat(colors.grey500, ";}"), "li.disabled.jsx-1056713124:hover{background-color:".concat(colors.white, ";}"), ".label.jsx-1056713124{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:".concat(spacers.dp12, " 0;}"), "li.dense.jsx-1056713124 .label.jsx-1056713124{padding:".concat(spacers.dp8, " 0;}"), ".icon.jsx-1056713124{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-right:".concat(spacers.dp12, ";width:24px;height:24px;}"), ".chevron.jsx-1056713124{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-left:".concat(spacers.dp24, ";}"), "li.dense.jsx-1056713124 .icon.jsx-1056713124{margin-right:".concat(spacers.dp8, ";width:16px;height:16px;}"), "li.jsx-1056713124 .icon.jsx-1056713124>svg{width:24px;height:24px;}", "li.dense.jsx-1056713124 .icon.jsx-1056713124>svg,li.jsx-1056713124 .chevron.jsx-1056713124>svg{width:16px;height:16px;}"];
|
|
3
|
-
_defaultExport.__hash = "1056713124";
|
|
4
|
-
export default _defaultExport;
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { render, fireEvent, screen } from '@testing-library/react';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { HoverMenuBar, HoverMenuDropdown, HoverMenuList, HoverMenuListItem } from '../index.js';
|
|
6
|
-
describe('<HoverMenuBar/>', () => {
|
|
7
|
-
it('renders children', () => {
|
|
8
|
-
const childNode = 'text node';
|
|
9
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuBar, null, childNode));
|
|
10
|
-
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
it('accepts a `dataTest` prop', () => {
|
|
13
|
-
const dataTest = 'test';
|
|
14
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuBar, {
|
|
15
|
-
dataTest: dataTest
|
|
16
|
-
}, "children"));
|
|
17
|
-
expect(wrapper.find('div').prop('data-test')).toBe(dataTest);
|
|
18
|
-
});
|
|
19
|
-
describe('mouse interactions', () => {
|
|
20
|
-
it('does not open on hover before a dropdown anchor is clicked', async () => {
|
|
21
|
-
createFullMenuBarWrapper();
|
|
22
|
-
fireEvent.mouseOver(screen.getByText('Menu A'));
|
|
23
|
-
await expectMenuItemsInDocument([['Menu item A.1', false], ['Menu item A.2', false], ['Menu item A.3', false]]);
|
|
24
|
-
});
|
|
25
|
-
it('does not open when a disabled dropdown anchor is clicked', async () => {
|
|
26
|
-
createFullMenuBarWrapper();
|
|
27
|
-
fireEvent.click(screen.getByText('Menu C'));
|
|
28
|
-
await expectMenuItemsInDocument([['Menu item A.1', false], ['Menu item A.2', false], ['Menu item A.3', false]]);
|
|
29
|
-
});
|
|
30
|
-
it('opens menu list when clicked', async () => {
|
|
31
|
-
createFullMenuBarWrapper();
|
|
32
|
-
fireEvent.click(screen.getByText('Menu A'));
|
|
33
|
-
await expectMenuItemsInDocument([['Menu item A.1', true], ['Menu item B.1', false], ['Menu item C.1', false]]);
|
|
34
|
-
});
|
|
35
|
-
it('responds to hover once open', async () => {
|
|
36
|
-
createFullMenuBarWrapper();
|
|
37
|
-
fireEvent.click(screen.getByText('Menu A'));
|
|
38
|
-
fireEvent.mouseOver(screen.getByText('Menu B'));
|
|
39
|
-
await expectMenuItemsInDocument([['Menu item A.1', false], ['Menu item B.1', true], ['Menu item C.1', false]]);
|
|
40
|
-
});
|
|
41
|
-
it('does not open disabled dropdown on hover in hover mode', async () => {
|
|
42
|
-
createFullMenuBarWrapper();
|
|
43
|
-
fireEvent.click(screen.getByText('Menu B'));
|
|
44
|
-
fireEvent.mouseOver(screen.getByText('Menu C'));
|
|
45
|
-
await expectMenuItemsInDocument([['Menu item B.1', true], ['Menu item C.1', false]]);
|
|
46
|
-
});
|
|
47
|
-
it('opens submenus when in hover mode', async () => {
|
|
48
|
-
createFullMenuBarWrapper();
|
|
49
|
-
fireEvent.click(screen.getByText('Menu B'));
|
|
50
|
-
fireEvent.mouseOver(screen.getByText('Menu item B.1'));
|
|
51
|
-
await expectMenuItemsInDocument([['Menu item B.1.1', true], ['Menu item B.1.2', true], ['Menu item B.1.3', true], ['Menu item B.2.1', false], ['Menu item B.2.2', false], ['Menu item B.2.3', false]]);
|
|
52
|
-
fireEvent.mouseOver(screen.getByText('Menu item B.2'));
|
|
53
|
-
await expectMenuItemsInDocument([['Menu item B.1.1', false], ['Menu item B.1.2', false], ['Menu item B.1.3', false], ['Menu item B.2.1', true], ['Menu item B.2.2', true], ['Menu item B.2.3', true]]);
|
|
54
|
-
});
|
|
55
|
-
it('does not open disabled submenus when in hover mode', async () => {
|
|
56
|
-
createFullMenuBarWrapper();
|
|
57
|
-
fireEvent.click(screen.getByText('Menu B'));
|
|
58
|
-
fireEvent.mouseOver(screen.getByText('Menu item B.2'));
|
|
59
|
-
await expectMenuItemsInDocument([['Menu item B.2.1', true], ['Menu item B.2.2', true], ['Menu item B.2.3', true], ['Menu item B.3.1', false], ['Menu item B.3.2', false], ['Menu item B.3.3', false]]);
|
|
60
|
-
fireEvent.mouseOver(screen.getByText('Menu item B.3'));
|
|
61
|
-
await expectMenuItemsInDocument([['Menu item B.2.1', true], ['Menu item B.2.2', true], ['Menu item B.2.3', true], ['Menu item B.3.1', false], ['Menu item B.3.2', false], ['Menu item B.3.3', false]]);
|
|
62
|
-
});
|
|
63
|
-
it('closes when clicking on then document', async () => {
|
|
64
|
-
createFullMenuBarWrapper();
|
|
65
|
-
fireEvent.click(screen.getByText('Menu A'));
|
|
66
|
-
await expectMenuItemsInDocument([['Menu item A.1', true]]);
|
|
67
|
-
fireEvent.click(document);
|
|
68
|
-
await expectMenuItemsInDocument([['Menu item A.1', false]]);
|
|
69
|
-
});
|
|
70
|
-
it('stays open when clicking a open submenu anchor', async () => {
|
|
71
|
-
createFullMenuBarWrapper();
|
|
72
|
-
fireEvent.click(screen.getByText('Menu B'));
|
|
73
|
-
await expectMenuItemsInDocument([['Menu item B.1', true]]);
|
|
74
|
-
fireEvent.mouseOver(screen.getByText('Menu item B.1'));
|
|
75
|
-
await expectMenuItemsInDocument([['Menu item B.1', true], ['Menu item B.1.1', true], ['Menu item B.1.2', true], ['Menu item B.1.3', true]]);
|
|
76
|
-
fireEvent.click(screen.getByText('Menu item B.1'));
|
|
77
|
-
await expectMenuItemsInDocument([['Menu item B.1', true], ['Menu item B.1.1', true], ['Menu item B.1.2', true], ['Menu item B.1.3', true]]);
|
|
78
|
-
});
|
|
79
|
-
it('calls the onClick of the menu item and closes when clicking a menu item', async () => {
|
|
80
|
-
const menuItemOnClickSpy = jest.fn();
|
|
81
|
-
createFullMenuBarWrapper({
|
|
82
|
-
menuItemOnClickSpy
|
|
83
|
-
});
|
|
84
|
-
fireEvent.click(screen.getByText('Menu A'));
|
|
85
|
-
await expectMenuItemsInDocument([['Menu item A.1', true]]);
|
|
86
|
-
fireEvent.click(screen.getByText('Menu item A.1'));
|
|
87
|
-
expect(menuItemOnClickSpy).toHaveBeenCalledTimes(1);
|
|
88
|
-
await expectMenuItemsInDocument([['Menu item A.1', false]]);
|
|
89
|
-
});
|
|
90
|
-
it('calls the onClick of the menu item and closes when clicking a submenu item', async () => {
|
|
91
|
-
const subMenuItemOnClickSpy = jest.fn();
|
|
92
|
-
createFullMenuBarWrapper({
|
|
93
|
-
subMenuItemOnClickSpy
|
|
94
|
-
});
|
|
95
|
-
fireEvent.click(screen.getByText('Menu B'));
|
|
96
|
-
await expectMenuItemsInDocument([['Menu item B.1', true]]);
|
|
97
|
-
fireEvent.mouseOver(screen.getByText('Menu item B.1'));
|
|
98
|
-
await expectMenuItemsInDocument([['Menu item B.1.1', true]]);
|
|
99
|
-
fireEvent.click(screen.getByText('Menu item B.1.1'));
|
|
100
|
-
expect(subMenuItemOnClickSpy).toHaveBeenCalledTimes(1);
|
|
101
|
-
await expectMenuItemsInDocument([['Menu item B.1', false], ['Menu item B.1.1', false], ['Menu item B.1.1', false]]);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
function createFullMenuBarWrapper() {
|
|
107
|
-
let {
|
|
108
|
-
menuItemOnClickSpy,
|
|
109
|
-
subMenuItemOnClickSpy
|
|
110
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
111
|
-
return render( /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
112
|
-
label: "Menu A"
|
|
113
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
114
|
-
label: "Menu item A.1",
|
|
115
|
-
onClick: menuItemOnClickSpy
|
|
116
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
117
|
-
label: "Menu item A.2"
|
|
118
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
119
|
-
label: "Menu item A.3"
|
|
120
|
-
}))), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
121
|
-
label: "Menu B"
|
|
122
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
123
|
-
label: "Menu item B.1"
|
|
124
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
125
|
-
label: "Menu item B.1.1",
|
|
126
|
-
onClick: subMenuItemOnClickSpy
|
|
127
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
128
|
-
label: "Menu item B.1.2"
|
|
129
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
130
|
-
label: "Menu item B.1.3"
|
|
131
|
-
})), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
132
|
-
label: "Menu item B.2"
|
|
133
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
134
|
-
label: "Menu item B.2.1"
|
|
135
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
136
|
-
label: "Menu item B.2.2"
|
|
137
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
138
|
-
label: "Menu item B.2.3"
|
|
139
|
-
})), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
140
|
-
label: "Menu item B.3",
|
|
141
|
-
disabled: true
|
|
142
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
143
|
-
label: "Menu item B.3.1"
|
|
144
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
145
|
-
label: "Menu item B.3.2"
|
|
146
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
147
|
-
label: "Menu item B.3.3"
|
|
148
|
-
})))), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
149
|
-
label: "Menu C",
|
|
150
|
-
disabled: true
|
|
151
|
-
}, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
152
|
-
label: "Menu item C.1"
|
|
153
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
154
|
-
label: "Menu item C.2"
|
|
155
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
156
|
-
label: "Menu item C.3"
|
|
157
|
-
})))));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
async function expectMenuItemsInDocument(items) {
|
|
161
|
-
for (const [text, inDocument] of items) {
|
|
162
|
-
if (inDocument) {
|
|
163
|
-
expect(await screen.findByText(text)).toBeInTheDocument();
|
|
164
|
-
} else {
|
|
165
|
-
expect(screen.queryByText(text)).not.toBeInTheDocument();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|