@dhis2-ui/transfer 10.16.3 → 10.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/__e2e__/add_remove-highlighted-options.e2e.stories.js +20 -29
- package/build/cjs/__e2e__/common/stateful-decorator.js +20 -28
- package/build/cjs/__e2e__/disabled-transfer-buttons.e2e.stories.js +49 -70
- package/build/cjs/__e2e__/disabled-transfer-options.e2e.stories.js +11 -14
- package/build/cjs/__e2e__/display-order.e2e.stories.js +19 -28
- package/build/cjs/__e2e__/filter-options-list.e2e.stories.js +72 -96
- package/build/cjs/__e2e__/highlight-range-of-options.e2e.stories.js +33 -48
- package/build/cjs/__e2e__/notify_at_end_of_list.e2e.stories.js +47 -67
- package/build/cjs/__e2e__/reorder-with-buttons.e2e.stories.js +15 -24
- package/build/cjs/__e2e__/set_unset-highlighted-option.e2e.stories.js +20 -29
- package/build/cjs/__e2e__/transferring-items.e2e.stories.js +19 -28
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-add.test.js +3 -6
- package/build/cjs/__tests__/helper/use-highlighted-option/toggle-range.test.js +24 -48
- package/build/cjs/__tests__/transfer.test.js +10 -18
- package/build/cjs/actions.js +10 -13
- package/build/cjs/add-all.js +14 -17
- package/build/cjs/add-individual.js +13 -16
- package/build/cjs/common/get-mode-by-modifier-key.js +6 -7
- package/build/cjs/container.js +12 -15
- package/build/cjs/end-intersection-detector.js +15 -21
- package/build/cjs/features/disabled-transfer-options/index.js +2 -4
- package/build/cjs/features/display-order/index.js +26 -47
- package/build/cjs/features/filter-options-list/index.js +3 -6
- package/build/cjs/features/highlight-range-of-options/index.js +5 -10
- package/build/cjs/features/notify_at_end_of_list/index.js +2 -4
- package/build/cjs/features/set_unset-highlighted-option/index.js +3 -6
- package/build/cjs/features/transferring-items/index.js +41 -75
- package/build/cjs/filter.js +24 -27
- package/build/cjs/icons.js +147 -171
- package/build/cjs/left-footer.js +10 -13
- package/build/cjs/left-header.js +10 -13
- package/build/cjs/left-side.js +16 -19
- package/build/cjs/locales/index.js +6 -1
- package/build/cjs/options-container.js +15 -17
- package/build/cjs/remove-all.js +13 -16
- package/build/cjs/remove-individual.js +13 -16
- package/build/cjs/reordering-actions.js +75 -82
- package/build/cjs/right-footer.js +10 -13
- package/build/cjs/right-header.js +10 -13
- package/build/cjs/right-side.js +16 -19
- package/build/cjs/transfer/add-all-selectable-source-options.js +9 -13
- package/build/cjs/transfer/add-individual-source-options.js +9 -10
- package/build/cjs/transfer/create-double-click-handlers.js +13 -16
- package/build/cjs/transfer/default-filter-callback.js +3 -6
- package/build/cjs/transfer/get-highlighted-picked-indices.js +4 -5
- package/build/cjs/transfer/is-reorder-down-disabled.js +5 -6
- package/build/cjs/transfer/is-reorder-up-disabled.js +5 -6
- package/build/cjs/transfer/move-highlighted-picked-option-down.js +5 -6
- package/build/cjs/transfer/move-highlighted-picked-option-to-bottom.js +5 -6
- package/build/cjs/transfer/move-highlighted-picked-option-to-top.js +5 -6
- package/build/cjs/transfer/move-highlighted-picked-option-up.js +5 -6
- package/build/cjs/transfer/remove-all-picked-options.js +4 -5
- package/build/cjs/transfer/remove-individual-picked-options.js +8 -9
- package/build/cjs/transfer/use-filter.js +7 -8
- package/build/cjs/transfer/use-highlighted-options/create-toggle-highlighted-option.js +39 -43
- package/build/cjs/transfer/use-highlighted-options/toggle-add.js +6 -7
- package/build/cjs/transfer/use-highlighted-options/toggle-range.js +11 -15
- package/build/cjs/transfer/use-highlighted-options/toggle-replace.js +5 -6
- package/build/cjs/transfer/use-highlighted-options.js +5 -6
- package/build/cjs/transfer/use-options-key-monitor.js +6 -7
- package/build/cjs/transfer-option.js +11 -13
- package/build/cjs/transfer.js +65 -85
- package/build/cjs/transfer.prod.stories.js +99 -146
- package/build/es/__e2e__/add_remove-highlighted-options.e2e.stories.js +20 -29
- package/build/es/__e2e__/common/stateful-decorator.js +19 -26
- package/build/es/__e2e__/disabled-transfer-buttons.e2e.stories.js +49 -70
- package/build/es/__e2e__/disabled-transfer-options.e2e.stories.js +11 -14
- package/build/es/__e2e__/display-order.e2e.stories.js +19 -28
- package/build/es/__e2e__/filter-options-list.e2e.stories.js +72 -96
- package/build/es/__e2e__/highlight-range-of-options.e2e.stories.js +33 -48
- package/build/es/__e2e__/notify_at_end_of_list.e2e.stories.js +46 -65
- package/build/es/__e2e__/reorder-with-buttons.e2e.stories.js +15 -24
- package/build/es/__e2e__/set_unset-highlighted-option.e2e.stories.js +20 -29
- package/build/es/__e2e__/transferring-items.e2e.stories.js +19 -28
- package/build/es/__tests__/helper/use-highlighted-option/toggle-add.test.js +3 -6
- package/build/es/__tests__/helper/use-highlighted-option/toggle-range.test.js +24 -48
- package/build/es/__tests__/transfer.test.js +10 -18
- package/build/es/actions.js +10 -13
- package/build/es/add-all.js +14 -17
- package/build/es/add-individual.js +13 -16
- package/build/es/common/get-mode-by-modifier-key.js +6 -7
- package/build/es/container.js +12 -15
- package/build/es/end-intersection-detector.js +15 -21
- package/build/es/features/disabled-transfer-options/index.js +2 -4
- package/build/es/features/display-order/index.js +26 -47
- package/build/es/features/filter-options-list/index.js +3 -6
- package/build/es/features/highlight-range-of-options/index.js +5 -10
- package/build/es/features/notify_at_end_of_list/index.js +2 -4
- package/build/es/features/set_unset-highlighted-option/index.js +3 -6
- package/build/es/features/transferring-items/index.js +41 -75
- package/build/es/filter.js +24 -27
- package/build/es/icons.js +147 -171
- package/build/es/left-footer.js +10 -13
- package/build/es/left-header.js +10 -13
- package/build/es/left-side.js +16 -19
- package/build/es/locales/index.js +6 -1
- package/build/es/options-container.js +14 -15
- package/build/es/remove-all.js +13 -16
- package/build/es/remove-individual.js +13 -16
- package/build/es/reordering-actions.js +75 -82
- package/build/es/right-footer.js +10 -13
- package/build/es/right-header.js +10 -13
- package/build/es/right-side.js +16 -19
- package/build/es/transfer/add-all-selectable-source-options.js +9 -13
- package/build/es/transfer/add-individual-source-options.js +9 -10
- package/build/es/transfer/create-double-click-handlers.js +13 -16
- package/build/es/transfer/default-filter-callback.js +3 -6
- package/build/es/transfer/get-highlighted-picked-indices.js +4 -5
- package/build/es/transfer/is-reorder-down-disabled.js +5 -6
- package/build/es/transfer/is-reorder-up-disabled.js +5 -6
- package/build/es/transfer/move-highlighted-picked-option-down.js +5 -6
- package/build/es/transfer/move-highlighted-picked-option-to-bottom.js +5 -6
- package/build/es/transfer/move-highlighted-picked-option-to-top.js +5 -6
- package/build/es/transfer/move-highlighted-picked-option-up.js +5 -6
- package/build/es/transfer/remove-all-picked-options.js +4 -5
- package/build/es/transfer/remove-individual-picked-options.js +8 -9
- package/build/es/transfer/use-filter.js +7 -8
- package/build/es/transfer/use-highlighted-options/create-toggle-highlighted-option.js +39 -43
- package/build/es/transfer/use-highlighted-options/toggle-add.js +6 -7
- package/build/es/transfer/use-highlighted-options/toggle-range.js +11 -15
- package/build/es/transfer/use-highlighted-options/toggle-replace.js +5 -6
- package/build/es/transfer/use-highlighted-options.js +5 -6
- package/build/es/transfer/use-options-key-monitor.js +6 -7
- package/build/es/transfer-option.js +10 -11
- package/build/es/transfer.js +64 -83
- package/build/es/transfer.prod.stories.js +98 -144
- package/package.json +8 -8
- package/src/locales/index.js +6 -1
package/build/cjs/container.js
CHANGED
|
@@ -8,21 +8,18 @@ var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const Container =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
dynamic: [height]
|
|
24
|
-
}, [`div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;height:${height};}`]));
|
|
25
|
-
};
|
|
11
|
+
const Container = ({
|
|
12
|
+
children,
|
|
13
|
+
dataTest,
|
|
14
|
+
className,
|
|
15
|
+
height
|
|
16
|
+
}) => /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
+
"data-test": dataTest,
|
|
18
|
+
className: _style.default.dynamic([["3332822660", [height]]]) + " " + (className || "")
|
|
19
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
20
|
+
id: "3332822660",
|
|
21
|
+
dynamic: [height]
|
|
22
|
+
}, [`div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;height:${height};}`]));
|
|
26
23
|
exports.Container = Container;
|
|
27
24
|
Container.propTypes = {
|
|
28
25
|
height: _propTypes.default.string.isRequired,
|
|
@@ -10,27 +10,21 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const INTERSECTION_DETECTOR_HEIGHT = exports.INTERSECTION_DETECTOR_HEIGHT = 50;
|
|
13
|
-
const EndIntersectionDetector =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return isIntersecting && onEndReached();
|
|
29
|
-
}
|
|
30
|
-
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
31
|
-
id: "3586508456"
|
|
32
|
-
}, [`div.jsx-3586508456{width:100%;height:${INTERSECTION_DETECTOR_HEIGHT}px;position:absolute;z-index:-1;bottom:0;inset-inline-start:0;}`]));
|
|
33
|
-
};
|
|
13
|
+
const EndIntersectionDetector = ({
|
|
14
|
+
rootRef,
|
|
15
|
+
onEndReached,
|
|
16
|
+
dataTest
|
|
17
|
+
}) => /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
+
"data-test": dataTest,
|
|
19
|
+
className: "jsx-3586508456"
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement(_intersectionDetector.IntersectionDetector, {
|
|
21
|
+
rootRef: rootRef,
|
|
22
|
+
onChange: ({
|
|
23
|
+
isIntersecting
|
|
24
|
+
}) => isIntersecting && onEndReached()
|
|
25
|
+
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
26
|
+
id: "3586508456"
|
|
27
|
+
}, [`div.jsx-3586508456{width:100%;height:${INTERSECTION_DETECTOR_HEIGHT}px;position:absolute;z-index:-1;bottom:0;inset-inline-start:0;}`]));
|
|
34
28
|
exports.EndIntersectionDetector = EndIntersectionDetector;
|
|
35
29
|
EndIntersectionDetector.propTypes = {
|
|
36
30
|
rootRef: _propTypes.default.shape({
|
|
@@ -70,8 +70,7 @@ const disabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}.
|
|
|
70
70
|
});
|
|
71
71
|
(0, _cypressCucumberPreprocessor.Then)('only the previously highlighted items are highlighted', () => {
|
|
72
72
|
cy.get('@enabledHighlightedSourceOptions').should('have.class', 'highlighted');
|
|
73
|
-
cy.all(() => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@enabledHighlightedSourceOptions')).should(
|
|
74
|
-
let [$sourceOptions, $previouslyHighlightedOptions] = _ref;
|
|
73
|
+
cy.all(() => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@enabledHighlightedSourceOptions')).should(([$sourceOptions, $previouslyHighlightedOptions]) => {
|
|
75
74
|
const previouslyHighlightedOptions = $previouslyHighlightedOptions.toArray().map(_index2.extractOptionFromElement);
|
|
76
75
|
const $notHighlightedSourceOptions = $sourceOptions.filter((_index, sourceOptionEl) => {
|
|
77
76
|
const label = sourceOptionEl.innerText;
|
|
@@ -84,8 +83,7 @@ const disabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}.
|
|
|
84
83
|
});
|
|
85
84
|
});
|
|
86
85
|
(0, _cypressCucumberPreprocessor.Then)('the enabled options in the range are highlighted', () => {
|
|
87
|
-
cy.all(() => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@clickedEnabledOption'), () => cy.get('@clickedWithShiftEnabledOption')).should(
|
|
88
|
-
let [$all, $clickedEnabledOption, $clickedWithShiftEnabledOption] = _ref2;
|
|
86
|
+
cy.all(() => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@clickedEnabledOption'), () => cy.get('@clickedWithShiftEnabledOption')).should(([$all, $clickedEnabledOption, $clickedWithShiftEnabledOption]) => {
|
|
89
87
|
const from = $clickedEnabledOption.index();
|
|
90
88
|
const to = $clickedWithShiftEnabledOption.index();
|
|
91
89
|
const $allInRange = $all.slice(from, to + 1);
|
|
@@ -42,8 +42,7 @@ var _index = require("../common/index.js");
|
|
|
42
42
|
cy.get('{transfer-actions-addindividual}').click();
|
|
43
43
|
});
|
|
44
44
|
(0, _cypressCucumberPreprocessor.Then)('the order of the selectable options should match the order of the supplied options', () => {
|
|
45
|
-
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
46
|
-
let [win, $options] = _ref;
|
|
45
|
+
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([win, $options]) => {
|
|
47
46
|
const {
|
|
48
47
|
options
|
|
49
48
|
} = win;
|
|
@@ -52,81 +51,61 @@ var _index = require("../common/index.js");
|
|
|
52
51
|
});
|
|
53
52
|
});
|
|
54
53
|
(0, _cypressCucumberPreprocessor.Then)('the order of the remaining selectable options should match the order of the supplied options', () => {
|
|
55
|
-
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
56
|
-
let [win, $options] = _ref2;
|
|
54
|
+
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([win, $options]) => {
|
|
57
55
|
const selectableSourceOptions = $options.toArray().map(_index.extractOptionFromElement);
|
|
58
|
-
const options = win.options.filter(option => selectableSourceOptions.find(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref3;
|
|
63
|
-
return label === option.label && value === option.value;
|
|
64
|
-
}));
|
|
56
|
+
const options = win.options.filter(option => selectableSourceOptions.find(({
|
|
57
|
+
label,
|
|
58
|
+
value
|
|
59
|
+
}) => label === option.label && value === option.value));
|
|
65
60
|
expect(selectableSourceOptions).to.eql(options);
|
|
66
61
|
});
|
|
67
62
|
});
|
|
68
63
|
(0, _cypressCucumberPreprocessor.Then)('it should be positioned according to the order of the supplied options', () => {
|
|
69
|
-
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@deselectedOptions')).should(
|
|
70
|
-
let [win, $selectableSourceOptions, deselectedOptions] = _ref4;
|
|
64
|
+
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@deselectedOptions')).should(([win, $selectableSourceOptions, deselectedOptions]) => {
|
|
71
65
|
// filter out non-selectable options and compare with selectable options
|
|
72
66
|
// this confirms that the order is correct
|
|
73
67
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
74
|
-
const originalOptions = win.options.filter(option => selectableSourceOptions.find(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} = _ref5;
|
|
79
|
-
return label === option.label && value === option.value;
|
|
80
|
-
}));
|
|
68
|
+
const originalOptions = win.options.filter(option => selectableSourceOptions.find(({
|
|
69
|
+
label,
|
|
70
|
+
value
|
|
71
|
+
}) => label === option.label && value === option.value));
|
|
81
72
|
expect(selectableSourceOptions).to.eql(originalOptions);
|
|
82
73
|
|
|
83
74
|
// and confirm that the deselected option is in the selectable options list
|
|
84
75
|
const [deselectedOption] = deselectedOptions;
|
|
85
|
-
const hasOption = !!selectableSourceOptions.find(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} = _ref6;
|
|
90
|
-
return label === deselectedOption.label && value === deselectedOption.value;
|
|
91
|
-
});
|
|
76
|
+
const hasOption = !!selectableSourceOptions.find(({
|
|
77
|
+
label,
|
|
78
|
+
value
|
|
79
|
+
}) => label === deselectedOption.label && value === deselectedOption.value);
|
|
92
80
|
expect(hasOption).to.equal(true);
|
|
93
81
|
});
|
|
94
82
|
});
|
|
95
83
|
(0, _cypressCucumberPreprocessor.Then)('all should take the position according to the order of the supplied options', () => {
|
|
96
|
-
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@deselectedOptions')).should(
|
|
97
|
-
let [win, $selectableSourceOptions, deselectedOptions] = _ref7;
|
|
84
|
+
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@deselectedOptions')).should(([win, $selectableSourceOptions, deselectedOptions]) => {
|
|
98
85
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
99
|
-
const options = win.options.filter(option => selectableSourceOptions.find(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
} = _ref8;
|
|
104
|
-
return label === option.label && value === option.value;
|
|
105
|
-
}));
|
|
86
|
+
const options = win.options.filter(option => selectableSourceOptions.find(({
|
|
87
|
+
label,
|
|
88
|
+
value
|
|
89
|
+
}) => label === option.label && value === option.value));
|
|
106
90
|
expect(selectableSourceOptions).to.eql(options);
|
|
107
91
|
const hasAllOptions = deselectedOptions.every(deselectedOption => {
|
|
108
|
-
const result = !!selectableSourceOptions.find(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
} = _ref9;
|
|
113
|
-
return label === deselectedOption.label && value === deselectedOption.value;
|
|
114
|
-
});
|
|
92
|
+
const result = !!selectableSourceOptions.find(({
|
|
93
|
+
label,
|
|
94
|
+
value
|
|
95
|
+
}) => label === deselectedOption.label && value === deselectedOption.value);
|
|
115
96
|
return result;
|
|
116
97
|
});
|
|
117
98
|
expect(hasAllOptions).to.equal(true);
|
|
118
99
|
});
|
|
119
100
|
});
|
|
120
101
|
(0, _cypressCucumberPreprocessor.Then)('it should be added to the end of the selected options list', () => {
|
|
121
|
-
cy.all(() => cy.get('@selectedOptions'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
122
|
-
let [transferredOptions, $selectedOptions] = _ref10;
|
|
102
|
+
cy.all(() => cy.get('@selectedOptions'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([transferredOptions, $selectedOptions]) => {
|
|
123
103
|
const lastSelectedOptions = $selectedOptions.toArray().slice(transferredOptions.length * -1).map(_index.extractOptionFromElement);
|
|
124
104
|
expect(transferredOptions).to.eql(lastSelectedOptions);
|
|
125
105
|
});
|
|
126
106
|
});
|
|
127
107
|
(0, _cypressCucumberPreprocessor.Then)('they should be added to the end of the selected options list in the order they have been highlighted', () => {
|
|
128
|
-
cy.all(() => cy.get('@selectedOptions'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
129
|
-
let [transferredOptions, $selectedOptions] = _ref11;
|
|
108
|
+
cy.all(() => cy.get('@selectedOptions'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([transferredOptions, $selectedOptions]) => {
|
|
130
109
|
const lastSelectedOptions = $selectedOptions.toArray().slice(transferredOptions.length * -1).map(_index.extractOptionFromElement);
|
|
131
110
|
expect(transferredOptions).to.eql(lastSelectedOptions);
|
|
132
111
|
});
|
|
@@ -35,8 +35,7 @@ var _index = require("../common/index.js");
|
|
|
35
35
|
cy.visitStory('Transfer filtering', 'Controlled Filter');
|
|
36
36
|
});
|
|
37
37
|
(0, _cypressCucumberPreprocessor.When)('the user uses the same search term but {string}', secondCase => {
|
|
38
|
-
cy.all(() => cy.get('@firstCaseTerm'), () => cy.get('{transfer-filter} input')).then(
|
|
39
|
-
let [firstCaseTerm, $filterInput] = _ref;
|
|
38
|
+
cy.all(() => cy.get('@firstCaseTerm'), () => cy.get('{transfer-filter} input')).then(([firstCaseTerm, $filterInput]) => {
|
|
40
39
|
let secondCaseTerm;
|
|
41
40
|
if (secondCase === 'uppercase') {
|
|
42
41
|
secondCaseTerm = firstCaseTerm.toUpperCase();
|
|
@@ -53,8 +52,7 @@ var _index = require("../common/index.js");
|
|
|
53
52
|
cy.get('{transfer-filter} input').then($input => console.log('$input', $input) || $input).type('ANC');
|
|
54
53
|
});
|
|
55
54
|
(0, _cypressCucumberPreprocessor.Then)('all the matching items should be shown in the options list', () => {
|
|
56
|
-
cy.all(() => cy.get('{transfer-filter}'), () => cy.get('{transferoption}')).should(
|
|
57
|
-
let [$filter, $options] = _ref2;
|
|
55
|
+
cy.all(() => cy.get('{transfer-filter}'), () => cy.get('{transferoption}')).should(([$filter, $options]) => {
|
|
58
56
|
const searchTerm = $filter.val();
|
|
59
57
|
expect($options).to.have.length.of.at.least(1);
|
|
60
58
|
$options.each((index, option) => {
|
|
@@ -72,8 +70,7 @@ var _index = require("../common/index.js");
|
|
|
72
70
|
}).should('exist');
|
|
73
71
|
});
|
|
74
72
|
(0, _cypressCucumberPreprocessor.Then)('the same options should be shown', () => {
|
|
75
|
-
cy.all(() => cy.get('@firstCaseOptions'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
76
|
-
let [$firstCaseOptions, $secondCaseOptions] = _ref3;
|
|
73
|
+
cy.all(() => cy.get('@firstCaseOptions'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([$firstCaseOptions, $secondCaseOptions]) => {
|
|
77
74
|
const firstCaseOptions = $firstCaseOptions.toArray().map(_index.extractOptionFromElement);
|
|
78
75
|
const secondCaseOptions = $secondCaseOptions.toArray().map(_index.extractOptionFromElement);
|
|
79
76
|
expect(firstCaseOptions).to.eql(secondCaseOptions);
|
|
@@ -82,8 +82,7 @@ var _index2 = require("../common/index.js");
|
|
|
82
82
|
cy.get('@initiallyHighlighted').should('have.class', 'highlighted');
|
|
83
83
|
});
|
|
84
84
|
(0, _cypressCucumberPreprocessor.Then)('the option is not highlighted', () => {
|
|
85
|
-
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
86
|
-
let [hiddenHighlighted, $options] = _ref;
|
|
85
|
+
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([hiddenHighlighted, $options]) => {
|
|
87
86
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
88
87
|
const option = (0, _index2.extractOptionFromElement)(optionEl);
|
|
89
88
|
return option.label === hiddenHighlighted.label && option.value === hiddenHighlighted.value;
|
|
@@ -94,8 +93,7 @@ var _index2 = require("../common/index.js");
|
|
|
94
93
|
});
|
|
95
94
|
});
|
|
96
95
|
(0, _cypressCucumberPreprocessor.Then)('the clicked options should be highlighted', () => {
|
|
97
|
-
cy.all(() => cy.get('@initiallyHighlighted'), () => cy.get('@secondBelowInitiallyHighlighted')).should(
|
|
98
|
-
let [$initiallyHighlighted, $secondBelowInitiallyHighlighted] = _ref2;
|
|
96
|
+
cy.all(() => cy.get('@initiallyHighlighted'), () => cy.get('@secondBelowInitiallyHighlighted')).should(([$initiallyHighlighted, $secondBelowInitiallyHighlighted]) => {
|
|
99
97
|
expect($initiallyHighlighted).to.have.class('highlighted');
|
|
100
98
|
expect($secondBelowInitiallyHighlighted).to.have.class('highlighted');
|
|
101
99
|
});
|
|
@@ -113,8 +111,7 @@ var _index2 = require("../common/index.js");
|
|
|
113
111
|
cy.get('@firstBelowInitiallyHighlighted').should('have.class', 'highlighted');
|
|
114
112
|
});
|
|
115
113
|
(0, _cypressCucumberPreprocessor.Then)('all other previously highlighted options are not highlighted anymore', () => {
|
|
116
|
-
cy.all(() => cy.get('@initiallyHighlightedMultiple').last().invoke('index'), () => cy.get('@initiallyHighlightedMultiple')).should(
|
|
117
|
-
let [lastInitiallyHighlightedIndex, $initiallyHighlightedMultiple] = _ref3;
|
|
114
|
+
cy.all(() => cy.get('@initiallyHighlightedMultiple').last().invoke('index'), () => cy.get('@initiallyHighlightedMultiple')).should(([lastInitiallyHighlightedIndex, $initiallyHighlightedMultiple]) => {
|
|
118
115
|
$initiallyHighlightedMultiple.filter((_, el) => {
|
|
119
116
|
const $el = Cypress.$(el);
|
|
120
117
|
return $el.index() !== lastInitiallyHighlightedIndex;
|
|
@@ -125,8 +122,7 @@ var _index2 = require("../common/index.js");
|
|
|
125
122
|
});
|
|
126
123
|
});
|
|
127
124
|
(0, _cypressCucumberPreprocessor.Then)('the range from the visually first highlighted option to the SHIFT-clicked option is highlighted', () => {
|
|
128
|
-
cy.all(() => cy.get('@initiallyHighlightedMultiple'), () => cy.get('@firstShiftClicked'), () => cy.get('@list').find('{transferoption}')).should(
|
|
129
|
-
let [$initiallyHighlightedMultiple, $firstShiftClicked, $all] = _ref4;
|
|
125
|
+
cy.all(() => cy.get('@initiallyHighlightedMultiple'), () => cy.get('@firstShiftClicked'), () => cy.get('@list').find('{transferoption}')).should(([$initiallyHighlightedMultiple, $firstShiftClicked, $all]) => {
|
|
130
126
|
const firstVisibleHighlightedIndex = $initiallyHighlightedMultiple.filter(':visible').eq(0).index();
|
|
131
127
|
const shiftIndex = $firstShiftClicked.index();
|
|
132
128
|
const from = Math.min(firstVisibleHighlightedIndex, shiftIndex);
|
|
@@ -140,8 +136,7 @@ var _index2 = require("../common/index.js");
|
|
|
140
136
|
});
|
|
141
137
|
});
|
|
142
138
|
(0, _cypressCucumberPreprocessor.Then)('the range from the first clicked option to the second clicked option is highlighted', () => {
|
|
143
|
-
cy.all(() => cy.get('@firstClickedIndexWithShift'), () => cy.get('@secondClickedIndexWithShift'), () => cy.get('@list').find('{transferoption}')).should(
|
|
144
|
-
let [firstClickedIndexWithShift, secondClickedIndexWithShift, $all] = _ref5;
|
|
139
|
+
cy.all(() => cy.get('@firstClickedIndexWithShift'), () => cy.get('@secondClickedIndexWithShift'), () => cy.get('@list').find('{transferoption}')).should(([firstClickedIndexWithShift, secondClickedIndexWithShift, $all]) => {
|
|
145
140
|
const from = Math.min(firstClickedIndexWithShift, secondClickedIndexWithShift);
|
|
146
141
|
const to = Math.max(firstClickedIndexWithShift, secondClickedIndexWithShift);
|
|
147
142
|
const $insideRange = $all.slice(from, to + 1);
|
|
@@ -34,15 +34,13 @@ var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preproces
|
|
|
34
34
|
cy.contains('ARI treated with antibiotics (pneumonia) new').should('be.visible');
|
|
35
35
|
});
|
|
36
36
|
(0, _cypressCucumberPreprocessor.Then)('the callback for reaching the end should not be called', () => {
|
|
37
|
-
cy.all(() => cy.window(), () => cy.get('@listType')).should(
|
|
38
|
-
let [win, listType] = _ref;
|
|
37
|
+
cy.all(() => cy.window(), () => cy.get('@listType')).should(([win, listType]) => {
|
|
39
38
|
const callback = listType === 'source' ? win.onEndReached : win.onEndReachedPicked;
|
|
40
39
|
expect(callback).to.not.be.called;
|
|
41
40
|
});
|
|
42
41
|
});
|
|
43
42
|
(0, _cypressCucumberPreprocessor.Then)('the callback for reaching the end should be called', () => {
|
|
44
|
-
cy.all(() => cy.window(), () => cy.get('@listType')).should(
|
|
45
|
-
let [win, listType] = _ref2;
|
|
43
|
+
cy.all(() => cy.window(), () => cy.get('@listType')).should(([win, listType]) => {
|
|
46
44
|
const callback = listType === 'source' ? win.onEndReached : win.onEndReachedPicked;
|
|
47
45
|
expect(callback).to.be.calledOnce;
|
|
48
46
|
});
|
|
@@ -41,8 +41,7 @@ var _index = require("../common/index.js");
|
|
|
41
41
|
cy.get('@initiallyHighlighted').should('have.not.class', 'highlighted');
|
|
42
42
|
});
|
|
43
43
|
(0, _cypressCucumberPreprocessor.Then)('the option is visible', () => {
|
|
44
|
-
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
45
|
-
let [hiddenHighlighted, $options] = _ref;
|
|
44
|
+
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([hiddenHighlighted, $options]) => {
|
|
46
45
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
47
46
|
const option = (0, _index.extractOptionFromElement)(optionEl);
|
|
48
47
|
return option.label === hiddenHighlighted.label && option.value === hiddenHighlighted.value;
|
|
@@ -51,8 +50,7 @@ var _index = require("../common/index.js");
|
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
(0, _cypressCucumberPreprocessor.Then)('the option is highlighted', () => {
|
|
54
|
-
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
55
|
-
let [hiddenHighlighted, $options] = _ref2;
|
|
53
|
+
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([hiddenHighlighted, $options]) => {
|
|
56
54
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
57
55
|
const option = (0, _index.extractOptionFromElement)(optionEl);
|
|
58
56
|
return option.label === hiddenHighlighted.label && option.value === hiddenHighlighted.value;
|
|
@@ -61,8 +59,7 @@ var _index = require("../common/index.js");
|
|
|
61
59
|
});
|
|
62
60
|
});
|
|
63
61
|
(0, _cypressCucumberPreprocessor.Then)('the option is not highlighted', () => {
|
|
64
|
-
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
65
|
-
let [hiddenHighlighted, $options] = _ref3;
|
|
62
|
+
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([hiddenHighlighted, $options]) => {
|
|
66
63
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
67
64
|
const option = (0, _index.extractOptionFromElement)(optionEl);
|
|
68
65
|
return option.label === hiddenHighlighted.label && option.value === hiddenHighlighted.value;
|
|
@@ -45,90 +45,69 @@ var _index = require("../common/index.js");
|
|
|
45
45
|
cy.get('{transfer-pickedoptions} {transferoption}').first().dblclick().then(_index.extractOptionFromElement).as('doubleClickedPlainOption');
|
|
46
46
|
});
|
|
47
47
|
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be removed from the options list', () => {
|
|
48
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
49
|
-
let [itemsToBeSelected, $selectableSourceOptions] = _ref;
|
|
48
|
+
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([itemsToBeSelected, $selectableSourceOptions]) => {
|
|
50
49
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
51
50
|
const itemsStillSelectable = itemsToBeSelected.every(itemToBeSelected => {
|
|
52
|
-
const result = selectableSourceOptions.find(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} = _ref2;
|
|
57
|
-
return label === itemToBeSelected.label && value === itemToBeSelected.value;
|
|
58
|
-
});
|
|
51
|
+
const result = selectableSourceOptions.find(({
|
|
52
|
+
label,
|
|
53
|
+
value
|
|
54
|
+
}) => label === itemToBeSelected.label && value === itemToBeSelected.value);
|
|
59
55
|
return result;
|
|
60
56
|
});
|
|
61
57
|
expect(itemsStillSelectable).to.equal(false);
|
|
62
58
|
});
|
|
63
59
|
});
|
|
64
60
|
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be visible in the selected list', () => {
|
|
65
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
66
|
-
let [itemsToBeSelected, $selectedOptions] = _ref3;
|
|
61
|
+
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([itemsToBeSelected, $selectedOptions]) => {
|
|
67
62
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
68
|
-
const itemsSelected = itemsToBeSelected.every(itemToBeSelected => selectedOptions.find(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} = _ref4;
|
|
73
|
-
return label === itemToBeSelected.label && value === itemToBeSelected.value;
|
|
74
|
-
}));
|
|
63
|
+
const itemsSelected = itemsToBeSelected.every(itemToBeSelected => selectedOptions.find(({
|
|
64
|
+
label,
|
|
65
|
+
value
|
|
66
|
+
}) => label === itemToBeSelected.label && value === itemToBeSelected.value));
|
|
75
67
|
expect(itemsSelected).to.equal(true);
|
|
76
68
|
});
|
|
77
69
|
});
|
|
78
70
|
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be appended to the selected list in the order they were highlighted', () => {
|
|
79
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
80
|
-
let [itemsToBeSelected, $selectedOptions] = _ref5;
|
|
71
|
+
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([itemsToBeSelected, $selectedOptions]) => {
|
|
81
72
|
const lastNSelectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement).slice(itemsToBeSelected.length * -1);
|
|
82
73
|
expect(itemsToBeSelected).to.eql(lastNSelectedOptions);
|
|
83
74
|
});
|
|
84
75
|
});
|
|
85
76
|
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be removed from the selected list', () => {
|
|
86
|
-
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
87
|
-
let [itemsToBeDeselected, $selectedOptions] = _ref6;
|
|
77
|
+
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([itemsToBeDeselected, $selectedOptions]) => {
|
|
88
78
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
89
79
|
const itemsStillSelected = itemsToBeDeselected.every(itemToBeSelected => {
|
|
90
|
-
const result = selectedOptions.find(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} = _ref7;
|
|
95
|
-
return label === itemToBeSelected.label && value === itemToBeSelected.value;
|
|
96
|
-
});
|
|
80
|
+
const result = selectedOptions.find(({
|
|
81
|
+
label,
|
|
82
|
+
value
|
|
83
|
+
}) => label === itemToBeSelected.label && value === itemToBeSelected.value);
|
|
97
84
|
return result;
|
|
98
85
|
});
|
|
99
86
|
expect(itemsStillSelected).to.equal(false);
|
|
100
87
|
});
|
|
101
88
|
});
|
|
102
89
|
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be visible in the options list', () => {
|
|
103
|
-
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
104
|
-
let [itemsToBeDeselected, $selectedOptions] = _ref8;
|
|
90
|
+
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([itemsToBeDeselected, $selectedOptions]) => {
|
|
105
91
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
106
92
|
const itemsSelectable = itemsToBeDeselected.every(itemToBeSelected => {
|
|
107
|
-
const result = selectedOptions.find(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
} = _ref9;
|
|
112
|
-
return label === itemToBeSelected.label && value === itemToBeSelected.value;
|
|
113
|
-
});
|
|
93
|
+
const result = selectedOptions.find(({
|
|
94
|
+
label,
|
|
95
|
+
value
|
|
96
|
+
}) => label === itemToBeSelected.label && value === itemToBeSelected.value);
|
|
114
97
|
return result;
|
|
115
98
|
});
|
|
116
99
|
expect(itemsSelectable).to.equal(true);
|
|
117
100
|
});
|
|
118
101
|
});
|
|
119
102
|
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be in the original options list ordering', () => {
|
|
120
|
-
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
121
|
-
let [win, $selectableSourceOptions, $selectedOptions] = _ref10;
|
|
103
|
+
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([win, $selectableSourceOptions, $selectedOptions]) => {
|
|
122
104
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
123
105
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
124
106
|
const allOptionsWithoutSelected = win.options.filter(option => {
|
|
125
|
-
return !selectedOptions.find(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
} = _ref11;
|
|
130
|
-
return option.label === label && option.value === value;
|
|
131
|
-
});
|
|
107
|
+
return !selectedOptions.find(({
|
|
108
|
+
label,
|
|
109
|
+
value
|
|
110
|
+
}) => option.label === label && option.value === value);
|
|
132
111
|
});
|
|
133
112
|
expect(allOptionsWithoutSelected).to.eql(selectableSourceOptions);
|
|
134
113
|
});
|
|
@@ -137,17 +116,13 @@ var _index = require("../common/index.js");
|
|
|
137
116
|
cy.get('{transfer-sourceoptions} {transferoption}').should('not.exist');
|
|
138
117
|
});
|
|
139
118
|
(0, _cypressCucumberPreprocessor.Then)('all items removed from options list should be visible in the selected list', () => {
|
|
140
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
141
|
-
let [itemsToBeSelected, $selectedOptions] = _ref12;
|
|
119
|
+
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([itemsToBeSelected, $selectedOptions]) => {
|
|
142
120
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
143
121
|
const allSelected = itemsToBeSelected.every(option => {
|
|
144
|
-
return selectedOptions.find(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} = _ref13;
|
|
149
|
-
return option.label === label && option.value === value;
|
|
150
|
-
});
|
|
122
|
+
return selectedOptions.find(({
|
|
123
|
+
label,
|
|
124
|
+
value
|
|
125
|
+
}) => option.label === label && option.value === value);
|
|
151
126
|
});
|
|
152
127
|
expect(allSelected).to.equal(true);
|
|
153
128
|
});
|
|
@@ -156,24 +131,19 @@ var _index = require("../common/index.js");
|
|
|
156
131
|
cy.get('{transfer-pickedoptions} {transferoption}').should('not.exist');
|
|
157
132
|
});
|
|
158
133
|
(0, _cypressCucumberPreprocessor.Then)('all items removed from selected list should be visible in the options list', () => {
|
|
159
|
-
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
160
|
-
let [itemsToBeDeselected, $selectableSourceOptions] = _ref14;
|
|
134
|
+
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([itemsToBeDeselected, $selectableSourceOptions]) => {
|
|
161
135
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
162
136
|
const allSelectable = itemsToBeDeselected.every(option => {
|
|
163
|
-
return selectableSourceOptions.find(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
} = _ref15;
|
|
168
|
-
return option.label === label && option.value === value;
|
|
169
|
-
});
|
|
137
|
+
return selectableSourceOptions.find(({
|
|
138
|
+
label,
|
|
139
|
+
value
|
|
140
|
+
}) => option.label === label && option.value === value);
|
|
170
141
|
});
|
|
171
142
|
expect(allSelectable).to.equal(true);
|
|
172
143
|
});
|
|
173
144
|
});
|
|
174
145
|
(0, _cypressCucumberPreprocessor.Then)('the transferred items should be appended to the selected list in the order they were displayed in the options list', () => {
|
|
175
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
176
|
-
let [itemsToBeSelected, $selectedOptions] = _ref16;
|
|
146
|
+
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([itemsToBeSelected, $selectedOptions]) => {
|
|
177
147
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
178
148
|
const previouslySelectedSubset = selectedOptions.slice(-1 * itemsToBeSelected.length);
|
|
179
149
|
expect(itemsToBeSelected).to.eql(previouslySelectedSubset);
|
|
@@ -182,8 +152,7 @@ var _index = require("../common/index.js");
|
|
|
182
152
|
(0, _cypressCucumberPreprocessor.Then)('the options list items should be ordered in the original order', () => {
|
|
183
153
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('{transfer-pickedoptions}').then($pickedOptions => {
|
|
184
154
|
return $pickedOptions.find((0, _parseSelectorWithDataTest.parseSelectorWithDataTest)('{transferoption}'));
|
|
185
|
-
})).should(
|
|
186
|
-
let [win, $selectableSourceOptions, $pickedOptions] = _ref17;
|
|
155
|
+
})).should(([win, $selectableSourceOptions, $pickedOptions]) => {
|
|
187
156
|
const pickedPlainOptions = $pickedOptions.toArray().map(_index.extractOptionFromElement);
|
|
188
157
|
const originalOrderWithoutSelected = win.options.filter(originalOption => {
|
|
189
158
|
return !pickedPlainOptions.find(pickedPlainOption => pickedPlainOption.value === originalOption.value && pickedPlainOption.label === originalOption.label);
|
|
@@ -193,24 +162,21 @@ var _index = require("../common/index.js");
|
|
|
193
162
|
});
|
|
194
163
|
});
|
|
195
164
|
(0, _cypressCucumberPreprocessor.Then)('the item should be removed from its options list', () => {
|
|
196
|
-
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
197
|
-
let [doubleClickedPlainOption, $sourceOptions] = _ref18;
|
|
165
|
+
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(([doubleClickedPlainOption, $sourceOptions]) => {
|
|
198
166
|
const sourcePlainOptions = $sourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
199
167
|
const found = sourcePlainOptions.find(sourcePlainOption => sourcePlainOption.value === doubleClickedPlainOption.value && sourcePlainOption.label === doubleClickedPlainOption.label);
|
|
200
168
|
expect(found).to.not.equal(true);
|
|
201
169
|
});
|
|
202
170
|
});
|
|
203
171
|
(0, _cypressCucumberPreprocessor.Then)('the item should be visible at the bottom of the selected list', () => {
|
|
204
|
-
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
205
|
-
let [doubleClickedPlainOption, $pickedOptions] = _ref19;
|
|
172
|
+
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([doubleClickedPlainOption, $pickedOptions]) => {
|
|
206
173
|
const lastSourcePlainOption = $pickedOptions.last().toArray().map(_index.extractOptionFromElement).pop();
|
|
207
174
|
const doubleClickedOptionIsLast = lastSourcePlainOption.value === doubleClickedPlainOption.value && lastSourcePlainOption.label === doubleClickedPlainOption.label;
|
|
208
175
|
expect(doubleClickedOptionIsLast).to.equal(true);
|
|
209
176
|
});
|
|
210
177
|
});
|
|
211
178
|
(0, _cypressCucumberPreprocessor.Then)('the item should be removed from the selected list', () => {
|
|
212
|
-
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
213
|
-
let [doubleClickedPlainOption, $pickedOptions] = _ref20;
|
|
179
|
+
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(([doubleClickedPlainOption, $pickedOptions]) => {
|
|
214
180
|
const pickedPlainOptions = $pickedOptions.toArray().map(_index.extractOptionFromElement);
|
|
215
181
|
const found = pickedPlainOptions.find(sourcePlainOption => sourcePlainOption.value === doubleClickedPlainOption.value && sourcePlainOption.label === doubleClickedPlainOption.label);
|
|
216
182
|
expect(found).to.not.equal(true);
|
package/build/cjs/filter.js
CHANGED
|
@@ -11,33 +11,30 @@ var _input = require("@dhis2-ui/input");
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const Filter =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
dynamic: [_uiConstants.spacers.dp8, _uiConstants.spacers.dp8]
|
|
39
|
-
}, [`div.__jsx-style-dynamic-selector{padding-bottom:${_uiConstants.spacers.dp8};}`, `div.__jsx-style-dynamic-selector:first-child{padding-top:${_uiConstants.spacers.dp8};}`]));
|
|
40
|
-
};
|
|
14
|
+
const Filter = ({
|
|
15
|
+
dataTest,
|
|
16
|
+
filter,
|
|
17
|
+
onChange,
|
|
18
|
+
label,
|
|
19
|
+
placeholder
|
|
20
|
+
}) => /*#__PURE__*/_react.default.createElement("div", {
|
|
21
|
+
"data-test": dataTest,
|
|
22
|
+
className: _style.default.dynamic([["3679907342", [_uiConstants.spacers.dp8, _uiConstants.spacers.dp8]]])
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement(_field.Field, {
|
|
24
|
+
label: label,
|
|
25
|
+
name: dataTest,
|
|
26
|
+
dataTest: `${dataTest}-field`
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_input.Input, {
|
|
28
|
+
dense: true,
|
|
29
|
+
dataTest: `${dataTest}-input`,
|
|
30
|
+
type: "search",
|
|
31
|
+
placeholder: placeholder,
|
|
32
|
+
value: filter,
|
|
33
|
+
onChange: onChange
|
|
34
|
+
})), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
35
|
+
id: "3679907342",
|
|
36
|
+
dynamic: [_uiConstants.spacers.dp8, _uiConstants.spacers.dp8]
|
|
37
|
+
}, [`div.__jsx-style-dynamic-selector{padding-bottom:${_uiConstants.spacers.dp8};}`, `div.__jsx-style-dynamic-selector:first-child{padding-top:${_uiConstants.spacers.dp8};}`]));
|
|
41
38
|
exports.Filter = Filter;
|
|
42
39
|
Filter.propTypes = {
|
|
43
40
|
dataTest: _propTypes.default.string.isRequired,
|