@dhis2-ui/transfer 9.5.0-alpha.1 → 9.5.0
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,52 +1,52 @@
|
|
|
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 option list has two or more items', () => {
|
|
6
6
|
cy.visitStory('Transfer add & remove highlighted options', 'Has Options');
|
|
7
7
|
cy.get('{transfer-sourceoptions}').as('list');
|
|
8
8
|
});
|
|
9
|
-
(0,
|
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has two or more items', () => {
|
|
10
10
|
cy.visitStory('Transfer add & remove highlighted options', 'Has Selected');
|
|
11
11
|
cy.get('{transfer-pickedoptions}').as('list');
|
|
12
12
|
});
|
|
13
|
-
(0,
|
|
13
|
+
(0, _cypressCucumberPreprocessor.Given)('some items are highlighted', () => {
|
|
14
14
|
cy.get('@list').find('{transferoption}').then($options => {
|
|
15
15
|
const multipleOptions = $options.filter(index => index < 3);
|
|
16
16
|
return cy.wrap(multipleOptions);
|
|
17
17
|
}).as('highlightedMultipleOptions').each($option => cy.wrap($option).clickWith('ctrl'));
|
|
18
18
|
});
|
|
19
|
-
(0,
|
|
19
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks multiple items with {string} which are not highlighted', modifierKey => {
|
|
20
20
|
cy.get('@list').find('{transferoption}').then($options => {
|
|
21
21
|
const multipleOptions = $options.filter(index => index < 3);
|
|
22
22
|
return cy.wrap(multipleOptions);
|
|
23
23
|
}).as('multipleOptions').each($option => cy.wrap($option).clickWith(modifierKey === 'cmd' ? 'meta' : modifierKey));
|
|
24
24
|
});
|
|
25
|
-
(0,
|
|
25
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks on one item with {string} which is highlighted', modifierKey => {
|
|
26
26
|
cy.get('@highlightedMultipleOptions').first().clickWith(modifierKey === 'cmd' ? 'meta' : modifierKey).as('clickedOption');
|
|
27
27
|
cy.get('@highlightedMultipleOptions').filter(index => index !== 0).as('remainingHighlightedOptions');
|
|
28
28
|
});
|
|
29
|
-
(0,
|
|
29
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks on one item without a modifier key which is highlighted', () => {
|
|
30
30
|
cy.get('@highlightedMultipleOptions').first().click().as('clickedOption');
|
|
31
31
|
cy.get('@highlightedMultipleOptions').filter(index => index !== 0).as('remainingHighlightedOptions');
|
|
32
32
|
});
|
|
33
|
-
(0,
|
|
33
|
+
(0, _cypressCucumberPreprocessor.Then)('all of the clicked items should be highlighted', () => {
|
|
34
34
|
cy.get('@multipleOptions').each($option => {
|
|
35
35
|
expect($option).to.have.class('highlighted');
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
|
-
(0,
|
|
38
|
+
(0, _cypressCucumberPreprocessor.Then)('the clicked item should not be highlighted', () => {
|
|
39
39
|
cy.get('@clickedOption').should('not.have.class', 'highlighted');
|
|
40
40
|
});
|
|
41
|
-
(0,
|
|
41
|
+
(0, _cypressCucumberPreprocessor.Then)('the other previously highlighted items should remain highlighted', () => {
|
|
42
42
|
cy.get('@remainingHighlightedOptions').each($option => {
|
|
43
43
|
expect($option).to.have.class('highlighted');
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
(0,
|
|
46
|
+
(0, _cypressCucumberPreprocessor.Then)('the clicked option is highlighted', () => {
|
|
47
47
|
cy.get('@clickedOption').should('have.class', 'highlighted');
|
|
48
48
|
});
|
|
49
|
-
(0,
|
|
49
|
+
(0, _cypressCucumberPreprocessor.Then)('the other previously highlighted items should not be highlighted', () => {
|
|
50
50
|
cy.get('@remainingHighlightedOptions').each($option => {
|
|
51
51
|
expect($option).to.not.have.class('highlighted');
|
|
52
52
|
});
|
|
@@ -1,65 +1,62 @@
|
|
|
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 options list has items', () => {
|
|
6
6
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'Has Options');
|
|
7
7
|
});
|
|
8
|
-
(0,
|
|
8
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has items', () => {
|
|
9
9
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'Some Options Selected');
|
|
10
10
|
});
|
|
11
|
-
(0,
|
|
11
|
+
(0, _cypressCucumberPreprocessor.Given)('the transfer does not have any options', () => {
|
|
12
12
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'No Options');
|
|
13
13
|
});
|
|
14
|
-
(0,
|
|
14
|
+
(0, _cypressCucumberPreprocessor.Given)('all options have been selected', () => {
|
|
15
15
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'All Options Selected');
|
|
16
16
|
});
|
|
17
|
-
(0,
|
|
17
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list does not have items', () => {
|
|
18
18
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'Has Options');
|
|
19
19
|
});
|
|
20
|
-
(0,
|
|
21
|
-
cy.visitStory('Transfer Disabled Transfer Buttons', 'Some Options Selected');
|
|
22
|
-
});
|
|
23
|
-
(0, _steps.Given)('no option items are highlighted', () => {
|
|
20
|
+
(0, _cypressCucumberPreprocessor.Given)('no option items are highlighted', () => {
|
|
24
21
|
cy.get('[data-test="dhis2-uicore-transfer-sourceoptions"] [data-test="dhis2-uicore-transferoption"]').each($option => cy.wrap($option).should('not.have.class', 'highlighted'));
|
|
25
22
|
});
|
|
26
|
-
(0,
|
|
23
|
+
(0, _cypressCucumberPreprocessor.Given)('some option items are highlighted', () => {
|
|
27
24
|
cy.get('[data-test="dhis2-uicore-transfer-sourceoptions"] [data-test="dhis2-uicore-transferoption"]').first().click();
|
|
28
25
|
});
|
|
29
|
-
(0,
|
|
26
|
+
(0, _cypressCucumberPreprocessor.Given)('no selected items are highlighted', () => {
|
|
30
27
|
cy.get('[data-test="dhis2-uicore-transfer-pickedoptions"] [data-test="dhis2-uicore-transferoption"]').each($option => cy.wrap($option).should('not.have.class', 'highlighted'));
|
|
31
28
|
});
|
|
32
|
-
(0,
|
|
29
|
+
(0, _cypressCucumberPreprocessor.Given)('some selected items are highlighted', () => {
|
|
33
30
|
cy.get('[data-test="dhis2-uicore-transfer-pickedoptions"] [data-test="dhis2-uicore-transferoption"]').first().click();
|
|
34
31
|
});
|
|
35
|
-
(0,
|
|
32
|
+
(0, _cypressCucumberPreprocessor.Given)('a source list that has only disabled options', () => {
|
|
36
33
|
cy.visitStory('Transfer Disabled Transfer Buttons', 'Only Disabled Source Options');
|
|
37
34
|
});
|
|
38
|
-
(0,
|
|
35
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move to picked list' button should be disabled", () => {
|
|
39
36
|
cy.get('[data-test="dhis2-uicore-transfer-actions-addindividual"][disabled]').should('exist');
|
|
40
37
|
});
|
|
41
|
-
(0,
|
|
38
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move to picked list' button should be enabled", () => {
|
|
42
39
|
cy.get('[data-test="dhis2-uicore-transfer-actions-addindividual"]').should('exist');
|
|
43
40
|
cy.get('[data-test="dhis2-uicore-transfer-actions-addindividual"][disabled]').should('not.exist');
|
|
44
41
|
});
|
|
45
|
-
(0,
|
|
42
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move to source list' button should be disabled", () => {
|
|
46
43
|
cy.get('[data-test="dhis2-uicore-transfer-actions-removeindividual"][disabled]').should('exist');
|
|
47
44
|
});
|
|
48
|
-
(0,
|
|
45
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move to source list' button should be enabled", () => {
|
|
49
46
|
cy.get('[data-test="dhis2-uicore-transfer-actions-removeindividual"]').should('exist');
|
|
50
47
|
cy.get('[data-test="dhis2-uicore-transfer-actions-removeindividual"][disabled]').should('not.exist');
|
|
51
48
|
});
|
|
52
|
-
(0,
|
|
49
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move all to picked list' button should be disabled", () => {
|
|
53
50
|
cy.get('[data-test="dhis2-uicore-transfer-actions-addall"][disabled]').should('exist');
|
|
54
51
|
});
|
|
55
|
-
(0,
|
|
52
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move all to picked list' button should be enabled", () => {
|
|
56
53
|
cy.get('[data-test="dhis2-uicore-transfer-actions-addall"]').should('exist');
|
|
57
54
|
cy.get('[data-test="dhis2-uicore-transfer-actions-addall"][disabled]').should('not.exist');
|
|
58
55
|
});
|
|
59
|
-
(0,
|
|
56
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move all to source list' button should be disabled", () => {
|
|
60
57
|
cy.get('[data-test="dhis2-uicore-transfer-actions-removeall"][disabled]').should('exist');
|
|
61
58
|
});
|
|
62
|
-
(0,
|
|
59
|
+
(0, _cypressCucumberPreprocessor.Then)("the 'move all to source list' button should be enabled", () => {
|
|
63
60
|
cy.get('[data-test="dhis2-uicore-transfer-actions-removeall"]').should('exist');
|
|
64
61
|
cy.get('[data-test="dhis2-uicore-transfer-actions-removeall"][disabled]').should('not.exist');
|
|
65
62
|
});
|
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
5
|
var _index2 = require("../common/index.js");
|
|
6
6
|
|
|
7
7
|
const enabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}:not(.disabled)';
|
|
8
8
|
const disabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}.disabled';
|
|
9
|
-
(0,
|
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('a source list that contains a disabled option', () => {
|
|
10
10
|
cy.visitStory('Disabled Source Options', 'One Disabled');
|
|
11
11
|
cy.get(disabledSourceOptionSelector).first().as('disabledSourceOption').should('exist');
|
|
12
12
|
});
|
|
13
|
-
(0,
|
|
13
|
+
(0, _cypressCucumberPreprocessor.Given)('a source list that contains at least one disabled option and at least one enabled option', () => {
|
|
14
14
|
cy.visitStory('Disabled Source Options', 'One Disabled');
|
|
15
15
|
cy.get(disabledSourceOptionSelector).first().as('disabledSourceOption').should('exist');
|
|
16
16
|
cy.get(enabledSourceOptionSelector).as('enabledSourceOptions').should('exist');
|
|
17
17
|
});
|
|
18
|
-
(0,
|
|
18
|
+
(0, _cypressCucumberPreprocessor.Given)('a source list that contains at least one disabled option and at least one enabled highlighted option', () => {
|
|
19
19
|
cy.visitStory('Disabled Source Options', 'One Disabled');
|
|
20
20
|
cy.get(disabledSourceOptionSelector).first().as('disabledSourceOption').should('exist');
|
|
21
21
|
cy.get(enabledSourceOptionSelector).invoke('slice', 0, 2).as('enabledHighlightedSourceOptions').each($option => cy.wrap($option).click()).should('have.class', 'highlighted');
|
|
22
22
|
});
|
|
23
|
-
(0,
|
|
23
|
+
(0, _cypressCucumberPreprocessor.Given)('a source list that contains at least one disabled option and several enabled options', () => {
|
|
24
24
|
cy.visitStory('Disabled Source Options', 'One Disabled');
|
|
25
25
|
cy.get(disabledSourceOptionSelector).first().as('disabledSourceOption').should('exist');
|
|
26
26
|
cy.get(enabledSourceOptionSelector).as('enabledSourceOptions').should('have.length.of.at.least', 2);
|
|
27
27
|
});
|
|
28
|
-
(0,
|
|
28
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks a disabled option', () => {
|
|
29
29
|
cy.get(disabledSourceOptionSelector).click().as('clickedDisabledOption');
|
|
30
30
|
});
|
|
31
|
-
(0,
|
|
31
|
+
(0, _cypressCucumberPreprocessor.When)('the user double clicks a disabled option', () => {
|
|
32
32
|
cy.get(disabledSourceOptionSelector).dblclick().as('doubleClickedDisabledOption');
|
|
33
33
|
});
|
|
34
|
-
(0,
|
|
34
|
+
(0, _cypressCucumberPreprocessor.When)("the user clicks the 'move all to picked list' button", () => {
|
|
35
35
|
cy.get('{transfer-actions-addall}').click();
|
|
36
36
|
});
|
|
37
|
-
(0,
|
|
37
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks the disabled item with {string}', type => {
|
|
38
38
|
cy.get(disabledSourceOptionSelector).clickWith(type).as('clickedWithModifierDisabledOption');
|
|
39
39
|
});
|
|
40
|
-
(0,
|
|
40
|
+
(0, _cypressCucumberPreprocessor.When)('the user SHIFT+clicks the disabled item', () => {
|
|
41
41
|
cy.get(disabledSourceOptionSelector).clickWith('shift').as('clickedWithShiftDisabledOption');
|
|
42
42
|
});
|
|
43
|
-
(0,
|
|
43
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks an enabled option', () => {
|
|
44
44
|
cy.get(enabledSourceOptionSelector).first().click().as('clickedEnabledOption');
|
|
45
45
|
});
|
|
46
|
-
(0,
|
|
46
|
+
(0, _cypressCucumberPreprocessor.When)('SHIFT+clicks another enabled option, including a disabled item in the range of options', () => {
|
|
47
47
|
cy.get(disabledSourceOptionSelector).next().clickWith('shift').as('clickedWithShiftEnabledOption');
|
|
48
48
|
});
|
|
49
|
-
(0,
|
|
49
|
+
(0, _cypressCucumberPreprocessor.Then)('the disabled option is not highlighted', () => {
|
|
50
50
|
cy.get('@disabledSourceOption').should('not.have.class', 'highlighted');
|
|
51
51
|
});
|
|
52
|
-
(0,
|
|
52
|
+
(0, _cypressCucumberPreprocessor.Then)('the disabled option is not transferred to the picked list', () => {
|
|
53
53
|
// if the aliased element still exists, it hasn't been removed
|
|
54
54
|
// from the source list. Transferring does not need to be tested
|
|
55
55
|
// here as that's covered by another test
|
|
56
56
|
cy.get('@disabledSourceOption').should('exist');
|
|
57
57
|
});
|
|
58
|
-
(0,
|
|
58
|
+
(0, _cypressCucumberPreprocessor.Then)('the disabled options are not transferred to the picked list', () => {
|
|
59
59
|
// if the aliased element still exists, it hasn't been removed
|
|
60
60
|
// from the source list. Transferring does not need to be tested
|
|
61
61
|
// here as that's covered by another test
|
|
62
62
|
cy.get('@disabledSourceOption').should('exist');
|
|
63
63
|
});
|
|
64
|
-
(0,
|
|
64
|
+
(0, _cypressCucumberPreprocessor.Then)('the enabled options are transferred to the picked list', () => {
|
|
65
65
|
// if the aliased elements don't exist, it hasn't been removed
|
|
66
66
|
// from the source list. Transferring does not need to be tested
|
|
67
67
|
// here as that's covered by another test
|
|
68
68
|
cy.get('@enabledSourceOptions').should('not.exist');
|
|
69
69
|
});
|
|
70
|
-
(0,
|
|
70
|
+
(0, _cypressCucumberPreprocessor.Then)('the previously highlighted items are still highlighted', () => {
|
|
71
71
|
cy.get('@enabledHighlightedSourceOptions').should('have.class', 'highlighted');
|
|
72
72
|
});
|
|
73
|
-
(0,
|
|
73
|
+
(0, _cypressCucumberPreprocessor.Then)('only the previously highlighted items are highlighted', () => {
|
|
74
74
|
cy.get('@enabledHighlightedSourceOptions').should('have.class', 'highlighted');
|
|
75
75
|
cy.all(() => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@enabledHighlightedSourceOptions')).should(_ref => {
|
|
76
76
|
let [$sourceOptions, $previouslyHighlightedOptions] = _ref;
|
|
@@ -85,7 +85,7 @@ const disabledSourceOptionSelector = '{transfer-sourceoptions} {transferoption}.
|
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
(0,
|
|
88
|
+
(0, _cypressCucumberPreprocessor.Then)('the enabled options in the range are highlighted', () => {
|
|
89
89
|
cy.all(() => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@clickedEnabledOption'), () => cy.get('@clickedWithShiftEnabledOption')).should(_ref2 => {
|
|
90
90
|
let [$all, $clickedEnabledOption, $clickedWithShiftEnabledOption] = _ref2;
|
|
91
91
|
const from = $clickedEnabledOption.index();
|
|
@@ -1,24 +1,24 @@
|
|
|
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)('none of the supplied options have been selected', () => {
|
|
8
8
|
cy.visitStory('Transfer Display Order', 'No Selection');
|
|
9
9
|
});
|
|
10
|
-
(0,
|
|
10
|
+
(0, _cypressCucumberPreprocessor.Given)('some of the supplied options have been selected', () => {
|
|
11
11
|
cy.visitStory('Transfer Display Order', 'Some Selected');
|
|
12
12
|
});
|
|
13
|
-
(0,
|
|
13
|
+
(0, _cypressCucumberPreprocessor.Given)('some selectable options are selectable', () => {
|
|
14
14
|
cy.visitStory('Transfer Display Order', 'Some Selected');
|
|
15
15
|
});
|
|
16
|
-
(0,
|
|
16
|
+
(0, _cypressCucumberPreprocessor.When)('the user deselects one selected option', () => {
|
|
17
17
|
cy.get('{transfer-pickedoptions} {transferoption}').first().click();
|
|
18
18
|
cy.get('{transfer-pickedoptions}').find('.highlighted').then($el => $el.toArray().map(_index.extractOptionFromElement)).as('deselectedOptions');
|
|
19
19
|
cy.get('{transfer-actions-removeindividual}').click();
|
|
20
20
|
});
|
|
21
|
-
(0,
|
|
21
|
+
(0, _cypressCucumberPreprocessor.When)('the user deselects multiple selected options', () => {
|
|
22
22
|
cy.get('{transfer-pickedoptions} {transferoption}') // should take third, then first item
|
|
23
23
|
.then($options => {
|
|
24
24
|
const $arr = $options.toArray();
|
|
@@ -26,12 +26,12 @@ var _index = require("../common/index.js");
|
|
|
26
26
|
}).each($option => cy.wrap($option).clickWith('cmd')).then($options => cy.wrap($options.toArray().map(_index.extractOptionFromElement)).as('deselectedOptions'));
|
|
27
27
|
cy.get('{transfer-actions-removeindividual}').click();
|
|
28
28
|
});
|
|
29
|
-
(0,
|
|
29
|
+
(0, _cypressCucumberPreprocessor.When)('the user selects one option', () => {
|
|
30
30
|
cy.get('{transfer-sourceoptions} {transferoption}').first().click();
|
|
31
31
|
cy.get('{transfer-sourceoptions}').find('.highlighted').then($el => $el.toArray().map(_index.extractOptionFromElement)).as('selectedOptions');
|
|
32
32
|
cy.get('{transfer-actions-addindividual}').click();
|
|
33
33
|
});
|
|
34
|
-
(0,
|
|
34
|
+
(0, _cypressCucumberPreprocessor.When)('the user selects multiple options', () => {
|
|
35
35
|
cy.get('{transfer-sourceoptions} {transferoption}') // should take fifth, then first item
|
|
36
36
|
.then($options => {
|
|
37
37
|
const $arr = $options.toArray();
|
|
@@ -41,7 +41,7 @@ var _index = require("../common/index.js");
|
|
|
41
41
|
});
|
|
42
42
|
cy.get('{transfer-actions-addindividual}').click();
|
|
43
43
|
});
|
|
44
|
-
(0,
|
|
44
|
+
(0, _cypressCucumberPreprocessor.Then)('the order of the selectable options should match the order of the supplied options', () => {
|
|
45
45
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref => {
|
|
46
46
|
let [win, $options] = _ref;
|
|
47
47
|
const {
|
|
@@ -51,7 +51,7 @@ var _index = require("../common/index.js");
|
|
|
51
51
|
expect(selectableSourceOptions).to.eql(options);
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
|
-
(0,
|
|
54
|
+
(0, _cypressCucumberPreprocessor.Then)('the order of the remaining selectable options should match the order of the supplied options', () => {
|
|
55
55
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref2 => {
|
|
56
56
|
let [win, $options] = _ref2;
|
|
57
57
|
const selectableSourceOptions = $options.toArray().map(_index.extractOptionFromElement);
|
|
@@ -65,7 +65,7 @@ var _index = require("../common/index.js");
|
|
|
65
65
|
expect(selectableSourceOptions).to.eql(options);
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
|
-
(0,
|
|
68
|
+
(0, _cypressCucumberPreprocessor.Then)('it should be positioned according to the order of the supplied options', () => {
|
|
69
69
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@deselectedOptions')).should(_ref4 => {
|
|
70
70
|
let [win, $selectableSourceOptions, deselectedOptions] = _ref4;
|
|
71
71
|
// filter out non-selectable options and compare with selectable options
|
|
@@ -91,7 +91,7 @@ var _index = require("../common/index.js");
|
|
|
91
91
|
expect(hasOption).to.equal(true);
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
|
-
(0,
|
|
94
|
+
(0, _cypressCucumberPreprocessor.Then)('all should take the position according to the order of the supplied options', () => {
|
|
95
95
|
cy.all(() => cy.window(), () => cy.get('{transfer-sourceoptions} {transferoption}'), () => cy.get('@deselectedOptions')).should(_ref7 => {
|
|
96
96
|
let [win, $selectableSourceOptions, deselectedOptions] = _ref7;
|
|
97
97
|
const selectableSourceOptions = $selectableSourceOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -116,14 +116,14 @@ var _index = require("../common/index.js");
|
|
|
116
116
|
expect(hasAllOptions).to.equal(true);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
-
(0,
|
|
119
|
+
(0, _cypressCucumberPreprocessor.Then)('it should be added to the end of the selected options list', () => {
|
|
120
120
|
cy.all(() => cy.get('@selectedOptions'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref10 => {
|
|
121
121
|
let [transferredOptions, $selectedOptions] = _ref10;
|
|
122
122
|
const lastSelectedOptions = $selectedOptions.toArray().slice(transferredOptions.length * -1).map(_index.extractOptionFromElement);
|
|
123
123
|
expect(transferredOptions).to.eql(lastSelectedOptions);
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
|
-
(0,
|
|
126
|
+
(0, _cypressCucumberPreprocessor.Then)('they should be added to the end of the selected options list in the order they have been highlighted', () => {
|
|
127
127
|
cy.all(() => cy.get('@selectedOptions'), () => cy.get('{transfer-pickedoptions} {transferoption}')).should(_ref11 => {
|
|
128
128
|
let [transferredOptions, $selectedOptions] = _ref11;
|
|
129
129
|
const lastSelectedOptions = $selectedOptions.toArray().slice(transferredOptions.length * -1).map(_index.extractOptionFromElement);
|
|
@@ -1,22 +1,22 @@
|
|
|
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)('filtering is enabled', () => {// no op
|
|
8
8
|
});
|
|
9
|
-
(0,
|
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('the options list is being filtered', () => {// no op
|
|
10
10
|
});
|
|
11
|
-
(0,
|
|
11
|
+
(0, _cypressCucumberPreprocessor.Given)('the result is not empty', () => {
|
|
12
12
|
cy.visitStory('Transfer filtering', 'Some Results');
|
|
13
13
|
});
|
|
14
|
-
(0,
|
|
14
|
+
(0, _cypressCucumberPreprocessor.Given)('the result is empty', () => {
|
|
15
15
|
cy.visitStory('Transfer filtering', 'Empty Result');
|
|
16
16
|
});
|
|
17
|
-
(0,
|
|
17
|
+
(0, _cypressCucumberPreprocessor.Given)('a no-result message has been provided', () => {// no op
|
|
18
18
|
});
|
|
19
|
-
(0,
|
|
19
|
+
(0, _cypressCucumberPreprocessor.Given)('the options are being search with a {string} search term', firstCase => {
|
|
20
20
|
if (firstCase === 'uppercase') {
|
|
21
21
|
cy.visitStory('Transfer filtering', 'Uppercase Search');
|
|
22
22
|
} else if (firstCase === 'lowercase') {
|
|
@@ -25,16 +25,16 @@ var _index = require("../common/index.js");
|
|
|
25
25
|
|
|
26
26
|
cy.get('{transfer-filter} input').then($input => $input.val()).as('firstCaseTerm');
|
|
27
27
|
});
|
|
28
|
-
(0,
|
|
28
|
+
(0, _cypressCucumberPreprocessor.Given)('some options are listed', () => {
|
|
29
29
|
cy.get('{transfer-sourceoptions} {transferoption}').should('have.length.of.at.least', 1).as('firstCaseOptions');
|
|
30
30
|
});
|
|
31
|
-
(0,
|
|
31
|
+
(0, _cypressCucumberPreprocessor.Given)('the filter function only returns ANC options', () => {
|
|
32
32
|
cy.visitStory('Transfer filtering', 'Anc Custom Filter');
|
|
33
33
|
});
|
|
34
|
-
(0,
|
|
34
|
+
(0, _cypressCucumberPreprocessor.Given)("the filter value is controlled by the component's consumer", () => {
|
|
35
35
|
cy.visitStory('Transfer filtering', 'Controlled Filter');
|
|
36
36
|
});
|
|
37
|
-
(0,
|
|
37
|
+
(0, _cypressCucumberPreprocessor.When)('the user uses the same search term but {string}', secondCase => {
|
|
38
38
|
cy.all(() => cy.get('@firstCaseTerm'), () => cy.get('{transfer-filter} input')).then(_ref => {
|
|
39
39
|
let [firstCaseTerm, $filterInput] = _ref;
|
|
40
40
|
let secondCaseTerm;
|
|
@@ -48,13 +48,13 @@ var _index = require("../common/index.js");
|
|
|
48
48
|
cy.wrap($filterInput).clear().type(secondCaseTerm);
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
-
(0,
|
|
51
|
+
(0, _cypressCucumberPreprocessor.When)('searching for "s"', () => {
|
|
52
52
|
cy.get('{transfer-filter} input').type('s');
|
|
53
53
|
});
|
|
54
|
-
(0,
|
|
54
|
+
(0, _cypressCucumberPreprocessor.When)('the filter value changes', () => {
|
|
55
55
|
cy.get('{transfer-filter} input').then($input => console.log('$input', $input) || $input).type('ANC');
|
|
56
56
|
});
|
|
57
|
-
(0,
|
|
57
|
+
(0, _cypressCucumberPreprocessor.Then)('all the matching items should be shown in the options list', () => {
|
|
58
58
|
cy.all(() => cy.get('{transfer-filter}'), () => cy.get('{transferoption}')).should(_ref2 => {
|
|
59
59
|
let [$filter, $options] = _ref2;
|
|
60
60
|
const searchTerm = $filter.val();
|
|
@@ -65,15 +65,15 @@ var _index = require("../common/index.js");
|
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
|
-
(0,
|
|
68
|
+
(0, _cypressCucumberPreprocessor.Then)('no items should be shown in the options list', () => {
|
|
69
69
|
cy.get('{transferoption}').should('not.exist');
|
|
70
70
|
});
|
|
71
|
-
(0,
|
|
71
|
+
(0, _cypressCucumberPreprocessor.Then)('information should be displayed that no items matched the filter', () => {
|
|
72
72
|
cy.get('{no-results}', {
|
|
73
73
|
prefix: ''
|
|
74
74
|
}).should('exist');
|
|
75
75
|
});
|
|
76
|
-
(0,
|
|
76
|
+
(0, _cypressCucumberPreprocessor.Then)('the same options should be shown', () => {
|
|
77
77
|
cy.all(() => cy.get('@firstCaseOptions'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref3 => {
|
|
78
78
|
let [$firstCaseOptions, $secondCaseOptions] = _ref3;
|
|
79
79
|
const firstCaseOptions = $firstCaseOptions.toArray().map(_index.extractOptionFromElement);
|
|
@@ -81,10 +81,10 @@ var _index = require("../common/index.js");
|
|
|
81
81
|
expect(firstCaseOptions).to.eql(secondCaseOptions);
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
|
-
(0,
|
|
84
|
+
(0, _cypressCucumberPreprocessor.Then)('only the results including the word "ANC" are included', () => {
|
|
85
85
|
cy.get('{transfer-sourceoptions} {transferoption}').each($option => expect($option.text()).to.match(/ANC/));
|
|
86
86
|
});
|
|
87
|
-
(0,
|
|
87
|
+
(0, _cypressCucumberPreprocessor.Then)('the onFilterChange callback will be called with the new value', () => {
|
|
88
88
|
cy.window().should(win => {
|
|
89
89
|
expect(win.customFilterCallback.callCount).to.equal(4);
|
|
90
90
|
expect(win.customFilterCallback.getCall(0).args[1]).to.equal('');
|
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
4
|
|
|
5
5
|
var _index2 = 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 highlight range of options', 'Has Options');
|
|
9
9
|
cy.get('{transfer-sourceoptions}').as('list').find('{transferoption}').should('have.length.of.at.least', 1);
|
|
10
10
|
});
|
|
11
|
-
(0,
|
|
11
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has one or more items', () => {
|
|
12
12
|
cy.visitStory('Transfer highlight range of options', 'Has Selected');
|
|
13
13
|
cy.get('{transfer-pickedoptions}').as('list').as('list').find('{transferoption}').should('have.length.of.at.least', 1);
|
|
14
14
|
});
|
|
15
|
-
(0,
|
|
15
|
+
(0, _cypressCucumberPreprocessor.Given)('the option list has three or more items', () => {
|
|
16
16
|
cy.visitStory('Transfer highlight range of options', 'Has Options');
|
|
17
17
|
cy.get('{transfer-sourceoptions}').as('list').as('list').find('{transferoption}').should('have.length.of.at.least', 3);
|
|
18
18
|
});
|
|
19
|
-
(0,
|
|
19
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has three or more items', () => {
|
|
20
20
|
cy.visitStory('Transfer highlight range of options', 'Has Selected');
|
|
21
21
|
cy.get('{transfer-pickedoptions}').as('list').as('list').find('{transferoption}').should('have.length.of.at.least', 3);
|
|
22
22
|
});
|
|
23
|
-
(0,
|
|
23
|
+
(0, _cypressCucumberPreprocessor.Given)('the option list has many items', () => {
|
|
24
24
|
cy.visitStory('Transfer highlight range of options', 'Has Options');
|
|
25
25
|
cy.get('{transfer-sourceoptions}').as('list').as('list').find('{transferoption}').should('have.length.of.at.least', 5);
|
|
26
26
|
});
|
|
27
|
-
(0,
|
|
27
|
+
(0, _cypressCucumberPreprocessor.Given)('the selected list has many items', () => {
|
|
28
28
|
cy.visitStory('Transfer highlight range of options', 'All Selected');
|
|
29
29
|
cy.get('{transfer-pickedoptions}').as('list').as('list').find('{transferoption}').should('have.length.of.at.least', 5);
|
|
30
30
|
});
|
|
31
|
-
(0,
|
|
31
|
+
(0, _cypressCucumberPreprocessor.Given)('no item is highlighted', () => {
|
|
32
32
|
cy.get('@list').find('.highlighted').should('not.exist');
|
|
33
33
|
});
|
|
34
|
-
(0,
|
|
34
|
+
(0, _cypressCucumberPreprocessor.Given)('one item is highlighted', () => {
|
|
35
35
|
cy.get('@list').find('{transferoption}').first().as('initiallyHighlighted').click().should('have.class', 'highlighted');
|
|
36
36
|
});
|
|
37
|
-
(0,
|
|
37
|
+
(0, _cypressCucumberPreprocessor.Given)('there are at least two options following the highlighted option', () => {
|
|
38
38
|
cy.get('@initiallyHighlighted').next().should('exist').as('firstBelowInitiallyHighlighted').next().should('exist').as('secondBelowInitiallyHighlighted');
|
|
39
39
|
});
|
|
40
|
-
(0,
|
|
40
|
+
(0, _cypressCucumberPreprocessor.Given)('several options are highlighted', () => {
|
|
41
41
|
cy.get('@list').find('{transferoption}').then($option => $option.eq(0).add($option.eq(4)).add($option.eq(6))).as('initiallyHighlightedMultiple').each($option => cy.wrap($option).clickWith('ctrl'));
|
|
42
42
|
});
|
|
43
|
-
(0,
|
|
43
|
+
(0, _cypressCucumberPreprocessor.Given)('there are at least two options following the last highlighted option', () => {
|
|
44
44
|
cy.get('@initiallyHighlightedMultiple').last('last').next().should('exist').as('firstBelowInitiallyHighlighted').next().should('exist').as('secondBelowInitiallyHighlighted');
|
|
45
45
|
});
|
|
46
|
-
(0,
|
|
46
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks an item with the SHIFT modifier key', () => {
|
|
47
47
|
cy.get('@list').find('{transferoption}').first().clickWith('ctrl').as('initiallyHighlighted');
|
|
48
48
|
});
|
|
49
|
-
(0,
|
|
49
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks the highlighted item with the SHIFT modifier key', () => {
|
|
50
50
|
cy.get('@initiallyHighlighted').clickWith('shift').as('hiddenHighlighted');
|
|
51
51
|
});
|
|
52
|
-
(0,
|
|
52
|
+
(0, _cypressCucumberPreprocessor.When)('the user highlightes the second options following the highlighted option with the SHIFT key modifier', () => {
|
|
53
53
|
cy.get('@secondBelowInitiallyHighlighted').clickWith('shift');
|
|
54
54
|
});
|
|
55
|
-
(0,
|
|
55
|
+
(0, _cypressCucumberPreprocessor.When)('the user highlightes the second options following the last highlighted option', () => {
|
|
56
56
|
cy.get('@initiallyHighlightedMultiple') // last highlighted option
|
|
57
57
|
.last() // next sibling
|
|
58
58
|
.next().as('firstBelowLastHighlighted') // second next sibling
|
|
59
59
|
.next().as('secondBelowLastHighlighted').clickWith('shift');
|
|
60
60
|
});
|
|
61
|
-
(0,
|
|
61
|
+
(0, _cypressCucumberPreprocessor.When)('the user {string} clicks a highlighted option', modifierKey => {
|
|
62
62
|
cy.get('@initiallyHighlightedMultiple').eq(0).clickWith(modifierKey).as('controlClicked');
|
|
63
63
|
});
|
|
64
|
-
(0,
|
|
64
|
+
(0, _cypressCucumberPreprocessor.When)('the user changed the filter to exclude the last clicked option', () => {
|
|
65
65
|
cy.get('{transfer-filter} input').type('ARI');
|
|
66
66
|
});
|
|
67
|
-
(0,
|
|
67
|
+
(0, _cypressCucumberPreprocessor.When)('the user SHIFT-clicks a non-highlighted option', () => {
|
|
68
68
|
cy.get('@list').find('{transferoption}').invoke('eq', 4).clickWith('shift').as('firstShiftClicked');
|
|
69
69
|
});
|
|
70
|
-
(0,
|
|
70
|
+
(0, _cypressCucumberPreprocessor.When)('the user SHIFT-clicks an option', () => {
|
|
71
71
|
cy.get('@list').find('{transferoption}').eq(0).clickWith('shift');
|
|
72
72
|
cy.wrap(0).as('firstClickedIndexWithShift');
|
|
73
73
|
});
|
|
74
|
-
(0,
|
|
74
|
+
(0, _cypressCucumberPreprocessor.When)('the user SHIFT-clicks another option', () => {
|
|
75
75
|
cy.get('@list').find('{transferoption}').eq(5).clickWith('shift');
|
|
76
76
|
cy.wrap(5).as('secondClickedIndexWithShift');
|
|
77
77
|
});
|
|
78
|
-
(0,
|
|
78
|
+
(0, _cypressCucumberPreprocessor.Then)('the clicked option should be highlighted', () => {
|
|
79
79
|
cy.get('@initiallyHighlighted').should('have.class', 'highlighted');
|
|
80
80
|
});
|
|
81
|
-
(0,
|
|
81
|
+
(0, _cypressCucumberPreprocessor.Then)('the option is not highlighted', () => {
|
|
82
82
|
cy.all(() => cy.get('@hiddenHighlighted'), () => cy.get('{transfer-sourceoptions} {transferoption}')).should(_ref => {
|
|
83
83
|
let [hiddenHighlighted, $options] = _ref;
|
|
84
84
|
const $hiddenHighlighted = $options.filter((index, optionEl) => {
|
|
@@ -90,26 +90,26 @@ var _index2 = require("../common/index.js");
|
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
|
-
(0,
|
|
93
|
+
(0, _cypressCucumberPreprocessor.Then)('the clicked options should be highlighted', () => {
|
|
94
94
|
cy.all(() => cy.get('@initiallyHighlighted'), () => cy.get('@secondBelowInitiallyHighlighted')).should(_ref2 => {
|
|
95
95
|
let [$initiallyHighlighted, $secondBelowInitiallyHighlighted] = _ref2;
|
|
96
96
|
expect($initiallyHighlighted).to.have.class('highlighted');
|
|
97
97
|
expect($secondBelowInitiallyHighlighted).to.have.class('highlighted');
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
|
-
(0,
|
|
100
|
+
(0, _cypressCucumberPreprocessor.Then)('all options between the initially highlighted option and the clicked option are highlighted', () => {
|
|
101
101
|
cy.get('@firstBelowInitiallyHighlighted').should('have.class', 'highlighted');
|
|
102
102
|
});
|
|
103
|
-
(0,
|
|
103
|
+
(0, _cypressCucumberPreprocessor.Then)('the option highlighted most recently without SHIFT should be highlighted', () => {
|
|
104
104
|
cy.get('@initiallyHighlightedMultiple').last().should('have.class', 'highlighted');
|
|
105
105
|
});
|
|
106
|
-
(0,
|
|
106
|
+
(0, _cypressCucumberPreprocessor.Then)('the option clicked with SHIFT should be highlighted', () => {
|
|
107
107
|
cy.get('@secondBelowInitiallyHighlighted').should('have.class', 'highlighted');
|
|
108
108
|
});
|
|
109
|
-
(0,
|
|
109
|
+
(0, _cypressCucumberPreprocessor.Then)('all options between the option highlighted most recently without SHIFT and the clicked option are highlighted', () => {
|
|
110
110
|
cy.get('@firstBelowInitiallyHighlighted').should('have.class', 'highlighted');
|
|
111
111
|
});
|
|
112
|
-
(0,
|
|
112
|
+
(0, _cypressCucumberPreprocessor.Then)('all other previously highlighted options are not highlighted anymore', () => {
|
|
113
113
|
cy.all(() => cy.get('@initiallyHighlightedMultiple').last().invoke('index'), () => cy.get('@initiallyHighlightedMultiple')).should(_ref3 => {
|
|
114
114
|
let [lastInitiallyHighlightedIndex, $initiallyHighlightedMultiple] = _ref3;
|
|
115
115
|
$initiallyHighlightedMultiple.filter((_, el) => {
|
|
@@ -121,7 +121,7 @@ var _index2 = require("../common/index.js");
|
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
});
|
|
124
|
-
(0,
|
|
124
|
+
(0, _cypressCucumberPreprocessor.Then)('the range from the visually first highlighted option to the SHIFT-clicked option is highlighted', () => {
|
|
125
125
|
cy.all(() => cy.get('@initiallyHighlightedMultiple'), () => cy.get('@firstShiftClicked'), () => cy.get('@list').find('{transferoption}')).should(_ref4 => {
|
|
126
126
|
let [$initiallyHighlightedMultiple, $firstShiftClicked, $all] = _ref4;
|
|
127
127
|
const firstVisibleHighlightedIndex = $initiallyHighlightedMultiple.filter(':visible').eq(0).index();
|
|
@@ -136,7 +136,7 @@ var _index2 = require("../common/index.js");
|
|
|
136
136
|
$outsideRange.each((index, option) => expect(Cypress.$(option)).to.not.have.class('highlighted'));
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
|
-
(0,
|
|
139
|
+
(0, _cypressCucumberPreprocessor.Then)('the range from the first clicked option to the second clicked option is highlighted', () => {
|
|
140
140
|
cy.all(() => cy.get('@firstClickedIndexWithShift'), () => cy.get('@secondClickedIndexWithShift'), () => cy.get('@list').find('{transferoption}')).should(_ref5 => {
|
|
141
141
|
let [firstClickedIndexWithShift, secondClickedIndexWithShift, $all] = _ref5;
|
|
142
142
|
const from = Math.min(firstClickedIndexWithShift, secondClickedIndexWithShift);
|