@dhis2-ui/select 9.11.0 → 9.11.1-beta.1
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/index.js +0 -6
- package/build/cjs/locales/index.js +3 -69
- package/build/cjs/multi-select/__tests__/multi-select.test.js +1 -7
- package/build/cjs/multi-select/__tests__/selection-list.test.js +7 -18
- package/build/cjs/multi-select/features/accepts_blur_cb/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_focus_cb/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_initial_focus/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_loading/index.js +0 -1
- package/build/cjs/multi-select/features/accepts_max_height/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_placeholder/index.js +0 -1
- package/build/cjs/multi-select/features/accepts_prefix/index.js +0 -1
- package/build/cjs/multi-select/features/allows_invalid_options/index.js +0 -1
- package/build/cjs/multi-select/features/allows_selecting/index.js +2 -3
- package/build/cjs/multi-select/features/can_be_cleared/index.js +1 -2
- package/build/cjs/multi-select/features/can_be_disabled/index.js +0 -1
- package/build/cjs/multi-select/features/can_be_empty/index.js +0 -1
- package/build/cjs/multi-select/features/can_be_filtered/index.js +0 -1
- package/build/cjs/multi-select/features/can_be_opened_and_closed/index.js +0 -1
- package/build/cjs/multi-select/features/common/index.js +2 -3
- package/build/cjs/multi-select/features/duplicate_option_values/index.js +0 -1
- package/build/cjs/multi-select/features/menu_width_matches_input/index.js +1 -2
- package/build/cjs/multi-select/features/position/index.js +4 -5
- package/build/cjs/multi-select/features/position.feature +0 -1
- package/build/cjs/multi-select/features/shows_selections/index.js +0 -1
- package/build/cjs/multi-select/filterable-menu.js +1 -8
- package/build/cjs/multi-select/index.js +0 -1
- package/build/cjs/multi-select/input.js +6 -19
- package/build/cjs/multi-select/menu.js +16 -23
- package/build/cjs/multi-select/multi-select.e2e.stories.js +675 -0
- package/build/cjs/multi-select/multi-select.js +4 -21
- package/build/cjs/multi-select/{multi-select.stories.js → multi-select.prod.stories.js} +62 -101
- package/build/cjs/multi-select/selection-list.js +10 -18
- package/build/cjs/multi-select-field/__tests__/multi-select-field.test.js +1 -7
- package/build/cjs/multi-select-field/features/accepts_help_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/accepts_label/index.js +0 -1
- package/build/cjs/multi-select-field/features/accepts_validation_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/can_be_required/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_clear_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_empty_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_filter_nomatch_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_filter_placeholder/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_loading_text/index.js +0 -1
- package/build/cjs/multi-select-field/index.js +0 -1
- package/build/cjs/multi-select-field/multi-select-field.e2e.stories.js +89 -0
- package/build/cjs/multi-select-field/multi-select-field.js +10 -51
- package/build/cjs/multi-select-field/{multi-select-field.stories.js → multi-select-field.prod.stories.js} +31 -39
- package/build/cjs/multi-select-option/index.js +0 -1
- package/build/cjs/multi-select-option/multi-select-option.js +4 -14
- package/build/cjs/select/__tests__/select.test.js +1 -7
- package/build/cjs/select/debounce/debounce.js +1 -8
- package/build/cjs/select/debounce/debounce.spec.js +0 -1
- package/build/cjs/select/empty.js +2 -9
- package/build/cjs/select/filter-input.js +3 -11
- package/build/cjs/select/filterable-menu.js +15 -29
- package/build/cjs/select/index.js +0 -8
- package/build/cjs/select/input-clear-button.js +3 -11
- package/build/cjs/select/input-placeholder.js +2 -11
- package/build/cjs/select/input-prefix.js +2 -11
- package/build/cjs/select/input-wrapper.js +2 -11
- package/build/cjs/select/loading.js +3 -12
- package/build/cjs/select/menu-wrapper.js +4 -13
- package/build/cjs/select/no-match.js +2 -9
- package/build/cjs/select/option-helpers.js +9 -18
- package/build/cjs/select/select.js +23 -69
- package/build/cjs/single-select/__tests__/selection.test.js +7 -18
- package/build/cjs/single-select/__tests__/single-select.test.js +1 -7
- package/build/cjs/single-select/features/accepts_blur_cb/index.js +1 -2
- package/build/cjs/single-select/features/accepts_focus_cb/index.js +1 -2
- package/build/cjs/single-select/features/accepts_initial_focus/index.js +1 -2
- package/build/cjs/single-select/features/accepts_loading/index.js +0 -1
- package/build/cjs/single-select/features/accepts_max_height/index.js +1 -2
- package/build/cjs/single-select/features/accepts_placeholder/index.js +0 -1
- package/build/cjs/single-select/features/accepts_prefix/index.js +0 -1
- package/build/cjs/single-select/features/allows_invalid_options/index.js +0 -1
- package/build/cjs/single-select/features/allows_selecting/index.js +2 -3
- package/build/cjs/single-select/features/can_be_cleared/index.js +1 -2
- package/build/cjs/single-select/features/can_be_disabled/index.js +0 -1
- package/build/cjs/single-select/features/can_be_empty/index.js +0 -1
- package/build/cjs/single-select/features/can_be_filtered/index.js +0 -1
- package/build/cjs/single-select/features/can_be_opened_and_closed/index.js +0 -1
- package/build/cjs/single-select/features/common/index.js +2 -3
- package/build/cjs/single-select/features/duplicate_option_values/index.js +0 -1
- package/build/cjs/single-select/features/menu_width_matches_input/index.js +1 -2
- package/build/cjs/single-select/features/position/index.js +3 -4
- package/build/cjs/single-select/features/shows_selections/index.js +0 -1
- package/build/cjs/single-select/filterable-menu.js +1 -8
- package/build/cjs/single-select/index.js +0 -1
- package/build/cjs/single-select/input.js +6 -19
- package/build/cjs/single-select/menu.js +12 -21
- package/build/cjs/single-select/selection.js +5 -17
- package/build/cjs/single-select/single-select.e2e.stories.js +633 -0
- package/build/cjs/single-select/single-select.js +4 -25
- package/build/cjs/single-select/{single-select.stories.js → single-select.prod.stories.js} +58 -95
- package/build/cjs/single-select-field/__tests__/single-select-field.test.js +1 -7
- package/build/cjs/single-select-field/features/accepts_help_text/index.js +0 -1
- package/build/cjs/single-select-field/features/accepts_label/index.js +0 -1
- package/build/cjs/single-select-field/features/accepts_validation_text/index.js +0 -1
- package/build/cjs/single-select-field/features/can_be_required/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_clear_text/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_empty_text/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_filter_nomatch_text/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_filter_placeholder/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_loading_text/index.js +0 -1
- package/build/cjs/single-select-field/index.js +0 -1
- package/build/cjs/single-select-field/single-select-field.e2e.stories.js +89 -0
- package/build/cjs/single-select-field/single-select-field.js +10 -51
- package/build/cjs/single-select-field/{single-select-field.stories.js → single-select-field.prod.stories.js} +31 -39
- package/build/cjs/single-select-option/index.js +0 -1
- package/build/cjs/single-select-option/single-select-option.js +2 -10
- package/build/es/multi-select/__tests__/selection-list.test.js +6 -3
- package/build/es/multi-select/features/accepts_blur_cb/index.js +1 -1
- package/build/es/multi-select/features/accepts_focus_cb/index.js +1 -1
- package/build/es/multi-select/features/accepts_initial_focus/index.js +1 -1
- package/build/es/multi-select/features/accepts_max_height/index.js +1 -1
- package/build/es/multi-select/features/allows_selecting/index.js +2 -2
- package/build/es/multi-select/features/can_be_cleared/index.js +1 -1
- package/build/es/multi-select/features/common/index.js +2 -2
- package/build/es/multi-select/features/menu_width_matches_input/index.js +1 -1
- package/build/es/multi-select/features/position/index.js +4 -4
- package/build/es/multi-select/features/position.feature +0 -1
- package/build/es/multi-select/filterable-menu.js +0 -2
- package/build/es/multi-select/input.js +5 -9
- package/build/es/multi-select/menu.js +15 -17
- package/build/es/multi-select/{multi-select.stories.e2e.js → multi-select.e2e.stories.js} +74 -42
- package/build/es/multi-select/multi-select.js +3 -9
- package/build/es/multi-select/{multi-select.stories.js → multi-select.prod.stories.js} +40 -24
- package/build/es/multi-select/selection-list.js +9 -12
- package/build/es/multi-select-field/{multi-select-field.stories.e2e.js → multi-select-field.e2e.stories.js} +18 -9
- package/build/es/multi-select-field/multi-select-field.js +4 -35
- package/build/es/multi-select-field/{multi-select-field.stories.js → multi-select-field.prod.stories.js} +19 -9
- package/build/es/multi-select-option/multi-select-option.js +3 -5
- package/build/es/select/debounce/debounce.js +1 -6
- package/build/es/select/empty.js +1 -3
- package/build/es/select/filter-input.js +2 -4
- package/build/es/select/filterable-menu.js +12 -15
- package/build/es/select/input-clear-button.js +2 -4
- package/build/es/select/input-placeholder.js +1 -5
- package/build/es/select/input-prefix.js +1 -5
- package/build/es/select/input-wrapper.js +1 -3
- package/build/es/select/loading.js +2 -2
- package/build/es/select/menu-wrapper.js +3 -5
- package/build/es/select/no-match.js +1 -3
- package/build/es/select/option-helpers.js +10 -6
- package/build/es/select/select.js +22 -51
- package/build/es/single-select/__tests__/selection.test.js +6 -3
- package/build/es/single-select/features/accepts_blur_cb/index.js +1 -1
- package/build/es/single-select/features/accepts_focus_cb/index.js +1 -1
- package/build/es/single-select/features/accepts_initial_focus/index.js +1 -1
- package/build/es/single-select/features/accepts_max_height/index.js +1 -1
- package/build/es/single-select/features/allows_selecting/index.js +2 -2
- package/build/es/single-select/features/can_be_cleared/index.js +1 -1
- package/build/es/single-select/features/common/index.js +2 -2
- package/build/es/single-select/features/menu_width_matches_input/index.js +1 -1
- package/build/es/single-select/features/position/index.js +3 -3
- package/build/es/single-select/input.js +5 -9
- package/build/es/single-select/menu.js +11 -15
- package/build/es/single-select/selection.js +4 -9
- package/build/es/single-select/{single-select.stories.e2e.js → single-select.e2e.stories.js} +68 -38
- package/build/es/single-select/single-select.js +3 -13
- package/build/es/single-select/{single-select.stories.js → single-select.prod.stories.js} +37 -24
- package/build/es/single-select-field/{single-select-field.stories.e2e.js → single-select-field.e2e.stories.js} +18 -9
- package/build/es/single-select-field/single-select-field.js +4 -35
- package/build/es/single-select-field/{single-select-field.stories.js → single-select-field.prod.stories.js} +19 -9
- package/build/es/single-select-option/single-select-option.js +1 -3
- package/package.json +18 -18
- package/build/cjs/multi-select/multi-select.stories.e2e.js +0 -618
- package/build/cjs/multi-select-field/multi-select-field.stories.e2e.js +0 -73
- package/build/cjs/single-select/single-select.stories.e2e.js +0 -579
- package/build/cjs/single-select-field/single-select-field.stories.e2e.js +0 -73
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
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); }
|
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
7
|
import { FilterInput } from './filter-input.js';
|
|
@@ -10,11 +10,9 @@ import { filterIgnored, checkIfValidOption } from './option-helpers.js';
|
|
|
10
10
|
export class FilterableMenu extends Component {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
|
|
14
13
|
_defineProperty(this, "state", {
|
|
15
14
|
filter: ''
|
|
16
15
|
});
|
|
17
|
-
|
|
18
16
|
_defineProperty(this, "onFilterChange", _ref => {
|
|
19
17
|
let {
|
|
20
18
|
value
|
|
@@ -24,7 +22,6 @@ export class FilterableMenu extends Component {
|
|
|
24
22
|
});
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
render() {
|
|
29
26
|
const {
|
|
30
27
|
dataTest,
|
|
@@ -49,11 +46,12 @@ export class FilterableMenu extends Component {
|
|
|
49
46
|
handleFocusInput,
|
|
50
47
|
dataTest
|
|
51
48
|
};
|
|
52
|
-
const renderedOptions = filterIgnored(options);
|
|
49
|
+
const renderedOptions = filterIgnored(options);
|
|
53
50
|
|
|
51
|
+
// If there are no options or there's no filter, just pass everything through
|
|
54
52
|
if (React.Children.count(renderedOptions) === 0 || !filter) {
|
|
55
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterInput, {
|
|
56
|
-
dataTest:
|
|
54
|
+
dataTest: `${dataTest}-filterinput`,
|
|
57
55
|
placeholder: placeholder,
|
|
58
56
|
value: filter,
|
|
59
57
|
onChange: this.onFilterChange
|
|
@@ -61,24 +59,24 @@ export class FilterableMenu extends Component {
|
|
|
61
59
|
options: options
|
|
62
60
|
})));
|
|
63
61
|
}
|
|
64
|
-
|
|
65
62
|
const filtered = React.Children.map(options, child => {
|
|
66
|
-
const isValidOption = checkIfValidOption(child);
|
|
63
|
+
const isValidOption = checkIfValidOption(child);
|
|
67
64
|
|
|
65
|
+
// Filter it out if it's an invalid option
|
|
68
66
|
if (!isValidOption) {
|
|
69
67
|
return null;
|
|
70
68
|
}
|
|
71
|
-
|
|
72
69
|
const {
|
|
73
70
|
label
|
|
74
|
-
} = child.props;
|
|
71
|
+
} = child.props;
|
|
75
72
|
|
|
73
|
+
// Filter by label, because that's the part of an option that's displayed to the user
|
|
76
74
|
const match = label.toLowerCase().includes(filter.toLowerCase());
|
|
77
75
|
return match ? child : null;
|
|
78
76
|
});
|
|
79
77
|
const hasMatch = React.Children.count(filtered) > 0;
|
|
80
78
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterInput, {
|
|
81
|
-
dataTest:
|
|
79
|
+
dataTest: `${dataTest}-filterinput`,
|
|
82
80
|
placeholder: placeholder,
|
|
83
81
|
value: filter,
|
|
84
82
|
onChange: this.onFilterChange
|
|
@@ -88,7 +86,6 @@ export class FilterableMenu extends Component {
|
|
|
88
86
|
message: noMatchText
|
|
89
87
|
}));
|
|
90
88
|
}
|
|
91
|
-
|
|
92
89
|
}
|
|
93
90
|
FilterableMenu.propTypes = {
|
|
94
91
|
Menu: PropTypes.elementType.isRequired,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { Tooltip } from '@dhis2-ui/tooltip';
|
|
3
2
|
import { colors, theme } from '@dhis2/ui-constants';
|
|
3
|
+
import { Tooltip } from '@dhis2-ui/tooltip';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
const InputClearButton = _ref => {
|
|
8
7
|
let {
|
|
9
8
|
onClear,
|
|
@@ -33,9 +32,8 @@ const InputClearButton = _ref => {
|
|
|
33
32
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
34
33
|
id: "2606883952",
|
|
35
34
|
dynamic: [colors.grey500, colors.grey800, colors.grey200, theme.focus]
|
|
36
|
-
}, ["button.__jsx-style-dynamic-selector{background:none;border:none;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-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;height:24px;width:24px;border-radius:3px;}",
|
|
35
|
+
}, ["button.__jsx-style-dynamic-selector{background:none;border:none;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-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;height:24px;width:24px;border-radius:3px;}", `button.__jsx-style-dynamic-selector svg.__jsx-style-dynamic-selector path.__jsx-style-dynamic-selector{fill:${colors.grey500};}`, `button.__jsx-style-dynamic-selector:hover svg.__jsx-style-dynamic-selector path.__jsx-style-dynamic-selector{fill:${colors.grey800};}`, `button.__jsx-style-dynamic-selector:hover{background:${colors.grey200};}`, `button.__jsx-style-dynamic-selector:focus{outline:2px solid ${theme.focus};}`])));
|
|
37
36
|
};
|
|
38
|
-
|
|
39
37
|
InputClearButton.propTypes = {
|
|
40
38
|
clearText: PropTypes.string.isRequired,
|
|
41
39
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -2,27 +2,23 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { colors } from '@dhis2/ui-constants';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
|
|
6
5
|
const InputPlaceholder = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
placeholder,
|
|
9
8
|
className,
|
|
10
9
|
dataTest
|
|
11
10
|
} = _ref;
|
|
12
|
-
|
|
13
11
|
if (!placeholder) {
|
|
14
12
|
return null;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
15
|
"data-test": dataTest,
|
|
19
16
|
className: _JSXStyle.dynamic([["1027033961", [colors.grey600]]]) + " " + (className || "")
|
|
20
17
|
}, placeholder, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
18
|
id: "1027033961",
|
|
22
19
|
dynamic: [colors.grey600]
|
|
23
|
-
}, [
|
|
20
|
+
}, [`div.__jsx-style-dynamic-selector{color:${colors.grey600};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`]));
|
|
24
21
|
};
|
|
25
|
-
|
|
26
22
|
InputPlaceholder.propTypes = {
|
|
27
23
|
dataTest: PropTypes.string.isRequired,
|
|
28
24
|
className: PropTypes.string,
|
|
@@ -2,27 +2,23 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { colors, spacers } from '@dhis2/ui-constants';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
|
|
6
5
|
const InputPrefix = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
prefix,
|
|
9
8
|
className,
|
|
10
9
|
dataTest
|
|
11
10
|
} = _ref;
|
|
12
|
-
|
|
13
11
|
if (!prefix) {
|
|
14
12
|
return null;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
15
|
"data-test": dataTest,
|
|
19
16
|
className: _JSXStyle.dynamic([["1343055987", [colors.grey600, spacers.dp12]]]) + " " + (className || "")
|
|
20
17
|
}, prefix, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
18
|
id: "1343055987",
|
|
22
19
|
dynamic: [colors.grey600, spacers.dp12]
|
|
23
|
-
}, [
|
|
20
|
+
}, [`div.__jsx-style-dynamic-selector{color:${colors.grey600};padding-inline-end:${spacers.dp12};font-size:14px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`]));
|
|
24
21
|
};
|
|
25
|
-
|
|
26
22
|
InputPrefix.propTypes = {
|
|
27
23
|
dataTest: PropTypes.string.isRequired,
|
|
28
24
|
className: PropTypes.string,
|
|
@@ -4,7 +4,6 @@ import { IconChevronDown16 } from '@dhis2/ui-icons';
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
|
|
8
7
|
const InputWrapper = _ref => {
|
|
9
8
|
let {
|
|
10
9
|
dataTest,
|
|
@@ -39,9 +38,8 @@ const InputWrapper = _ref => {
|
|
|
39
38
|
}, /*#__PURE__*/React.createElement(IconChevronDown16, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
40
39
|
id: "1568723238",
|
|
41
40
|
dynamic: [colors.grey500, theme.focus, theme.focus, theme.valid, theme.warning, theme.error, colors.grey100, colors.grey500, theme.disabled]
|
|
42
|
-
}, [
|
|
41
|
+
}, [`.root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:white;border-radius:3px;border:1px solid ${colors.grey500};box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-height:40px;padding-block:6px;padding-inline:12px;box-shadow:inset 0 0 1px 0 rgba(48,54,60,0.1);}`, `.root.__jsx-style-dynamic-selector:not(.disabled):focus,.root.__jsx-style-dynamic-selector:not(.disabled):active{outline:none;box-shadow:inset 0 0 0 2px ${theme.focus};border-color:${theme.focus};}`, `.root.valid.__jsx-style-dynamic-selector{border-color:${theme.valid};}`, `.root.warning.__jsx-style-dynamic-selector{border-color:${theme.warning};}`, `.root.error.__jsx-style-dynamic-selector{border-color:${theme.error};}`, `.root.disabled.__jsx-style-dynamic-selector{background-color:${colors.grey100};border-color:${colors.grey500};color:${theme.disabled};cursor:not-allowed;}`, ".root.dense.__jsx-style-dynamic-selector{padding-block:2px;padding-inline:8px;min-height:32px;}", ".root-children.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".root-right.__jsx-style-dynamic-selector{margin-block-start:4px;margin-inline-start:8px;}"]));
|
|
43
42
|
};
|
|
44
|
-
|
|
45
43
|
InputWrapper.defaultProps = {
|
|
46
44
|
tabIndex: '0'
|
|
47
45
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { CircularLoader } from '@dhis2-ui/loader';
|
|
3
2
|
import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
3
|
+
import { CircularLoader } from '@dhis2-ui/loader';
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
@@ -20,7 +20,7 @@ export const Loading = _ref => {
|
|
|
20
20
|
})), message, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
21
|
id: "3603755746",
|
|
22
22
|
dynamic: [spacers.dp16, colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]
|
|
23
|
-
}, [
|
|
23
|
+
}, [`.container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${spacers.dp16};-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;color:${colors.grey700};font-family:${theme.fonts};font-size:13px;padding-block:${spacers.dp8};padding-inline:${spacers.dp24};}`]));
|
|
24
24
|
};
|
|
25
25
|
Loading.propTypes = {
|
|
26
26
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { colors, elevations } from '@dhis2/ui-constants';
|
|
2
3
|
import { Layer } from '@dhis2-ui/layer';
|
|
3
4
|
import { Popper } from '@dhis2-ui/popper';
|
|
4
|
-
import { colors, elevations } from '@dhis2/ui-constants';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
|
|
8
7
|
const MenuWrapper = _ref => {
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
@@ -22,14 +21,13 @@ const MenuWrapper = _ref => {
|
|
|
22
21
|
placement: "bottom-start",
|
|
23
22
|
observeReferenceResize: true
|
|
24
23
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
"data-test":
|
|
24
|
+
"data-test": `${dataTest}-menuwrapper`,
|
|
26
25
|
className: _JSXStyle.dynamic([["1363246346", [menuWidth, maxHeight, colors.white, colors.grey200, elevations.e300]]])
|
|
27
26
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
28
27
|
id: "1363246346",
|
|
29
28
|
dynamic: [menuWidth, maxHeight, colors.white, colors.grey200, elevations.e300]
|
|
30
|
-
}, [
|
|
29
|
+
}, [`div.__jsx-style-dynamic-selector{width:${menuWidth};height:auto;max-height:${maxHeight};overflow:auto;background:${colors.white};border:1px solid ${colors.grey200};border-radius:3px;box-shadow:${elevations.e300};}`]))));
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
MenuWrapper.defaultProps = {
|
|
34
32
|
maxHeight: '280px'
|
|
35
33
|
};
|
|
@@ -2,7 +2,6 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
|
|
6
5
|
const NoMatch = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
message,
|
|
@@ -13,9 +12,8 @@ const NoMatch = _ref => {
|
|
|
13
12
|
}, message, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
14
13
|
id: "3788156646",
|
|
15
14
|
dynamic: [colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]
|
|
16
|
-
}, [
|
|
15
|
+
}, [`div.__jsx-style-dynamic-selector{color:${colors.grey700};font-family:${theme.fonts};font-size:13px;line-height:16px;padding-block:${spacers.dp8};padding-inline:${spacers.dp24};text-align:center;}`]));
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
NoMatch.propTypes = {
|
|
20
18
|
message: PropTypes.string.isRequired,
|
|
21
19
|
className: PropTypes.string
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Check whether an option is valid
|
|
4
|
+
export const checkIfValidOption = option => option && 'props' in option && 'value' in option.props && 'label' in option.props;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
// Filters all children that won't be rendered from an array of react children
|
|
7
|
+
export const filterIgnored = children => React.Children.toArray(children).filter(child => child !== null && child !== false && child !== undefined);
|
|
6
8
|
|
|
9
|
+
// Find an option in an array of react children
|
|
7
10
|
export const findOptionChild = (value, optionChildren) => React.Children.toArray(optionChildren).find(currentOption => {
|
|
8
11
|
if (!currentOption.props) {
|
|
9
12
|
return false;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
14
|
return value === currentOption.props.value;
|
|
13
|
-
});
|
|
15
|
+
});
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
// Find an option in an array of option objects
|
|
18
|
+
export const findOption = (value, optionArray) => optionArray.find(optionValue => value === optionValue);
|
|
16
19
|
|
|
20
|
+
// Remove a specific option from an array of options
|
|
17
21
|
export const removeOption = (value, optionArray) => optionArray.filter(optionValue => {
|
|
18
22
|
return optionValue !== value;
|
|
19
23
|
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
function _defineProperty(
|
|
2
|
-
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3
4
|
import { sharedPropTypes } from '@dhis2/ui-constants';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import React, { Component } from 'react';
|
|
6
7
|
import { debounce } from './debounce/debounce.js';
|
|
7
8
|
import { InputWrapper } from './input-wrapper.js';
|
|
8
|
-
import { MenuWrapper } from './menu-wrapper.js';
|
|
9
|
+
import { MenuWrapper } from './menu-wrapper.js';
|
|
9
10
|
|
|
11
|
+
// Keycodes for the keypress event handlers
|
|
10
12
|
const ESCAPE_KEY = 27;
|
|
11
13
|
const SPACE_KEY = 32;
|
|
12
14
|
const UP_KEY = 38;
|
|
@@ -14,109 +16,96 @@ const DOWN_KEY = 40;
|
|
|
14
16
|
export class Select extends Component {
|
|
15
17
|
constructor() {
|
|
16
18
|
super(...arguments);
|
|
17
|
-
|
|
18
19
|
_defineProperty(this, "state", {
|
|
19
20
|
open: false,
|
|
20
21
|
menuWidth: 'auto'
|
|
21
22
|
});
|
|
22
|
-
|
|
23
23
|
_defineProperty(this, "selectRef", /*#__PURE__*/React.createRef());
|
|
24
|
-
|
|
25
24
|
_defineProperty(this, "inputRef", /*#__PURE__*/React.createRef());
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* We're debouncing this so it doesn't fire continually during a resize.
|
|
27
|
+
*
|
|
28
|
+
* Additionally we should use requestPostAnimationFrame to not trigger a forced
|
|
29
|
+
* layout, but that's just a proposal, and the added complexity of solving this
|
|
30
|
+
* in another manner does not seem worth it, considering the minor perf penalty.
|
|
31
|
+
*
|
|
32
|
+
* See: https://nolanlawson.com/2018/09/25/accurately-measuring-layout-on-the-web
|
|
33
|
+
*/
|
|
27
34
|
_defineProperty(this, "onResize", debounce(() => {
|
|
28
35
|
const menuWidth = this.getMenuWidth();
|
|
29
|
-
|
|
30
36
|
if (this.state.menuWidth !== menuWidth) {
|
|
31
37
|
this.setState({
|
|
32
38
|
menuWidth
|
|
33
39
|
});
|
|
34
40
|
}
|
|
35
41
|
}, 50));
|
|
36
|
-
|
|
37
42
|
_defineProperty(this, "handleFocusInput", () => {
|
|
38
43
|
this.inputRef.current.focus();
|
|
39
44
|
});
|
|
40
|
-
|
|
41
45
|
_defineProperty(this, "onFocus", e => {
|
|
42
46
|
const {
|
|
43
47
|
onFocus,
|
|
44
48
|
disabled,
|
|
45
49
|
selected
|
|
46
50
|
} = this.props;
|
|
47
|
-
|
|
48
51
|
if (disabled || !onFocus) {
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
|
-
|
|
52
54
|
onFocus({
|
|
53
55
|
selected
|
|
54
56
|
}, e);
|
|
55
57
|
});
|
|
56
|
-
|
|
57
58
|
_defineProperty(this, "handleOpen", () => {
|
|
58
59
|
this.setState({
|
|
59
60
|
open: true,
|
|
60
61
|
menuWidth: this.getMenuWidth()
|
|
61
62
|
});
|
|
62
63
|
});
|
|
63
|
-
|
|
64
64
|
_defineProperty(this, "handleClose", () => {
|
|
65
65
|
this.setState({
|
|
66
66
|
open: false
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
|
-
|
|
70
69
|
_defineProperty(this, "onToggle", e => {
|
|
71
70
|
if (this.props.disabled) {
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
|
-
|
|
75
73
|
e.stopPropagation();
|
|
76
74
|
this.state.open ? this.handleClose() : this.handleOpen();
|
|
77
75
|
});
|
|
78
|
-
|
|
79
76
|
_defineProperty(this, "onOutsideClick", e => {
|
|
80
77
|
const {
|
|
81
78
|
onBlur,
|
|
82
79
|
disabled,
|
|
83
80
|
selected
|
|
84
81
|
} = this.props;
|
|
85
|
-
|
|
86
82
|
if (disabled) {
|
|
87
83
|
return;
|
|
88
84
|
}
|
|
89
|
-
|
|
90
85
|
this.handleClose();
|
|
91
|
-
|
|
92
86
|
if (onBlur) {
|
|
93
87
|
onBlur({
|
|
94
88
|
selected
|
|
95
89
|
}, e);
|
|
96
90
|
}
|
|
97
91
|
});
|
|
98
|
-
|
|
99
92
|
_defineProperty(this, "onKeyDown", e => {
|
|
100
93
|
const {
|
|
101
94
|
onKeyDown,
|
|
102
95
|
disabled,
|
|
103
96
|
selected
|
|
104
97
|
} = this.props;
|
|
105
|
-
|
|
106
98
|
if (disabled) {
|
|
107
99
|
return;
|
|
108
100
|
}
|
|
109
|
-
|
|
110
101
|
if (onKeyDown) {
|
|
111
102
|
onKeyDown({
|
|
112
103
|
selected
|
|
113
104
|
}, e);
|
|
114
105
|
}
|
|
115
|
-
|
|
116
106
|
if (e.defaultPrevented) {
|
|
117
107
|
return;
|
|
118
108
|
}
|
|
119
|
-
|
|
120
109
|
e.stopPropagation();
|
|
121
110
|
const {
|
|
122
111
|
open
|
|
@@ -126,42 +115,26 @@ export class Select extends Component {
|
|
|
126
115
|
} = e;
|
|
127
116
|
const shouldOpen = !open && (keyCode === SPACE_KEY || keyCode === UP_KEY || keyCode === DOWN_KEY);
|
|
128
117
|
const shouldClose = open && keyCode === ESCAPE_KEY;
|
|
129
|
-
|
|
130
118
|
if (shouldClose) {
|
|
131
119
|
return this.handleClose();
|
|
132
120
|
}
|
|
133
|
-
|
|
134
121
|
if (shouldOpen) {
|
|
135
122
|
return this.handleOpen();
|
|
136
123
|
}
|
|
137
124
|
});
|
|
138
125
|
}
|
|
139
|
-
|
|
140
126
|
componentDidMount() {
|
|
141
127
|
if (this.props.initialFocus) {
|
|
142
128
|
this.inputRef.current.focus();
|
|
143
129
|
}
|
|
144
|
-
|
|
145
130
|
this.setState({
|
|
146
131
|
menuWidth: this.getMenuWidth()
|
|
147
132
|
});
|
|
148
133
|
window.addEventListener('resize', this.onResize);
|
|
149
134
|
}
|
|
150
|
-
|
|
151
135
|
componentWillUnmount() {
|
|
152
136
|
window.removeEventListener('resize', this.onResize);
|
|
153
137
|
}
|
|
154
|
-
/**
|
|
155
|
-
* We're debouncing this so it doesn't fire continually during a resize.
|
|
156
|
-
*
|
|
157
|
-
* Additionally we should use requestPostAnimationFrame to not trigger a forced
|
|
158
|
-
* layout, but that's just a proposal, and the added complexity of solving this
|
|
159
|
-
* in another manner does not seem worth it, considering the minor perf penalty.
|
|
160
|
-
*
|
|
161
|
-
* See: https://nolanlawson.com/2018/09/25/accurately-measuring-layout-on-the-web
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
138
|
getMenuWidth() {
|
|
166
139
|
const {
|
|
167
140
|
offsetWidth
|
|
@@ -169,14 +142,11 @@ export class Select extends Component {
|
|
|
169
142
|
const {
|
|
170
143
|
menuWidth
|
|
171
144
|
} = this.state;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return "".concat(offsetWidth, "px");
|
|
145
|
+
if (offsetWidth && `${offsetWidth}px` !== menuWidth) {
|
|
146
|
+
return `${offsetWidth}px`;
|
|
175
147
|
}
|
|
176
|
-
|
|
177
148
|
return menuWidth;
|
|
178
149
|
}
|
|
179
|
-
|
|
180
150
|
render() {
|
|
181
151
|
const {
|
|
182
152
|
open,
|
|
@@ -195,16 +165,18 @@ export class Select extends Component {
|
|
|
195
165
|
disabled,
|
|
196
166
|
dense,
|
|
197
167
|
dataTest
|
|
198
|
-
} = this.props;
|
|
168
|
+
} = this.props;
|
|
199
169
|
|
|
170
|
+
// Create the input
|
|
200
171
|
const inputProps = {
|
|
201
172
|
selected,
|
|
202
173
|
onChange,
|
|
203
174
|
options: children,
|
|
204
175
|
disabled
|
|
205
176
|
};
|
|
206
|
-
const input = /*#__PURE__*/React.cloneElement(this.props.input, inputProps);
|
|
177
|
+
const input = /*#__PURE__*/React.cloneElement(this.props.input, inputProps);
|
|
207
178
|
|
|
179
|
+
// Create the menu
|
|
208
180
|
const menuProps = {
|
|
209
181
|
selected,
|
|
210
182
|
onChange,
|
|
@@ -228,16 +200,15 @@ export class Select extends Component {
|
|
|
228
200
|
valid: valid,
|
|
229
201
|
disabled: disabled,
|
|
230
202
|
dense: dense,
|
|
231
|
-
dataTest:
|
|
203
|
+
dataTest: `${dataTest}-input`
|
|
232
204
|
}, input), open && /*#__PURE__*/React.createElement(MenuWrapper, {
|
|
233
205
|
onClick: this.onOutsideClick,
|
|
234
206
|
maxHeight: maxHeight,
|
|
235
207
|
selectRef: this.selectRef,
|
|
236
208
|
menuWidth: menuWidth,
|
|
237
|
-
dataTest:
|
|
209
|
+
dataTest: `${dataTest}-menu`
|
|
238
210
|
}, menu));
|
|
239
211
|
}
|
|
240
|
-
|
|
241
212
|
}
|
|
242
213
|
Select.defaultProps = {
|
|
243
214
|
dataTest: 'dhis2-uicore-select'
|
|
@@ -8,15 +8,18 @@ describe('<Selection />', () => {
|
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
// Ensure process.env is also reset for cached modules
|
|
10
10
|
jest.resetModules();
|
|
11
|
-
process.env = {
|
|
12
|
-
|
|
11
|
+
process.env = {
|
|
12
|
+
...env
|
|
13
|
+
};
|
|
13
14
|
|
|
15
|
+
// Allow spying on console.error and silence rendering errors
|
|
14
16
|
jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
15
17
|
});
|
|
16
18
|
afterEach(() => {
|
|
17
19
|
// Restore process.env to original state
|
|
18
|
-
process.env = env;
|
|
20
|
+
process.env = env;
|
|
19
21
|
|
|
22
|
+
// Restore all mocks back to original values
|
|
20
23
|
jest.restoreAllMocks();
|
|
21
24
|
});
|
|
22
25
|
describe('production', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a SingleSelect with onBlur handler is rendered', () => {
|
|
3
|
-
cy.visitStory('SingleSelect', 'With
|
|
3
|
+
cy.visitStory('SingleSelect', 'With on blur');
|
|
4
4
|
});
|
|
5
5
|
Then('the onBlur handler is called', () => {
|
|
6
6
|
cy.window().should(win => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a SingleSelect with onFocus handler is rendered', () => {
|
|
3
|
-
cy.visitStory('SingleSelect', 'With
|
|
3
|
+
cy.visitStory('SingleSelect', 'With on focus');
|
|
4
4
|
});
|
|
5
5
|
Then('the onFocus handler is called', () => {
|
|
6
6
|
cy.window().should(win => {
|
|
@@ -3,7 +3,7 @@ Given('a SingleSelect with more than ten options is rendered', () => {
|
|
|
3
3
|
cy.visitStory('SingleSelect', 'With more than ten options');
|
|
4
4
|
});
|
|
5
5
|
Given('a SingleSelect with more than three options and a 100px max-height is rendered', () => {
|
|
6
|
-
cy.visitStory('SingleSelect', 'With more than three options and a
|
|
6
|
+
cy.visitStory('SingleSelect', 'With more than three options and a 100 px max-height');
|
|
7
7
|
});
|
|
8
8
|
Then('has the default max-height', () => {
|
|
9
9
|
cy.get('[data-test="dhis2-uicore-select-menu-menuwrapper"]').should('have.css', 'max-height', '280px');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a SingleSelect with a disabled option and onChange handler is rendered', () => {
|
|
3
|
-
cy.visitStory('SingleSelect', 'With disabled option and
|
|
3
|
+
cy.visitStory('SingleSelect', 'With disabled option and on change');
|
|
4
4
|
});
|
|
5
5
|
Given('a SingleSelect with custom options and onChange handler is rendered', () => {
|
|
6
|
-
cy.visitStory('SingleSelect', 'With custom options and
|
|
6
|
+
cy.visitStory('SingleSelect', 'With custom options and on change');
|
|
7
7
|
});
|
|
8
8
|
When('an option is clicked', () => {
|
|
9
9
|
cy.contains('option one').click();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a clearable SingleSelect with a selection and onchange handler is rendered', () => {
|
|
3
|
-
cy.visitStory('SingleSelect', 'With clear button, selection and
|
|
3
|
+
cy.visitStory('SingleSelect', 'With clear button, selection and on change');
|
|
4
4
|
});
|
|
5
5
|
When('the clear button is clicked', () => {
|
|
6
6
|
cy.get('[data-test="dhis2-uicore-singleselect-clear"]').click();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a SingleSelect with options and onChange handler is rendered', () => {
|
|
3
|
-
cy.visitStory('SingleSelect', 'With options and
|
|
3
|
+
cy.visitStory('SingleSelect', 'With options and on change');
|
|
4
4
|
});
|
|
5
5
|
Given('a SingleSelect with options, a selection and onChange handler is rendered', () => {
|
|
6
|
-
cy.visitStory('SingleSelect', 'With options, a selection and
|
|
6
|
+
cy.visitStory('SingleSelect', 'With options, a selection and on change');
|
|
7
7
|
});
|
|
8
8
|
Given('the SingleSelect is open', () => {
|
|
9
9
|
cy.get('[data-test="dhis2-uicore-select-input"]').click();
|
|
@@ -6,7 +6,7 @@ Given('a SingleSelect with hidden sibling elements', () => {
|
|
|
6
6
|
});
|
|
7
7
|
});
|
|
8
8
|
When('the button is clicked', () => {
|
|
9
|
-
cy.get('button').click();
|
|
9
|
+
cy.get('button:contains("Toggle")').click();
|
|
10
10
|
});
|
|
11
11
|
Then('the siblings are displayed', () => {
|
|
12
12
|
cy.get('.toggler').should('exist').and('have.length', 2);
|