@dhis2-ui/transfer 9.4.4 → 9.4.6
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/features/add_remove-highlighted-options/index.js +12 -12
- package/build/cjs/features/disabled-transfer-buttons/index.js +19 -22
- package/build/cjs/features/disabled-transfer-options/index.js +19 -19
- package/build/cjs/features/display-order/index.js +14 -14
- package/build/cjs/features/filter-options-list/index.js +19 -19
- package/build/cjs/features/highlight-range-of-options/index.js +31 -31
- package/build/cjs/features/loading_lists/index.js +7 -7
- package/build/cjs/features/notify_at_end_of_list/index.js +8 -19
- package/build/cjs/features/reorder-with-buttons/index.js +17 -13
- package/build/cjs/features/set_unset-highlighted-option/index.js +15 -15
- package/build/cjs/features/transferring-items/index.js +41 -49
- package/build/es/features/add_remove-highlighted-options/index.js +1 -1
- package/build/es/features/disabled-transfer-buttons/index.js +1 -4
- package/build/es/features/disabled-transfer-options/index.js +1 -1
- package/build/es/features/display-order/index.js +1 -1
- package/build/es/features/filter-options-list/index.js +1 -1
- package/build/es/features/highlight-range-of-options/index.js +1 -1
- package/build/es/features/loading_lists/index.js +1 -1
- package/build/es/features/notify_at_end_of_list/index.js +1 -12
- package/build/es/features/reorder-with-buttons/index.js +8 -4
- package/build/es/features/set_unset-highlighted-option/index.js +1 -1
- package/build/es/features/transferring-items/index.js +15 -23
- package/package.json +7 -7
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
|
-
(0,
|
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('the source list is loading', () => {
|
|
6
6
|
cy.visitStory('Transfer Loading Lists', 'Loading Source');
|
|
7
7
|
cy.wrap('source').as('listType');
|
|
8
8
|
});
|
|
9
|
-
(0,
|
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('the picked list is loading', () => {
|
|
10
10
|
cy.visitStory('Transfer Loading Lists', 'Loading Picked');
|
|
11
11
|
cy.wrap('picked').as('listType');
|
|
12
12
|
});
|
|
13
|
-
(0,
|
|
13
|
+
(0, _cypressCucumberPreprocessor.Given)('the source list is not loading', () => {
|
|
14
14
|
cy.visitStory('Transfer Loading Lists', 'Not Loading Source');
|
|
15
15
|
cy.wrap('source').as('listType');
|
|
16
16
|
});
|
|
17
|
-
(0,
|
|
17
|
+
(0, _cypressCucumberPreprocessor.Given)('the picked list is not loading', () => {
|
|
18
18
|
cy.visitStory('Transfer Loading Lists', 'Not Loading Picked');
|
|
19
19
|
cy.wrap('picked').as('listType');
|
|
20
20
|
});
|
|
21
|
-
(0,
|
|
21
|
+
(0, _cypressCucumberPreprocessor.Then)('the loading indicator should be shown', () => {
|
|
22
22
|
cy.get('@listType').then(listType => {
|
|
23
23
|
const listSelector = listType === 'source' ? '{transfer-leftside}' : '{transfer-rightside}';
|
|
24
24
|
cy.get("".concat(listSelector, " .loading")).should('exist');
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
(0,
|
|
27
|
+
(0, _cypressCucumberPreprocessor.Then)('the loading indicator should not be shown', () => {
|
|
28
28
|
cy.get('@listType').then(listType => {
|
|
29
29
|
const listSelector = listType === 'source' ? '{transfer-leftside}' : '{transfer-rightside}';
|
|
30
30
|
cy.get("".concat(listSelector, " .loading")).should('not.exist');
|
|
@@ -1,48 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
// This prevents a benign error:
|
|
7
|
-
// This error means that ResizeObserver was not able to deliver all
|
|
8
|
-
// observations within a single animation frame. It is benign (your site
|
|
9
|
-
// will not break).
|
|
10
|
-
//
|
|
11
|
-
// Source: https://stackoverflow.com/a/50387233/1319140
|
|
12
|
-
if (err.match(/ResizeObserver loop limit exceeded/)) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
(0, _steps.Given)('the Transfer has enough items to fill the source list completely', () => {
|
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('the Transfer has enough items to fill the source list completely', () => {
|
|
17
6
|
cy.visitStory('Transfer End Of List', 'Full Source List');
|
|
18
7
|
cy.wrap('source').as('listType');
|
|
19
8
|
});
|
|
20
|
-
(0,
|
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('the Transfer has enough items to fill the picked list completely', () => {
|
|
21
10
|
cy.visitStory('Transfer End Of List', 'Full Picked List');
|
|
22
11
|
cy.wrap('picked').as('listType');
|
|
23
12
|
});
|
|
24
|
-
(0,
|
|
13
|
+
(0, _cypressCucumberPreprocessor.Given)('the Transfer does not have enough items to fill the source list completely', () => {
|
|
25
14
|
cy.visitStory('Transfer End Of List', 'Partial Source List');
|
|
26
15
|
cy.wrap('source').as('listType');
|
|
27
16
|
});
|
|
28
|
-
(0,
|
|
17
|
+
(0, _cypressCucumberPreprocessor.Given)('the Transfer does not have enough items to fill the picked list completely', () => {
|
|
29
18
|
cy.visitStory('Transfer End Of List', 'Partial Picked List');
|
|
30
19
|
cy.wrap('picked').as('listType');
|
|
31
20
|
});
|
|
32
|
-
(0,
|
|
21
|
+
(0, _cypressCucumberPreprocessor.When)('the user scroll to the end of the list', () => {
|
|
33
22
|
cy.get('@listType').then(listType => {
|
|
34
23
|
const listSelector = listType === 'source' ? 'transfer-sourceoptions' : 'transfer-pickedoptions';
|
|
35
24
|
cy.get("{".concat(listSelector, "-endintersectiondetector}")).scrollIntoView();
|
|
36
25
|
});
|
|
37
26
|
});
|
|
38
|
-
(0,
|
|
27
|
+
(0, _cypressCucumberPreprocessor.Then)('the callback for reaching the end should not be called', () => {
|
|
39
28
|
cy.all(() => cy.window(), () => cy.get('@listType')).should(_ref => {
|
|
40
29
|
let [win, listType] = _ref;
|
|
41
30
|
const callback = listType === 'source' ? win.onEndReached : win.onEndReachedPicked;
|
|
42
31
|
expect(callback).to.not.be.called;
|
|
43
32
|
});
|
|
44
33
|
});
|
|
45
|
-
(0,
|
|
34
|
+
(0, _cypressCucumberPreprocessor.Then)('the callback for reaching the end should be called', () => {
|
|
46
35
|
cy.all(() => cy.window(), () => cy.get('@listType')).should(_ref2 => {
|
|
47
36
|
let [win, listType] = _ref2;
|
|
48
37
|
const callback = listType === 'source' ? win.onEndReached : win.onEndReachedPicked;
|
|
@@ -1,42 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
|
-
(0,
|
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('reordering of items is enabled', () => {// no op
|
|
6
6
|
});
|
|
7
|
-
(0,
|
|
7
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has three items', () => {
|
|
8
8
|
cy.visitStory('Transfer Reorder Buttons', 'Has Some Selected');
|
|
9
9
|
});
|
|
10
|
-
(0,
|
|
10
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has some items', () => {
|
|
11
11
|
cy.visitStory('Transfer Reorder Buttons', 'Has Some Selected');
|
|
12
12
|
});
|
|
13
|
-
(0,
|
|
14
|
-
const index =
|
|
13
|
+
(0, _cypressCucumberPreprocessor.Given)('the {int}. item is highlighted', previousPosition => {
|
|
14
|
+
const index = previousPosition - 1;
|
|
15
|
+
console.log('> index', index);
|
|
16
|
+
cy.get('{transfer-pickedoptions} {transferoption}').eq(index).invoke('attr', 'data-value').as('previousValue', {
|
|
17
|
+
type: 'static'
|
|
18
|
+
});
|
|
15
19
|
cy.get('{transfer-pickedoptions} {transferoption}').eq(index).as('previous').click();
|
|
16
20
|
});
|
|
17
|
-
(0,
|
|
21
|
+
(0, _cypressCucumberPreprocessor.Given)('no items are highlighted in the list', () => {
|
|
18
22
|
cy.get('{transfer-pickedoptions} {transferoption}.highlighted').should('not.exist');
|
|
19
23
|
});
|
|
20
|
-
(0,
|
|
24
|
+
(0, _cypressCucumberPreprocessor.Given)('more than one item is highlighted in the list', () => {
|
|
21
25
|
cy.get('{transfer-pickedoptions} {transferoption}').filter(index => index < 2).each($option => cy.wrap($option).clickWith('ctrl'));
|
|
22
26
|
});
|
|
23
|
-
(0,
|
|
27
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move up' button", () => {
|
|
24
28
|
// force, so we click disabled buttons
|
|
25
29
|
cy.get('{transfer-reorderingactions-buttonmoveup}').click({
|
|
26
30
|
force: true
|
|
27
31
|
});
|
|
28
32
|
});
|
|
29
|
-
(0,
|
|
33
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move down' button", () => {
|
|
30
34
|
// force, so we click disabled buttons
|
|
31
35
|
cy.get('{transfer-reorderingactions-buttonmovedown}').click({
|
|
32
36
|
force: true
|
|
33
37
|
});
|
|
34
38
|
});
|
|
35
|
-
(0,
|
|
39
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted item should be moved to the {int}. place', next => {
|
|
36
40
|
const index = next - 1;
|
|
37
|
-
cy.get('@
|
|
41
|
+
cy.get('@previousValue').then(previousValue => cy.get("[data-value=\"".concat(previousValue, "\"]"))).invoke('index').should('equal', index);
|
|
38
42
|
});
|
|
39
|
-
(0,
|
|
43
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move up' and 'move down' buttons should be disabled", () => {
|
|
40
44
|
cy.get('{transfer-reorderingactions-buttonmoveup}').should('have.attr', 'disabled');
|
|
41
45
|
cy.get('{transfer-reorderingactions-buttonmovedown}').should('have.attr', 'disabled');
|
|
42
46
|
});
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
5
|
var _index = require("../common/index.js");
|
|
6
6
|
|
|
7
|
-
(0,
|
|
7
|
+
(0, _cypressCucumberPreprocessor.Given)('the option list has one or more items', () => {
|
|
8
8
|
cy.visitStory('Transfer set & unset higlighted options', 'Has Options');
|
|
9
9
|
cy.get('{transfer-sourceoptions}').as('list');
|
|
10
10
|
});
|
|
11
|
-
(0,
|
|
11
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has one or more items', () => {
|
|
12
12
|
cy.visitStory('Transfer set & unset higlighted options', 'Has Selected');
|
|
13
13
|
cy.get('{transfer-pickedoptions}').as('list');
|
|
14
14
|
});
|
|
15
|
-
(0,
|
|
15
|
+
(0, _cypressCucumberPreprocessor.Given)('no item is highlighted', () => {
|
|
16
16
|
cy.get('@list').find('.highlighted').should('not.exist');
|
|
17
17
|
});
|
|
18
|
-
(0,
|
|
18
|
+
(0, _cypressCucumberPreprocessor.Given)('one item is highlighted', () => {
|
|
19
19
|
cy.get('@list').find('{transferoption}').first().as('initiallyHighlighted').click().should('have.class', 'highlighted');
|
|
20
20
|
});
|
|
21
|
-
(0,
|
|
21
|
+
(0, _cypressCucumberPreprocessor.Given)('the highlighted item is not visible due to a set filter', () => {
|
|
22
22
|
// store hidden option because dom reference will be lost
|
|
23
23
|
cy.get('@initiallyHighlighted').then($initiallyHighlighted => (0, _index.extractOptionFromElement)($initiallyHighlighted)).as('hiddenHighlighted');
|
|
24
24
|
cy.get('{transfer-filter} input').type('No result search term');
|
|
25
25
|
cy.get('{transfer-sourceoptions} {transferoption}').should('not.exist');
|
|
26
26
|
});
|
|
27
|
-
(0,
|
|
27
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks an item in the list that is not highlighted', () => {
|
|
28
28
|
cy.get('@list').find('{transferoption}').first().invoke('next').as('nextHighlighted').click();
|
|
29
29
|
});
|
|
30
|
-
(0,
|
|
30
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks an item in the list that is highlighted', () => {
|
|
31
31
|
cy.get('@initiallyHighlighted').wait(500).click();
|
|
32
32
|
});
|
|
33
|
-
(0,
|
|
33
|
+
(0, _cypressCucumberPreprocessor.When)('the user selects the visible, highlighted options', () => {
|
|
34
34
|
cy.get('{transfer-actions-addindividual}').click();
|
|
35
35
|
});
|
|
36
|
-
(0,
|
|
36
|
+
(0, _cypressCucumberPreprocessor.When)('the users changes the filter to include the hidden option', () => {
|
|
37
37
|
cy.get('{transfer-filter} input').clear();
|
|
38
38
|
});
|
|
39
|
-
(0,
|
|
39
|
+
(0, _cypressCucumberPreprocessor.Then)('the clicked item should be highlighted', () => {
|
|
40
40
|
cy.get('@nextHighlighted').should('have.class', 'highlighted');
|
|
41
41
|
});
|
|
42
|
-
(0,
|
|
42
|
+
(0, _cypressCucumberPreprocessor.Then)('the previously highlighted item should no longer be highlighted', () => {
|
|
43
43
|
cy.get('@initiallyHighlighted').should('have.not.class', 'highlighted');
|
|
44
44
|
});
|
|
45
|
-
(0,
|
|
45
|
+
(0, _cypressCucumberPreprocessor.Then)('the option is visible', () => {
|
|
46
46
|
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref => {
|
|
47
47
|
let [hiddenHighlighted, $options] = _ref;
|
|
48
48
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
@@ -52,7 +52,7 @@ var _index = require("../common/index.js");
|
|
|
52
52
|
expect($hiddenHighlighted).to.be.visible;
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
|
-
(0,
|
|
55
|
+
(0, _cypressCucumberPreprocessor.Then)('the option is highlighted', () => {
|
|
56
56
|
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref2 => {
|
|
57
57
|
let [hiddenHighlighted, $options] = _ref2;
|
|
58
58
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
@@ -62,7 +62,7 @@ var _index = require("../common/index.js");
|
|
|
62
62
|
expect($hiddenHighlighted).to.have.class('highlighted');
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
-
(0,
|
|
65
|
+
(0, _cypressCucumberPreprocessor.Then)('the option is not highlighted', () => {
|
|
66
66
|
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref3 => {
|
|
67
67
|
let [hiddenHighlighted, $options] = _ref3;
|
|
68
68
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
5
|
var _parseSelectorWithDataTest = require("../../../../../cypress/support/common/parseSelectorWithDataTest.js");
|
|
6
6
|
|
|
7
7
|
var _index = require("../common/index.js");
|
|
8
8
|
|
|
9
|
-
(0,
|
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('some options are selectable', () => {
|
|
10
10
|
cy.visitStory('Transfer Transferring Items', 'Has Options');
|
|
11
11
|
});
|
|
12
|
-
(0,
|
|
12
|
+
(0, _cypressCucumberPreprocessor.Given)('some options are selected', () => {
|
|
13
13
|
cy.visitStory('Transfer Transferring Items', 'Some Selected');
|
|
14
14
|
});
|
|
15
|
-
(0,
|
|
15
|
+
(0, _cypressCucumberPreprocessor.Given)('one or more items in the options list are highlighted', () => {
|
|
16
16
|
cy.get('{transfer-sourceoptions} {transferoption}').filter(index => index < 3) // shuffle order so we can check they're added in the right order
|
|
17
17
|
.then($options => cy.wrap([$options[2], $options[0], $options[1]])).each($option => cy.wrap($option).clickWith('ctrl')).then($options => $options.toArray().map(_index.extractOptionFromElement)).as('itemsToBeSelected');
|
|
18
18
|
});
|
|
19
|
-
(0,
|
|
19
|
+
(0, _cypressCucumberPreprocessor.Given)('some items in the options list are highlighted', () => {
|
|
20
20
|
cy.get('{transfer-sourceoptions} {transferoption}').filter(index => index < 3) // shuffle order so we can check they're added in the right order
|
|
21
21
|
.then($options => cy.wrap([$options[2], $options[0], $options[1]])).each($option => cy.wrap($option).clickWith('ctrl')).then($options => $options.toArray().map(_index.extractOptionFromElement)).as('itemsToBeSelected');
|
|
22
22
|
});
|
|
23
|
-
(0,
|
|
23
|
+
(0, _cypressCucumberPreprocessor.Given)('some items in the selected list are highlighted', () => {
|
|
24
24
|
cy.get('{transfer-pickedoptions} {transferoption}').filter(index => index < 3) // shuffle order so we can check they're added in the right order
|
|
25
25
|
.then($options => cy.wrap([$options[2], $options[0], $options[1]])).each($option => cy.wrap($option).clickWith('ctrl')).then($options => $options.toArray().map(_index.extractOptionFromElement)).as('itemsToBeDeselected');
|
|
26
26
|
});
|
|
27
|
-
(0,
|
|
27
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move to selected list' button", () => {
|
|
28
28
|
cy.get('{transfer-actions-addindividual}').click();
|
|
29
29
|
});
|
|
30
|
-
(0,
|
|
30
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move to options list' button", () => {
|
|
31
31
|
cy.get('{transfer-actions-removeindividual}').click();
|
|
32
32
|
});
|
|
33
|
-
(0,
|
|
33
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move all to selected list' button", () => {
|
|
34
34
|
cy.get('{transfer-sourceoptions} {transferoption}').then($options => $options.toArray().map(_index.extractOptionFromElement)).as('itemsToBeSelected');
|
|
35
35
|
cy.get('{transfer-actions-addall}').click();
|
|
36
36
|
});
|
|
37
|
-
(0,
|
|
37
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move all to options list' button", () => {
|
|
38
38
|
cy.get('{transfer-pickedoptions} {transferoption}').then($options => $options.toArray().map(_index.extractOptionFromElement)).as('itemsToBeDeselected');
|
|
39
39
|
cy.get('{transfer-actions-removeall}').click();
|
|
40
40
|
});
|
|
41
|
-
(0,
|
|
41
|
+
(0, _cypressCucumberPreprocessor.When)('the user double clicks an item in the options list', () => {
|
|
42
42
|
cy.get('{transfer-sourceoptions} {transferoption}').first().dblclick().then(_index.extractOptionFromElement).as('doubleClickedPlainOption');
|
|
43
43
|
});
|
|
44
|
-
(0,
|
|
44
|
+
(0, _cypressCucumberPreprocessor.When)('the user double clicks an item in the selected list', () => {
|
|
45
45
|
cy.get('{transfer-pickedoptions} {transferoption}').first().dblclick().then(_index.extractOptionFromElement).as('doubleClickedPlainOption');
|
|
46
46
|
});
|
|
47
|
-
(0,
|
|
47
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be removed from the options list', () => {
|
|
48
48
|
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref => {
|
|
49
49
|
let [itemsToBeSelected, $selectableSourceOptions] = _ref;
|
|
50
50
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -61,7 +61,7 @@ var _index = require("../common/index.js");
|
|
|
61
61
|
expect(itemsStillSelectable).to.equal(false);
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
|
-
(0,
|
|
64
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be visible in the selected list', () => {
|
|
65
65
|
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref3 => {
|
|
66
66
|
let [itemsToBeSelected, $selectedOptions] = _ref3;
|
|
67
67
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -75,14 +75,14 @@ var _index = require("../common/index.js");
|
|
|
75
75
|
expect(itemsSelected).to.equal(true);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
(0,
|
|
78
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be appended to the selected list in the order they were highlighted', () => {
|
|
79
79
|
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref5 => {
|
|
80
80
|
let [itemsToBeSelected, $selectedOptions] = _ref5;
|
|
81
81
|
const lastNSelectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement).slice(itemsToBeSelected.length * -1);
|
|
82
82
|
expect(itemsToBeSelected).to.eql(lastNSelectedOptions);
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
|
-
(0,
|
|
85
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be removed from the selected list', () => {
|
|
86
86
|
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref6 => {
|
|
87
87
|
let [itemsToBeDeselected, $selectedOptions] = _ref6;
|
|
88
88
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -99,7 +99,7 @@ var _index = require("../common/index.js");
|
|
|
99
99
|
expect(itemsStillSelected).to.equal(false);
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
|
-
(0,
|
|
102
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be visible in the options list', () => {
|
|
103
103
|
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref8 => {
|
|
104
104
|
let [itemsToBeDeselected, $selectedOptions] = _ref8;
|
|
105
105
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -116,7 +116,7 @@ var _index = require("../common/index.js");
|
|
|
116
116
|
expect(itemsSelectable).to.equal(true);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
-
(0,
|
|
119
|
+
(0, _cypressCucumberPreprocessor.Then)('the highlighted items should be in the original options list ordering', () => {
|
|
120
120
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref10 => {
|
|
121
121
|
let [win, $selectableSourceOptions, $selectedOptions] = _ref10;
|
|
122
122
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -133,10 +133,10 @@ var _index = require("../common/index.js");
|
|
|
133
133
|
expect(allOptionsWithoutSelected).to.eql(selectableSourceOptions);
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
-
(0,
|
|
136
|
+
(0, _cypressCucumberPreprocessor.Then)('all items should be removed from the options list', () => {
|
|
137
137
|
cy.get('{transfer-sourceoptions} {transferoption}').should('not.exist');
|
|
138
138
|
});
|
|
139
|
-
(0,
|
|
139
|
+
(0, _cypressCucumberPreprocessor.Then)('all items removed from options list should be visible in the selected list', () => {
|
|
140
140
|
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref12 => {
|
|
141
141
|
let [itemsToBeSelected, $selectedOptions] = _ref12;
|
|
142
142
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -152,46 +152,38 @@ var _index = require("../common/index.js");
|
|
|
152
152
|
expect(allSelected).to.equal(true);
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
|
-
(0,
|
|
156
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref14 => {
|
|
157
|
-
let [itemsToBeSelected, $selectedOptions] = _ref14;
|
|
158
|
-
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
159
|
-
const previouslySelectedSubset = selectedOptions.slice(-1 * itemsToBeSelected.length);
|
|
160
|
-
expect(itemsToBeSelected).to.eql(previouslySelectedSubset);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
(0, _steps.Then)('all items should be removed from the selected list', () => {
|
|
155
|
+
(0, _cypressCucumberPreprocessor.Then)('all items should be removed from the selected list', () => {
|
|
164
156
|
cy.get('{transfer-pickedoptions} {transferoption}').should('not.exist');
|
|
165
157
|
});
|
|
166
|
-
(0,
|
|
167
|
-
cy.all(() => cy.get('@itemsToBeDeselected'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
168
|
-
let [itemsToBeDeselected, $selectableSourceOptions] =
|
|
158
|
+
(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(_ref14 => {
|
|
160
|
+
let [itemsToBeDeselected, $selectableSourceOptions] = _ref14;
|
|
169
161
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
170
162
|
const allSelectable = itemsToBeDeselected.every(option => {
|
|
171
|
-
return selectableSourceOptions.find(
|
|
163
|
+
return selectableSourceOptions.find(_ref15 => {
|
|
172
164
|
let {
|
|
173
165
|
label,
|
|
174
166
|
value
|
|
175
|
-
} =
|
|
167
|
+
} = _ref15;
|
|
176
168
|
return option.label === label && option.value === value;
|
|
177
169
|
});
|
|
178
170
|
});
|
|
179
171
|
expect(allSelectable).to.equal(true);
|
|
180
172
|
});
|
|
181
173
|
});
|
|
182
|
-
(0,
|
|
183
|
-
cy.all(() => cy.get('@itemsToBeSelected'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
184
|
-
let [itemsToBeSelected, $selectedOptions] =
|
|
174
|
+
(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(_ref16 => {
|
|
176
|
+
let [itemsToBeSelected, $selectedOptions] = _ref16;
|
|
185
177
|
const selectedOptions = $selectedOptions.toArray().map(_index.extractOptionFromElement);
|
|
186
178
|
const previouslySelectedSubset = selectedOptions.slice(-1 * itemsToBeSelected.length);
|
|
187
179
|
expect(itemsToBeSelected).to.eql(previouslySelectedSubset);
|
|
188
180
|
});
|
|
189
181
|
});
|
|
190
|
-
(0,
|
|
182
|
+
(0, _cypressCucumberPreprocessor.Then)('the options list items should be ordered in the original order', () => {
|
|
191
183
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('{transfer-pickedoptions}').then($pickedOptions => {
|
|
192
184
|
return $pickedOptions.find((0, _parseSelectorWithDataTest.parseSelectorWithDataTest)('{transferoption}'));
|
|
193
|
-
})).should(
|
|
194
|
-
let [win, $selectableSourceOptions, $pickedOptions] =
|
|
185
|
+
})).should(_ref17 => {
|
|
186
|
+
let [win, $selectableSourceOptions, $pickedOptions] = _ref17;
|
|
195
187
|
const pickedPlainOptions = $pickedOptions.toArray().map(_index.extractOptionFromElement);
|
|
196
188
|
const originalOrderWithoutSelected = win.options.filter(originalOption => {
|
|
197
189
|
return !pickedPlainOptions.find(pickedPlainOption => pickedPlainOption.value === originalOption.value && pickedPlainOption.label === originalOption.label);
|
|
@@ -200,25 +192,25 @@ var _index = require("../common/index.js");
|
|
|
200
192
|
expect(originalOrderWithoutSelected).to.eql(selectableSourceOptions);
|
|
201
193
|
});
|
|
202
194
|
});
|
|
203
|
-
(0,
|
|
204
|
-
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(
|
|
205
|
-
let [doubleClickedPlainOption, $sourceOptions] =
|
|
195
|
+
(0, _cypressCucumberPreprocessor.Then)('the item should be removed from its options list', () => {
|
|
196
|
+
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref18 => {
|
|
197
|
+
let [doubleClickedPlainOption, $sourceOptions] = _ref18;
|
|
206
198
|
const sourcePlainOptions = $sourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
207
199
|
const found = sourcePlainOptions.find(sourcePlainOption => sourcePlainOption.value === doubleClickedPlainOption.value && sourcePlainOption.label === doubleClickedPlainOption.label);
|
|
208
200
|
expect(found).to.not.equal(true);
|
|
209
201
|
});
|
|
210
202
|
});
|
|
211
|
-
(0,
|
|
212
|
-
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
213
|
-
let [doubleClickedPlainOption, $pickedOptions] =
|
|
203
|
+
(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(_ref19 => {
|
|
205
|
+
let [doubleClickedPlainOption, $pickedOptions] = _ref19;
|
|
214
206
|
const lastSourcePlainOption = $pickedOptions.last().toArray().map(_index.extractOptionFromElement).pop();
|
|
215
207
|
const doubleClickedOptionIsLast = lastSourcePlainOption.value === doubleClickedPlainOption.value && lastSourcePlainOption.label === doubleClickedPlainOption.label;
|
|
216
208
|
expect(doubleClickedOptionIsLast).to.equal(true);
|
|
217
209
|
});
|
|
218
210
|
});
|
|
219
|
-
(0,
|
|
220
|
-
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(
|
|
221
|
-
let [doubleClickedPlainOption, $pickedOptions] =
|
|
211
|
+
(0, _cypressCucumberPreprocessor.Then)('the item should be removed from the selected list', () => {
|
|
212
|
+
cy.all(() => cy.get('@doubleClickedPlainOption'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref20 => {
|
|
213
|
+
let [doubleClickedPlainOption, $pickedOptions] = _ref20;
|
|
222
214
|
const pickedPlainOptions = $pickedOptions.toArray().map(_index.extractOptionFromElement);
|
|
223
215
|
const found = pickedPlainOptions.find(sourcePlainOption => sourcePlainOption.value === doubleClickedPlainOption.value && sourcePlainOption.label === doubleClickedPlainOption.label);
|
|
224
216
|
expect(found).to.not.equal(true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('the option list has two or more items', () => {
|
|
3
3
|
cy.visitStory('Transfer add & remove highlighted options', 'Has Options');
|
|
4
4
|
cy.get('{transfer-sourceoptions}').as('list');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('the options list has items', () => {
|
|
3
3
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'Has Options');
|
|
4
4
|
});
|
|
@@ -14,9 +14,6 @@ Given('all options have been selected', () => {
|
|
|
14
14
|
Given('the selected list does not have items', () => {
|
|
15
15
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'Has Options');
|
|
16
16
|
});
|
|
17
|
-
Given('the selected list has items', () => {
|
|
18
|
-
cy.visitStory('Transfer Disabled Transfer Buttons', 'Some Options Selected');
|
|
19
|
-
});
|
|
20
17
|
Given('no option items are highlighted', () => {
|
|
21
18
|
cy.get('[data-test="dhis2-uicore-transfer-sourceoptions"] [data-test="dhis2-uicore-transferoption"]').each($option => cy.wrap($option).should('not.have.class', 'highlighted'));
|
|
22
19
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
import { extractOptionFromElement } from '../common/index.js';
|
|
3
3
|
const enabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}:not(.disabled)';
|
|
4
4
|
const disabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}.disabled';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
import { extractOptionFromElement } from '../common/index.js';
|
|
3
3
|
Given('none of the supplied options have been selected', () => {
|
|
4
4
|
cy.visitStory('Transfer Display Order', 'No Selection');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
import { extractOptionFromElement } from '../common/index.js';
|
|
3
3
|
Given('the option list has one or more items', () => {
|
|
4
4
|
cy.visitStory('Transfer highlight range of options', 'Has Options');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('the source list is loading', () => {
|
|
3
3
|
cy.visitStory('Transfer Loading Lists', 'Loading Source');
|
|
4
4
|
cy.wrap('source').as('listType');
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
2
|
-
Cypress.on('uncaught:exception', err => {
|
|
3
|
-
// This prevents a benign error:
|
|
4
|
-
// This error means that ResizeObserver was not able to deliver all
|
|
5
|
-
// observations within a single animation frame. It is benign (your site
|
|
6
|
-
// will not break).
|
|
7
|
-
//
|
|
8
|
-
// Source: https://stackoverflow.com/a/50387233/1319140
|
|
9
|
-
if (err.match(/ResizeObserver loop limit exceeded/)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
13
2
|
Given('the Transfer has enough items to fill the source list completely', () => {
|
|
14
3
|
cy.visitStory('Transfer End Of List', 'Full Source List');
|
|
15
4
|
cy.wrap('source').as('listType');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('reordering of items is enabled', () => {// no op
|
|
3
3
|
});
|
|
4
4
|
Given('the selected list has three items', () => {
|
|
@@ -7,8 +7,12 @@ Given('the selected list has three items', () => {
|
|
|
7
7
|
Given('the selected list has some items', () => {
|
|
8
8
|
cy.visitStory('Transfer Reorder Buttons', 'Has Some Selected');
|
|
9
9
|
});
|
|
10
|
-
Given('the {int}. item is highlighted',
|
|
11
|
-
const index =
|
|
10
|
+
Given('the {int}. item is highlighted', previousPosition => {
|
|
11
|
+
const index = previousPosition - 1;
|
|
12
|
+
console.log('> index', index);
|
|
13
|
+
cy.get('{transfer-pickedoptions} {transferoption}').eq(index).invoke('attr', 'data-value').as('previousValue', {
|
|
14
|
+
type: 'static'
|
|
15
|
+
});
|
|
12
16
|
cy.get('{transfer-pickedoptions} {transferoption}').eq(index).as('previous').click();
|
|
13
17
|
});
|
|
14
18
|
Given('no items are highlighted in the list', () => {
|
|
@@ -31,7 +35,7 @@ When("the user clicks the 'move down' button", () => {
|
|
|
31
35
|
});
|
|
32
36
|
Then('the highlighted item should be moved to the {int}. place', next => {
|
|
33
37
|
const index = next - 1;
|
|
34
|
-
cy.get('@
|
|
38
|
+
cy.get('@previousValue').then(previousValue => cy.get("[data-value=\"".concat(previousValue, "\"]"))).invoke('index').should('equal', index);
|
|
35
39
|
});
|
|
36
40
|
Then("the 'move up' and 'move down' buttons should be disabled", () => {
|
|
37
41
|
cy.get('{transfer-reorderingactions-buttonmoveup}').should('have.attr', 'disabled');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor
|
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
import { extractOptionFromElement } from '../common/index.js';
|
|
3
3
|
Given('the option list has one or more items', () => {
|
|
4
4
|
cy.visitStory('Transfer set & unset higlighted options', 'Has Options');
|