@dhis2/analytics 25.2.1 → 25.2.3
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 +4072 -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/modules/ouLevelUtils/index.js +5 -3
- 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/modules/ouLevelUtils/index.js +5 -3
- 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,16 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { HoverMenuDropdown } from '../index.js';
|
|
4
|
-
describe('<HoverMenuDropdown/>', () => {
|
|
5
|
-
/* Most of the props for this component are included
|
|
6
|
-
* in the mouse interaction tests for the HoverMenuBar.
|
|
7
|
-
* Only the `dataTest` prop needs to be verified here. */
|
|
8
|
-
it('accepts a `dataTest` prop', () => {
|
|
9
|
-
const dataTest = 'test';
|
|
10
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuDropdown, {
|
|
11
|
-
label: "test dropdown",
|
|
12
|
-
dataTest: dataTest
|
|
13
|
-
}, "children"));
|
|
14
|
-
expect(wrapper.find('button').prop('data-test')).toBe(dataTest);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { shallow, mount } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { HoverMenuList, HoverMenuListItem } from '../index.js';
|
|
4
|
-
describe('<HoverMenuList/>', () => {
|
|
5
|
-
const dataTest = 'test';
|
|
6
|
-
const childNode = 'children';
|
|
7
|
-
it('renders children', () => {
|
|
8
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuList, null, childNode));
|
|
9
|
-
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
it('accept a `className` prop', () => {
|
|
12
|
-
const className = 'className';
|
|
13
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuList, {
|
|
14
|
-
className: className
|
|
15
|
-
}, childNode));
|
|
16
|
-
expect(wrapper.find('ul')).toHaveClassName(className);
|
|
17
|
-
});
|
|
18
|
-
it('accepts a `dataTest` prop', () => {
|
|
19
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuList, {
|
|
20
|
-
dataTest: dataTest
|
|
21
|
-
}, childNode));
|
|
22
|
-
expect(wrapper.find('ul').prop('data-test')).toBe(dataTest);
|
|
23
|
-
});
|
|
24
|
-
it('accept a `dense` prop', () => {
|
|
25
|
-
const wrapper = mount( /*#__PURE__*/React.createElement(HoverMenuList, {
|
|
26
|
-
dense: true
|
|
27
|
-
}, /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
28
|
-
label: "item 1"
|
|
29
|
-
}), /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
30
|
-
label: "item 2"
|
|
31
|
-
})));
|
|
32
|
-
expect(wrapper.find('li').first()).toHaveClassName('dense');
|
|
33
|
-
expect(wrapper.find('li').last()).toHaveClassName('dense');
|
|
34
|
-
});
|
|
35
|
-
it('accept a `maxHeight` prop', () => {
|
|
36
|
-
const maxHeight = '100000px';
|
|
37
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuList, {
|
|
38
|
-
maxHeight: maxHeight
|
|
39
|
-
}, childNode));
|
|
40
|
-
expect(wrapper.find('style').text()).toContain("max-height: ".concat(maxHeight));
|
|
41
|
-
});
|
|
42
|
-
it('accept a `maxWidth` prop', () => {
|
|
43
|
-
const maxWidth = '100000px';
|
|
44
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuList, {
|
|
45
|
-
maxWidth: maxWidth
|
|
46
|
-
}, childNode));
|
|
47
|
-
expect(wrapper.find('style').text()).toContain("max-width: ".concat(maxWidth));
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { HoverMenuListItem } from '../index.js';
|
|
4
|
-
describe('<HoverMenuListItem/>', () => {
|
|
5
|
-
/* Some of the props for this component are included
|
|
6
|
-
* in the mouse interaction tests for the HoverMenuBar.
|
|
7
|
-
* Only the `className`, `dataTest`, `destructive` and
|
|
8
|
-
* `icon` prop need to be verified here. */
|
|
9
|
-
it('accepts a `className` prop', () => {
|
|
10
|
-
const className = 'className';
|
|
11
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
12
|
-
className: className
|
|
13
|
-
}));
|
|
14
|
-
expect(wrapper.find('li')).toHaveClassName(className);
|
|
15
|
-
});
|
|
16
|
-
it('accepts a `dataTest` prop', () => {
|
|
17
|
-
const dataTest = 'test';
|
|
18
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
19
|
-
dataTest: dataTest
|
|
20
|
-
}));
|
|
21
|
-
expect(wrapper.find('li').prop('data-test')).toBe(dataTest);
|
|
22
|
-
});
|
|
23
|
-
it('accepts a `destructive` prop', () => {
|
|
24
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
25
|
-
destructive: true
|
|
26
|
-
}));
|
|
27
|
-
expect(wrapper.find('li')).toHaveClassName('destructive');
|
|
28
|
-
});
|
|
29
|
-
it('accepts an `icon` prop', () => {
|
|
30
|
-
const iconText = 'I am an icon';
|
|
31
|
-
const icon = /*#__PURE__*/React.createElement("span", {
|
|
32
|
-
id: "testicon"
|
|
33
|
-
}, iconText);
|
|
34
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(HoverMenuListItem, {
|
|
35
|
-
icon: icon
|
|
36
|
-
}));
|
|
37
|
-
expect(wrapper.find('span.icon')).toExist();
|
|
38
|
-
expect(wrapper.find('span#testicon')).toExist();
|
|
39
|
-
expect(wrapper.find('span#testicon').text()).toBe(iconText);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import i18n from '@dhis2/d2-i18n';
|
|
3
|
-
import { IconChevronRight24, IconChevronLeft24 } from '@dhis2/ui';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import menuButtonStyles from './MenuButton.styles.js';
|
|
7
|
-
export const InterpretationsAndDetailsToggler = _ref => {
|
|
8
|
-
let {
|
|
9
|
-
onClick,
|
|
10
|
-
dataTest,
|
|
11
|
-
disabled,
|
|
12
|
-
isShowing
|
|
13
|
-
} = _ref;
|
|
14
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
15
|
-
onClick: onClick,
|
|
16
|
-
disabled: disabled,
|
|
17
|
-
"data-test": dataTest,
|
|
18
|
-
className: "jsx-1238484262 " + "jsx-".concat(menuButtonStyles.__hash)
|
|
19
|
-
}, isShowing ? /*#__PURE__*/React.createElement(IconChevronRight24, null) : /*#__PURE__*/React.createElement(IconChevronLeft24, null), i18n.t('Interpretations and details'), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
|
-
id: menuButtonStyles.__hash
|
|
21
|
-
}, menuButtonStyles), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
22
|
-
id: "1238484262"
|
|
23
|
-
}, ["button.jsx-1238484262{gap:8px;}"]));
|
|
24
|
-
};
|
|
25
|
-
InterpretationsAndDetailsToggler.defaultProps = {
|
|
26
|
-
dataTest: 'dhis2-analytics-interpretationsanddetailstoggler'
|
|
27
|
-
};
|
|
28
|
-
InterpretationsAndDetailsToggler.propTypes = {
|
|
29
|
-
onClick: PropTypes.func.isRequired,
|
|
30
|
-
dataTest: PropTypes.string,
|
|
31
|
-
disabled: PropTypes.bool,
|
|
32
|
-
isShowing: PropTypes.bool
|
|
33
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
2
|
-
const _defaultExport = ["button.jsx-4266781296{all:unset;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-size:14px;line-height:14px;padding:0 ".concat(spacers.dp12, ";color:").concat(colors.grey900, ";-webkit-transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;cursor:pointer;}"), "button.jsx-4266781296:hover.jsx-4266781296:enabled,button.jsx-4266781296:active{background-color:".concat(colors.grey200, ";}"), "button.jsx-4266781296:focus{outline:3px solid ".concat(theme.focus, ";outline-offset:-3px;}"), "button.jsx-4266781296:focus.jsx-4266781296:not(:focus-visible){outline:none;}", "button.jsx-4266781296:disabled{color:".concat(colors.grey500, ";cursor:not-allowed;}")];
|
|
3
|
-
_defaultExport.__hash = "4266781296";
|
|
4
|
-
export default _defaultExport;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { colors } from '@dhis2/ui-constants';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
export const Toolbar = _ref => {
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
dataTest
|
|
9
|
-
} = _ref;
|
|
10
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
-
"data-test": dataTest,
|
|
12
|
-
className: _JSXStyle.dynamic([["2617706539", [colors.grey400, colors.white]]])
|
|
13
|
-
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
14
|
-
id: "2617706539",
|
|
15
|
-
dynamic: [colors.grey400, colors.white]
|
|
16
|
-
}, ["div.__jsx-style-dynamic-selector{box-sizing:border-box;min-height:32px;max-height:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-bottom:1px solid ".concat(colors.grey400, ";background-color:").concat(colors.white, ";}")]));
|
|
17
|
-
};
|
|
18
|
-
Toolbar.defaultProps = {
|
|
19
|
-
dataTest: 'dhis2-analytics-toolbar'
|
|
20
|
-
};
|
|
21
|
-
Toolbar.propTypes = {
|
|
22
|
-
children: PropTypes.node,
|
|
23
|
-
dataTest: PropTypes.string
|
|
24
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { colors } from '@dhis2/ui-constants';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
export const ToolbarSidebar = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
children,
|
|
9
|
-
dataTest,
|
|
10
|
-
isHidden
|
|
11
|
-
} = _ref;
|
|
12
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
-
"data-test": dataTest,
|
|
14
|
-
className: _JSXStyle.dynamic([["1150014343", [colors.grey400]]]) + " " + (cx('container', {
|
|
15
|
-
isHidden
|
|
16
|
-
}) || "")
|
|
17
|
-
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
18
|
-
id: "1150014343",
|
|
19
|
-
dynamic: [colors.grey400]
|
|
20
|
-
}, ["div.__jsx-style-dynamic-selector{width:260px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-right:1px solid ".concat(colors.grey400, ";}"), "div.isHidden.__jsx-style-dynamic-selector{display:none;}"]));
|
|
21
|
-
};
|
|
22
|
-
ToolbarSidebar.defaultProps = {
|
|
23
|
-
dataTest: 'dhis2-analytics-toolbarsidebar'
|
|
24
|
-
};
|
|
25
|
-
ToolbarSidebar.propTypes = {
|
|
26
|
-
children: PropTypes.node,
|
|
27
|
-
dataTest: PropTypes.string,
|
|
28
|
-
isHidden: PropTypes.bool
|
|
29
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { CircularLoader } from '@dhis2-ui/loader';
|
|
3
|
-
import i18n from '@dhis2/d2-i18n';
|
|
4
|
-
import { colors } from '@dhis2/ui-constants';
|
|
5
|
-
import { IconSync16 } from '@dhis2/ui-icons';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import menuButtonStyles from './MenuButton.styles.js';
|
|
9
|
-
export const UpdateButton = _ref => {
|
|
10
|
-
let {
|
|
11
|
-
onClick,
|
|
12
|
-
disabled,
|
|
13
|
-
loading,
|
|
14
|
-
dataTest
|
|
15
|
-
} = _ref;
|
|
16
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
17
|
-
onClick: onClick,
|
|
18
|
-
disabled: disabled,
|
|
19
|
-
"data-test": dataTest,
|
|
20
|
-
className: "jsx-".concat(menuButtonStyles.__hash) + " " + _JSXStyle.dynamic([["2364287882", [colors.blue700, colors.blue100, colors.blue200]]])
|
|
21
|
-
}, loading ? /*#__PURE__*/React.createElement(CircularLoader, {
|
|
22
|
-
extrasmall: true
|
|
23
|
-
}) : /*#__PURE__*/React.createElement(IconSync16, null), i18n.t('Update'), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
|
-
id: menuButtonStyles.__hash
|
|
25
|
-
}, menuButtonStyles), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
26
|
-
id: "2364287882",
|
|
27
|
-
dynamic: [colors.blue700, colors.blue100, colors.blue200]
|
|
28
|
-
}, ["button.__jsx-style-dynamic-selector{gap:8px;color:".concat(colors.blue700, ";font-weight:500;}"), "button.__jsx-style-dynamic-selector:hover.__jsx-style-dynamic-selector:enabled{background:".concat(colors.blue100, ";}"), "button.__jsx-style-dynamic-selector:active{background:".concat(colors.blue200, ";}")]));
|
|
29
|
-
};
|
|
30
|
-
UpdateButton.defaultProps = {
|
|
31
|
-
dataTest: 'dhis2-analytics-updatebutton'
|
|
32
|
-
};
|
|
33
|
-
UpdateButton.propTypes = {
|
|
34
|
-
onClick: PropTypes.func.isRequired,
|
|
35
|
-
dataTest: PropTypes.string,
|
|
36
|
-
disabled: PropTypes.bool,
|
|
37
|
-
loading: PropTypes.bool
|
|
38
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { InterpretationsAndDetailsToggler } from '../index.js';
|
|
4
|
-
describe('<InterpretationsAndDetailsToggler/>', () => {
|
|
5
|
-
const noop = () => {};
|
|
6
|
-
|
|
7
|
-
it('accepts an `onClick` prop', () => {
|
|
8
|
-
const onClick = jest.fn();
|
|
9
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
10
|
-
onClick: onClick
|
|
11
|
-
}));
|
|
12
|
-
wrapper.simulate('click');
|
|
13
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
14
|
-
});
|
|
15
|
-
it('accepts a `dataTest` prop', () => {
|
|
16
|
-
const dataTest = 'test';
|
|
17
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
18
|
-
onClick: noop,
|
|
19
|
-
dataTest: dataTest
|
|
20
|
-
}));
|
|
21
|
-
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
22
|
-
});
|
|
23
|
-
it('accepts a `disabled` prop', () => {
|
|
24
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
25
|
-
disabled: true,
|
|
26
|
-
onClick: noop
|
|
27
|
-
}));
|
|
28
|
-
expect(wrapper.find('button').prop('disabled')).toEqual(true);
|
|
29
|
-
});
|
|
30
|
-
it('accepts an `isShowing` prop', () => {
|
|
31
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
32
|
-
onClick: noop
|
|
33
|
-
}));
|
|
34
|
-
const wrapperWithIsShowing = shallow( /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
|
|
35
|
-
isShowing: true,
|
|
36
|
-
onClick: noop
|
|
37
|
-
}));
|
|
38
|
-
expect(wrapper.find('SvgChevronRight24')).toHaveLength(0);
|
|
39
|
-
expect(wrapper.find('SvgChevronLeft24')).toHaveLength(1);
|
|
40
|
-
expect(wrapperWithIsShowing.find('SvgChevronRight24')).toHaveLength(1);
|
|
41
|
-
expect(wrapperWithIsShowing.find('SvgChevronLeft24')).toHaveLength(0);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Toolbar } from '../index.js';
|
|
4
|
-
describe('<Toolbar/>', () => {
|
|
5
|
-
it('renders children', () => {
|
|
6
|
-
const childNode = 'text node';
|
|
7
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(Toolbar, null, childNode));
|
|
8
|
-
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
it('accepts a `dataTest` prop', () => {
|
|
11
|
-
const dataTest = 'test';
|
|
12
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(Toolbar, {
|
|
13
|
-
dataTest: dataTest
|
|
14
|
-
}));
|
|
15
|
-
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ToolbarSidebar } from '../index.js';
|
|
4
|
-
describe('<ToolbarSidebar/>', () => {
|
|
5
|
-
it('renders children', () => {
|
|
6
|
-
const childNode = 'text node';
|
|
7
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(ToolbarSidebar, null, childNode));
|
|
8
|
-
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
it('accepts a `dataTest` prop', () => {
|
|
11
|
-
const dataTest = 'test';
|
|
12
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(ToolbarSidebar, {
|
|
13
|
-
dataTest: dataTest
|
|
14
|
-
}));
|
|
15
|
-
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
16
|
-
});
|
|
17
|
-
it('accepts a `isHidden` prop', () => {
|
|
18
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(ToolbarSidebar, {
|
|
19
|
-
isHidden: true
|
|
20
|
-
}));
|
|
21
|
-
expect(wrapper.find('div').hasClass('isHidden')).toEqual(true);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { UpdateButton } from '../index.js';
|
|
4
|
-
describe('<UpdateButton/>', () => {
|
|
5
|
-
const noop = () => {};
|
|
6
|
-
|
|
7
|
-
it('accepts an `onClick` prop', () => {
|
|
8
|
-
const onClick = jest.fn();
|
|
9
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(UpdateButton, {
|
|
10
|
-
onClick: onClick
|
|
11
|
-
}));
|
|
12
|
-
wrapper.simulate('click');
|
|
13
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
14
|
-
});
|
|
15
|
-
it('accepts a `dataTest` prop', () => {
|
|
16
|
-
const dataTest = 'test';
|
|
17
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(UpdateButton, {
|
|
18
|
-
onClick: noop,
|
|
19
|
-
dataTest: dataTest
|
|
20
|
-
}));
|
|
21
|
-
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
22
|
-
});
|
|
23
|
-
it('accepts a `disabled` prop', () => {
|
|
24
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(UpdateButton, {
|
|
25
|
-
disabled: true,
|
|
26
|
-
onClick: noop
|
|
27
|
-
}));
|
|
28
|
-
expect(wrapper.find('button').prop('disabled')).toEqual(true);
|
|
29
|
-
});
|
|
30
|
-
it('accepts an `loading` prop', () => {
|
|
31
|
-
const wrapper = shallow( /*#__PURE__*/React.createElement(UpdateButton, {
|
|
32
|
-
onClick: noop,
|
|
33
|
-
loading: true
|
|
34
|
-
}));
|
|
35
|
-
expect(wrapper.find('CircularLoader')).toHaveLength(1);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { InterpretationsAndDetailsToggler } from './InterpretationsAndDetailsToggler.js';
|
|
2
|
-
export { Toolbar } from './Toolbar.js';
|
|
3
|
-
export { ToolbarSidebar } from './ToolbarSidebar.js';
|
|
4
|
-
export { UpdateButton } from './UpdateButton.js';
|
|
5
|
-
export * from './HoverMenuBar/index.js';
|