@dhis2-ui/select 10.16.2 → 10.16.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -16
- package/src/index.js +9 -0
- package/src/locales/ar/translations.json +7 -0
- package/src/locales/ar_IQ/translations.json +7 -0
- package/src/locales/ckb/translations.json +7 -0
- package/src/locales/cs/translations.json +7 -0
- package/src/locales/da/translations.json +7 -0
- package/src/locales/en/translations.json +11 -0
- package/src/locales/en_US/translations.json +9 -0
- package/src/locales/es/translations.json +7 -0
- package/src/locales/es_419/translations.json +7 -0
- package/src/locales/fr/translations.json +7 -0
- package/src/locales/hi_IN/translations.json +7 -0
- package/src/locales/id/translations.json +7 -0
- package/src/locales/index.js +80 -0
- package/src/locales/km/translations.json +7 -0
- package/src/locales/lo/translations.json +7 -0
- package/src/locales/my/translations.json +7 -0
- package/src/locales/nb/translations.json +7 -0
- package/src/locales/nl/translations.json +7 -0
- package/src/locales/prs/translations.json +7 -0
- package/src/locales/ps/translations.json +7 -0
- package/src/locales/pt/translations.json +7 -0
- package/src/locales/pt_BR/translations.json +7 -0
- package/src/locales/ru/translations.json +7 -0
- package/src/locales/sv/translations.json +7 -0
- package/src/locales/tet/translations.json +7 -0
- package/src/locales/tg/translations.json +7 -0
- package/src/locales/uk/translations.json +7 -0
- package/src/locales/ur/translations.json +7 -0
- package/src/locales/uz_Latn/translations.json +7 -0
- package/src/locales/uz_UZ_Cyrl/translations.json +7 -0
- package/src/locales/uz_UZ_Latn/translations.json +7 -0
- package/src/locales/vi/translations.json +7 -0
- package/src/locales/zh/translations.json +9 -0
- package/src/locales/zh_CN/translations.json +7 -0
- package/src/multi-select/__tests__/multi-select.test.js +23 -0
- package/src/multi-select/__tests__/selection-list.test.js +102 -0
- package/src/multi-select/features/accepts_blur_cb/index.js +14 -0
- package/src/multi-select/features/accepts_blur_cb.feature +8 -0
- package/src/multi-select/features/accepts_focus_cb/index.js +14 -0
- package/src/multi-select/features/accepts_focus_cb.feature +6 -0
- package/src/multi-select/features/accepts_initial_focus/index.js +5 -0
- package/src/multi-select/features/accepts_initial_focus.feature +5 -0
- package/src/multi-select/features/accepts_loading/index.js +22 -0
- package/src/multi-select/features/accepts_loading.feature +14 -0
- package/src/multi-select/features/accepts_max_height/index.js +31 -0
- package/src/multi-select/features/accepts_max_height.feature +11 -0
- package/src/multi-select/features/accepts_placeholder/index.js +25 -0
- package/src/multi-select/features/accepts_placeholder.feature +10 -0
- package/src/multi-select/features/accepts_prefix/index.js +19 -0
- package/src/multi-select/features/accepts_prefix.feature +10 -0
- package/src/multi-select/features/allows_invalid_options/index.js +27 -0
- package/src/multi-select/features/allows_invalid_options.feature +12 -0
- package/src/multi-select/features/allows_selecting/index.js +81 -0
- package/src/multi-select/features/allows_selecting.feature +44 -0
- package/src/multi-select/features/can_be_cleared/index.js +22 -0
- package/src/multi-select/features/can_be_cleared.feature +6 -0
- package/src/multi-select/features/can_be_disabled/index.js +36 -0
- package/src/multi-select/features/can_be_disabled.feature +32 -0
- package/src/multi-select/features/can_be_empty/index.js +28 -0
- package/src/multi-select/features/can_be_empty.feature +16 -0
- package/src/multi-select/features/can_be_filtered/index.js +23 -0
- package/src/multi-select/features/can_be_filtered.feature +14 -0
- package/src/multi-select/features/can_be_opened_and_closed/index.js +32 -0
- package/src/multi-select/features/can_be_opened_and_closed.feature +41 -0
- package/src/multi-select/features/common/index.js +49 -0
- package/src/multi-select/features/duplicate_option_values/index.js +21 -0
- package/src/multi-select/features/duplicate_option_values.feature +7 -0
- package/src/multi-select/features/menu_width_matches_input/index.js +53 -0
- package/src/multi-select/features/menu_width_matches_input.feature +11 -0
- package/src/multi-select/features/position/index.js +160 -0
- package/src/multi-select/features/position.feature +46 -0
- package/src/multi-select/features/shows_selections/index.js +18 -0
- package/src/multi-select/features/shows_selections.feature +9 -0
- package/src/multi-select/filterable-menu.js +43 -0
- package/src/multi-select/index.js +1 -0
- package/src/multi-select/input.js +129 -0
- package/src/multi-select/menu.js +91 -0
- package/src/multi-select/multi-select.e2e.stories.js +407 -0
- package/src/multi-select/multi-select.js +148 -0
- package/src/multi-select/multi-select.prod.stories.js +408 -0
- package/src/multi-select/selection-list.js +79 -0
- package/src/multi-select-field/__tests__/multi-select-field.test.js +29 -0
- package/src/multi-select-field/features/accepts_help_text/index.js +9 -0
- package/src/multi-select-field/features/accepts_help_text.feature +5 -0
- package/src/multi-select-field/features/accepts_label/index.js +9 -0
- package/src/multi-select-field/features/accepts_label.feature +5 -0
- package/src/multi-select-field/features/accepts_validation_text/index.js +9 -0
- package/src/multi-select-field/features/accepts_validation_text.feature +5 -0
- package/src/multi-select-field/features/can_be_required/index.js +11 -0
- package/src/multi-select-field/features/can_be_required.feature +5 -0
- package/src/multi-select-field/features/has_default_clear_text/index.js +16 -0
- package/src/multi-select-field/features/has_default_clear_text.feature +6 -0
- package/src/multi-select-field/features/has_default_empty_text/index.js +13 -0
- package/src/multi-select-field/features/has_default_empty_text.feature +6 -0
- package/src/multi-select-field/features/has_default_filter_nomatch_text/index.js +17 -0
- package/src/multi-select-field/features/has_default_filter_nomatch_text.feature +7 -0
- package/src/multi-select-field/features/has_default_filter_placeholder/index.js +15 -0
- package/src/multi-select-field/features/has_default_filter_placeholder.feature +6 -0
- package/src/multi-select-field/features/has_default_loading_text/index.js +13 -0
- package/src/multi-select-field/features/has_default_loading_text.feature +6 -0
- package/src/multi-select-field/index.js +1 -0
- package/src/multi-select-field/multi-select-field.e2e.stories.js +45 -0
- package/src/multi-select-field/multi-select-field.js +178 -0
- package/src/multi-select-field/multi-select-field.prod.stories.js +137 -0
- package/src/multi-select-option/index.js +1 -0
- package/src/multi-select-option/multi-select-option.js +70 -0
- package/src/select/__tests__/select.test.js +31 -0
- package/src/select/debounce/debounce.js +30 -0
- package/src/select/debounce/debounce.spec.js +35 -0
- package/src/select/empty.js +28 -0
- package/src/select/filter-input.js +42 -0
- package/src/select/filterable-menu.js +106 -0
- package/src/select/index.js +14 -0
- package/src/select/input-clear-button.js +66 -0
- package/src/select/input-placeholder.js +30 -0
- package/src/select/input-prefix.js +32 -0
- package/src/select/input-wrapper.js +114 -0
- package/src/select/loading.js +33 -0
- package/src/select/menu-wrapper.js +52 -0
- package/src/select/no-match.js +28 -0
- package/src/select/option-helpers.js +34 -0
- package/src/select/select.js +256 -0
- package/src/simple-single-select/__stories__/DefaultPosition.js +37 -0
- package/src/simple-single-select/__stories__/Dense.js +17 -0
- package/src/simple-single-select/__stories__/Empty.js +15 -0
- package/src/simple-single-select/__stories__/EmptyWithEmptyNode.js +27 -0
- package/src/simple-single-select/__stories__/EmptyWithEmptyText.js +16 -0
- package/src/simple-single-select/__stories__/FlippedPosition.js +36 -0
- package/src/simple-single-select/__stories__/InfiniteLoading.js +65 -0
- package/src/simple-single-select/__stories__/Loading.js +15 -0
- package/src/simple-single-select/__stories__/ShiftedIntoView.js +35 -0
- package/src/simple-single-select/__stories__/WithClearButton.js +26 -0
- package/src/simple-single-select/__stories__/WithCustomLowMaxHeight.js +17 -0
- package/src/simple-single-select/__stories__/WithCustomOptions.js +78 -0
- package/src/simple-single-select/__stories__/WithDisabledOption.js +25 -0
- package/src/simple-single-select/__stories__/WithFilterField.js +30 -0
- package/src/simple-single-select/__stories__/WithInitialFocus.js +29 -0
- package/src/simple-single-select/__stories__/WithManyOptions.js +19 -0
- package/src/simple-single-select/__stories__/WithMultipleSelectsAndScrollableParent.js +65 -0
- package/src/simple-single-select/__stories__/WithNoMatchText.js +25 -0
- package/src/simple-single-select/__stories__/WithOnBlur.js +22 -0
- package/src/simple-single-select/__stories__/WithOnFocus.js +22 -0
- package/src/simple-single-select/__stories__/WithOptionsAndDisabled.js +17 -0
- package/src/simple-single-select/__stories__/WithOptionsAndLoading.js +23 -0
- package/src/simple-single-select/__stories__/WithOptionsAndLoadingText.js +24 -0
- package/src/simple-single-select/__stories__/WithPlaceholder.js +18 -0
- package/src/simple-single-select/__stories__/WithPlaceholderAndSelection.js +20 -0
- package/src/simple-single-select/__stories__/WithPrefix.js +17 -0
- package/src/simple-single-select/__stories__/WithPrefixAndSelection.js +20 -0
- package/src/simple-single-select/__stories__/WithRTL.js +29 -0
- package/src/simple-single-select/__stories__/WithScrollingParent.js +51 -0
- package/src/simple-single-select/__stories__/WithSelection.js +19 -0
- package/src/simple-single-select/__stories__/WithSelectionAndDisabled.js +20 -0
- package/src/simple-single-select/__stories__/WithServerSideFilteringDemo.js +245 -0
- package/src/simple-single-select/__stories__/WithSimpleFilteringDemo.js +50 -0
- package/src/simple-single-select/__stories__/WithoutOptionsAndLoading.js +16 -0
- package/src/simple-single-select/__stories__/WithoutSelection.js +17 -0
- package/src/simple-single-select/__stories__/options.js +96 -0
- package/src/simple-single-select/__stories__/simple-single-select-server-side-filtering/CustomDataProvider.js +70 -0
- package/src/simple-single-select/__stories__/simple-single-select-server-side-filtering/dataElements.js +4271 -0
- package/src/simple-single-select/__stories__/simple-single-select-server-side-filtering/index.js +1 -0
- package/src/simple-single-select/features/keyboard-interactions.test.e2e.js +581 -0
- package/src/simple-single-select/features/menu-positioning.test.e2e.js +187 -0
- package/src/simple-single-select/index.js +2 -0
- package/src/simple-single-select/is-option-hidden.js +21 -0
- package/src/simple-single-select/menu/empty.js +27 -0
- package/src/simple-single-select/menu/filter.js +61 -0
- package/src/simple-single-select/menu/index.js +1 -0
- package/src/simple-single-select/menu/loading.js +38 -0
- package/src/simple-single-select/menu/menu.js +171 -0
- package/src/simple-single-select/menu/no-match.js +28 -0
- package/src/simple-single-select/menu/option.js +161 -0
- package/src/simple-single-select/menu/options-list.js +107 -0
- package/src/simple-single-select/selected-value/clear-button.js +71 -0
- package/src/simple-single-select/selected-value/container.js +146 -0
- package/src/simple-single-select/selected-value/index.js +1 -0
- package/src/simple-single-select/selected-value/placeholder.js +24 -0
- package/src/simple-single-select/selected-value/prefix.js +26 -0
- package/src/simple-single-select/selected-value/selected-value.js +174 -0
- package/src/simple-single-select/shared-prop-types.js +8 -0
- package/src/simple-single-select/simple-single-select.e2e.stories.js +216 -0
- package/src/simple-single-select/simple-single-select.js +389 -0
- package/src/simple-single-select/simple-single-select.prod.stories.js +41 -0
- package/src/simple-single-select/simple-single-select.test.js +1136 -0
- package/src/simple-single-select/use-handle-key-press/index.js +2 -0
- package/src/simple-single-select/use-handle-key-press/use-focus-option.js +24 -0
- package/src/simple-single-select/use-handle-key-press/use-handle-key-press-on-combobox.js +259 -0
- package/src/simple-single-select/use-handle-key-press/use-handle-key-press-on-filter-input.js +147 -0
- package/src/simple-single-select/use-handle-key-press/use-handle-typing.js +79 -0
- package/src/simple-single-select/use-handle-key-press/use-highlight-first-option-on-previous-page.js +62 -0
- package/src/simple-single-select/use-handle-key-press/use-highlight-first-visible-option.js +38 -0
- package/src/simple-single-select/use-handle-key-press/use-highlight-last-option-on-next-page.js +60 -0
- package/src/simple-single-select/use-handle-key-press/use-highlight-last-visible-option.js +52 -0
- package/src/simple-single-select/use-handle-key-press/use-page-down.js +50 -0
- package/src/simple-single-select/use-handle-key-press/use-page-up.js +50 -0
- package/src/simple-single-select/use-handle-key-press/utils.js +23 -0
- package/src/simple-single-select-field/index.js +1 -0
- package/src/simple-single-select-field/simple-single-select-field.js +198 -0
- package/src/simple-single-select-field/simple-single-select-field.prod.stories.js +188 -0
- package/src/simple-single-select-field/simple-single-select-field.test.js +144 -0
- package/src/single-select/__tests__/selection.test.js +102 -0
- package/src/single-select/__tests__/single-select.test.js +23 -0
- package/src/single-select/features/accepts_blur_cb/index.js +14 -0
- package/src/single-select/features/accepts_blur_cb.feature +8 -0
- package/src/single-select/features/accepts_focus_cb/index.js +14 -0
- package/src/single-select/features/accepts_focus_cb.feature +6 -0
- package/src/single-select/features/accepts_initial_focus/index.js +5 -0
- package/src/single-select/features/accepts_initial_focus.feature +5 -0
- package/src/single-select/features/accepts_loading/index.js +22 -0
- package/src/single-select/features/accepts_loading.feature +14 -0
- package/src/single-select/features/accepts_max_height/index.js +31 -0
- package/src/single-select/features/accepts_max_height.feature +11 -0
- package/src/single-select/features/accepts_placeholder/index.js +25 -0
- package/src/single-select/features/accepts_placeholder.feature +10 -0
- package/src/single-select/features/accepts_prefix/index.js +19 -0
- package/src/single-select/features/accepts_prefix.feature +10 -0
- package/src/single-select/features/allows_invalid_options/index.js +28 -0
- package/src/single-select/features/allows_invalid_options.feature +12 -0
- package/src/single-select/features/allows_selecting/index.js +38 -0
- package/src/single-select/features/allows_selecting.feature +21 -0
- package/src/single-select/features/can_be_cleared/index.js +22 -0
- package/src/single-select/features/can_be_cleared.feature +6 -0
- package/src/single-select/features/can_be_disabled/index.js +39 -0
- package/src/single-select/features/can_be_disabled.feature +32 -0
- package/src/single-select/features/can_be_empty/index.js +28 -0
- package/src/single-select/features/can_be_empty.feature +16 -0
- package/src/single-select/features/can_be_filtered/index.js +23 -0
- package/src/single-select/features/can_be_filtered.feature +14 -0
- package/src/single-select/features/can_be_opened_and_closed/index.js +32 -0
- package/src/single-select/features/can_be_opened_and_closed.feature +41 -0
- package/src/single-select/features/common/index.js +44 -0
- package/src/single-select/features/duplicate_option_values/index.js +26 -0
- package/src/single-select/features/duplicate_option_values.feature +7 -0
- package/src/single-select/features/menu_width_matches_input/index.js +53 -0
- package/src/single-select/features/menu_width_matches_input.feature +11 -0
- package/src/single-select/features/position/index.js +111 -0
- package/src/single-select/features/position.feature +26 -0
- package/src/single-select/features/shows_selections/index.js +9 -0
- package/src/single-select/features/shows_selections.feature +5 -0
- package/src/single-select/filterable-menu.js +41 -0
- package/src/single-select/index.js +1 -0
- package/src/single-select/input.js +101 -0
- package/src/single-select/menu.js +75 -0
- package/src/single-select/selection.js +60 -0
- package/src/single-select/single-select.e2e.stories.js +376 -0
- package/src/single-select/single-select.js +146 -0
- package/src/single-select/single-select.prod.stories.js +358 -0
- package/src/single-select-field/__tests__/single-select-field.test.js +29 -0
- package/src/single-select-field/features/accepts_help_text/index.js +9 -0
- package/src/single-select-field/features/accepts_help_text.feature +5 -0
- package/src/single-select-field/features/accepts_label/index.js +9 -0
- package/src/single-select-field/features/accepts_label.feature +5 -0
- package/src/single-select-field/features/accepts_validation_text/index.js +9 -0
- package/src/single-select-field/features/accepts_validation_text.feature +5 -0
- package/src/single-select-field/features/can_be_required/index.js +11 -0
- package/src/single-select-field/features/can_be_required.feature +5 -0
- package/src/single-select-field/features/has_default_clear_text/index.js +16 -0
- package/src/single-select-field/features/has_default_clear_text.feature +6 -0
- package/src/single-select-field/features/has_default_empty_text/index.js +13 -0
- package/src/single-select-field/features/has_default_empty_text.feature +6 -0
- package/src/single-select-field/features/has_default_filter_nomatch_text/index.js +17 -0
- package/src/single-select-field/features/has_default_filter_nomatch_text.feature +7 -0
- package/src/single-select-field/features/has_default_filter_placeholder/index.js +15 -0
- package/src/single-select-field/features/has_default_filter_placeholder.feature +6 -0
- package/src/single-select-field/features/has_default_loading_text/index.js +13 -0
- package/src/single-select-field/features/has_default_loading_text.feature +6 -0
- package/src/single-select-field/index.js +1 -0
- package/src/single-select-field/single-select-field.e2e.stories.js +45 -0
- package/src/single-select-field/single-select-field.js +178 -0
- package/src/single-select-field/single-select-field.prod.stories.js +146 -0
- package/src/single-select-option/index.js +1 -0
- package/src/single-select-option/single-select-option.js +84 -0
package/src/simple-single-select/__stories__/simple-single-select-server-side-filtering/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CustomDataProvider } from './CustomDataProvider.js'
|
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
describe('<SimpleSingleSelect/>', () => {
|
|
2
|
+
it('should highlight the first option on the currently displayed page', () => {
|
|
3
|
+
cy.log('**Given a select with 100 options is displayed**')
|
|
4
|
+
cy.visitStory('Simple Single Select', 'Hundret Options')
|
|
5
|
+
|
|
6
|
+
cy.log('**And the menu is visible**')
|
|
7
|
+
cy.findByRole('combobox').click()
|
|
8
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
9
|
+
|
|
10
|
+
cy.log('**And the 74th option is being highlighted**')
|
|
11
|
+
cy.findByRole('combobox').focus().type(`Select option 73`)
|
|
12
|
+
|
|
13
|
+
cy.log(
|
|
14
|
+
'**And the 70th option is the first option on the current page**'
|
|
15
|
+
)
|
|
16
|
+
let optionOffset
|
|
17
|
+
cy.findAllByRole('option')
|
|
18
|
+
.eq(70)
|
|
19
|
+
.then((option) => {
|
|
20
|
+
const { offsetTop } = option.get(0)
|
|
21
|
+
optionOffset = offsetTop
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
cy.findByRole('option', { selected: true })
|
|
25
|
+
.invoke('parent') // listbox
|
|
26
|
+
.invoke('parent') // scrollable div
|
|
27
|
+
.then((listBoxParent) => {
|
|
28
|
+
listBoxParent.get(0).scrollTop = optionOffset
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
cy.findAllByRole('option').eq(70).should('be.visible')
|
|
32
|
+
|
|
33
|
+
cy.log('**When the PageUp key is pressed**')
|
|
34
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
35
|
+
key: 'PageUp',
|
|
36
|
+
force: true,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
cy.log(
|
|
40
|
+
'**Then the first option on the currently displayed page is highlighted**'
|
|
41
|
+
)
|
|
42
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
43
|
+
cy.wait(1)
|
|
44
|
+
cy.findByRole('option', { selected: true })
|
|
45
|
+
.invoke('attr', 'aria-label')
|
|
46
|
+
.should('equal', 'Select option 70')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('should highlight the first enabled option before the first (disabled) option on the currently displayed page', () => {
|
|
50
|
+
cy.log(
|
|
51
|
+
'**Given a select with 100 options is displayed and option #17 is disabled**'
|
|
52
|
+
)
|
|
53
|
+
cy.visitStory('Simple Single Select', 'Hundret Options With Disabled')
|
|
54
|
+
|
|
55
|
+
cy.log('**And the menu is visible**')
|
|
56
|
+
cy.findByRole('combobox').click()
|
|
57
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
58
|
+
|
|
59
|
+
cy.log('**And the 26th option is being highlighted**')
|
|
60
|
+
cy.findByRole('combobox').focus().type(`Select option 25`)
|
|
61
|
+
|
|
62
|
+
cy.log(
|
|
63
|
+
'**And the 17th option is the first option on the current page**'
|
|
64
|
+
)
|
|
65
|
+
let optionOffset
|
|
66
|
+
cy.findAllByRole('option')
|
|
67
|
+
.eq(17)
|
|
68
|
+
.then((option) => {
|
|
69
|
+
const { offsetTop } = option.get(0)
|
|
70
|
+
optionOffset = offsetTop
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
cy.findByRole('option', { selected: true })
|
|
74
|
+
.invoke('parent') // listbox
|
|
75
|
+
.invoke('parent') // scrollable div
|
|
76
|
+
.then((listBoxParent) => {
|
|
77
|
+
listBoxParent.get(0).scrollTop = optionOffset
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
cy.findAllByRole('option').eq(17).should('be.visible')
|
|
81
|
+
|
|
82
|
+
cy.log('**When the PageUp key is pressed**')
|
|
83
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
84
|
+
key: 'PageUp',
|
|
85
|
+
force: true,
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
cy.log(
|
|
89
|
+
'**Then the first option on the currently displayed page is highlighted**'
|
|
90
|
+
)
|
|
91
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
92
|
+
cy.wait(1)
|
|
93
|
+
cy.findByRole('option', { selected: true })
|
|
94
|
+
.invoke('attr', 'aria-label')
|
|
95
|
+
.should('equal', 'Select option 16')
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('should highlight the first option on the previous page', () => {
|
|
99
|
+
cy.log('**Given a select with 100 options is displayed**')
|
|
100
|
+
cy.visitStory('Simple Single Select', 'Hundret Options')
|
|
101
|
+
|
|
102
|
+
cy.log('**And the menu is visible**')
|
|
103
|
+
cy.findByRole('combobox').click()
|
|
104
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
105
|
+
|
|
106
|
+
cy.log('**And the 70th option is being highlighted**')
|
|
107
|
+
// Will automatically scroll there and make it the first option on the page
|
|
108
|
+
cy.findByRole('combobox').focus().type(`Select option 70`)
|
|
109
|
+
|
|
110
|
+
cy.log('**When the PageUp key is pressed**')
|
|
111
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
112
|
+
key: 'PageUp',
|
|
113
|
+
force: true,
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
cy.log('**Then the first option on the previous page is highlighted**')
|
|
117
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
118
|
+
cy.wait(1)
|
|
119
|
+
cy.findByRole('option', { selected: true })
|
|
120
|
+
.invoke('attr', 'aria-label')
|
|
121
|
+
.should('equal', 'Select option 61')
|
|
122
|
+
|
|
123
|
+
// That option is truly the first option
|
|
124
|
+
cy.get('[role="option"]:visible')
|
|
125
|
+
.first()
|
|
126
|
+
.invoke('attr', 'aria-label')
|
|
127
|
+
.should('equal', 'Select option 61')
|
|
128
|
+
|
|
129
|
+
cy.log('**And the previously highlighted option is not visible**')
|
|
130
|
+
cy.findAllByRole('option').eq(70).should('not.be.visible')
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('should highlight the first enabled option before the first (disabled) option on the previous page', () => {
|
|
134
|
+
cy.log(
|
|
135
|
+
'**Given a select with 100 options is displayed and option #17 is disabled**'
|
|
136
|
+
)
|
|
137
|
+
cy.visitStory('Simple Single Select', 'Hundret Options With Disabled')
|
|
138
|
+
|
|
139
|
+
cy.log('**And the menu is visible**')
|
|
140
|
+
cy.findByRole('combobox').click()
|
|
141
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
142
|
+
|
|
143
|
+
cy.log('**And the 27th option is being highlighted**')
|
|
144
|
+
// Will automatically scroll there and make it the first option on the page
|
|
145
|
+
cy.findByRole('combobox').focus().type(`Select option 27`)
|
|
146
|
+
|
|
147
|
+
cy.log('**When the PageUp key is pressed**')
|
|
148
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
149
|
+
key: 'PageUp',
|
|
150
|
+
force: true,
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
cy.log('**Then the first option on the previous page is highlighted**')
|
|
154
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
155
|
+
cy.wait(1)
|
|
156
|
+
cy.findByRole('option', { selected: true })
|
|
157
|
+
.invoke('attr', 'aria-label')
|
|
158
|
+
.should('equal', 'Select option 16')
|
|
159
|
+
|
|
160
|
+
cy.log('**And that option is truly the first option**')
|
|
161
|
+
cy.get('[role="option"]:visible')
|
|
162
|
+
.first()
|
|
163
|
+
.invoke('attr', 'aria-label')
|
|
164
|
+
.should('equal', 'Select option 16')
|
|
165
|
+
|
|
166
|
+
cy.log('**And the previously highlighted option is not visible**')
|
|
167
|
+
cy.findAllByRole('option').eq(27).should('not.be.visible')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('should highlight the first option', () => {
|
|
171
|
+
cy.log('**Given a select with 100 options is displayed**')
|
|
172
|
+
cy.visitStory('Simple Single Select', 'Hundret Options')
|
|
173
|
+
|
|
174
|
+
cy.log('**And the menu is visible**')
|
|
175
|
+
cy.findByRole('combobox').click()
|
|
176
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
177
|
+
|
|
178
|
+
cy.log('**And the 2nd option is being highlighted**')
|
|
179
|
+
cy.findByRole('combobox').focus().type(`Select option 1`)
|
|
180
|
+
|
|
181
|
+
cy.log('**And the 2nd option is the first option on the current page**')
|
|
182
|
+
let optionOffset
|
|
183
|
+
cy.findAllByRole('option')
|
|
184
|
+
.eq(1)
|
|
185
|
+
.then((option) => {
|
|
186
|
+
const { offsetTop } = option.get(0)
|
|
187
|
+
optionOffset = offsetTop
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
cy.findByRole('option', { selected: true })
|
|
191
|
+
.invoke('parent') // listbox
|
|
192
|
+
.invoke('parent') // scrollable div
|
|
193
|
+
.then((listBoxParent) => {
|
|
194
|
+
listBoxParent.get(0).scrollTop = optionOffset
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
cy.log('**When the PageUp key is pressed**')
|
|
198
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
199
|
+
key: 'PageUp',
|
|
200
|
+
force: true,
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
cy.log('**Then the first option is being highlighted**')
|
|
204
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
205
|
+
cy.wait(1)
|
|
206
|
+
cy.all(
|
|
207
|
+
() => cy.findAllByRole('option').invoke('get', 0),
|
|
208
|
+
() => cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
209
|
+
).then(([firstOption, highlightedOption]) => {
|
|
210
|
+
expect(highlightedOption).to.equal(firstOption)
|
|
211
|
+
})
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
it('should highlight the second option when the first option is disabled', () => {
|
|
215
|
+
cy.log(
|
|
216
|
+
'**Given a select with 100 options is displayed and option #2 is disabled**'
|
|
217
|
+
)
|
|
218
|
+
cy.visitStory('Simple Single Select', 'Hundret Options With Disabled')
|
|
219
|
+
|
|
220
|
+
cy.log('**And the menu is visible**')
|
|
221
|
+
cy.findByRole('combobox').click()
|
|
222
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
223
|
+
|
|
224
|
+
cy.log('**And the 3rd option is being highlighted**')
|
|
225
|
+
cy.findByRole('combobox').focus().type(`Select option 2`)
|
|
226
|
+
|
|
227
|
+
cy.log('**And the 3rd option is the first option on the current page**')
|
|
228
|
+
let optionOffset
|
|
229
|
+
cy.findAllByRole('option')
|
|
230
|
+
.eq(2)
|
|
231
|
+
.then((option) => {
|
|
232
|
+
const { offsetTop } = option.get(0)
|
|
233
|
+
optionOffset = offsetTop
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
cy.findByRole('option', { selected: true })
|
|
237
|
+
.invoke('parent') // listbox
|
|
238
|
+
.invoke('parent') // scrollable div
|
|
239
|
+
.then((listBoxParent) => {
|
|
240
|
+
listBoxParent.get(0).scrollTop = optionOffset
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
cy.log('**When the PageUp key is pressed**')
|
|
244
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
245
|
+
key: 'PageUp',
|
|
246
|
+
force: true,
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
cy.log('**Then the second option is being highlighted**')
|
|
250
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
251
|
+
cy.wait(1)
|
|
252
|
+
cy.all(
|
|
253
|
+
() => cy.findAllByRole('option').invoke('get', 1),
|
|
254
|
+
() => cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
255
|
+
).then(([firstOption, highlightedOption]) => {
|
|
256
|
+
expect(highlightedOption).to.equal(firstOption)
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
it('should highlight the last option on the currently displayed page', () => {
|
|
261
|
+
cy.log('**Given a select with 100 options is displayed**')
|
|
262
|
+
cy.visitStory('Simple Single Select', 'Hundret Options')
|
|
263
|
+
|
|
264
|
+
cy.log('**And the menu is visible**')
|
|
265
|
+
// first option will be highlighted automatically
|
|
266
|
+
cy.findByRole('combobox').click()
|
|
267
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
268
|
+
|
|
269
|
+
cy.log('**When the PageDown key is pressed**')
|
|
270
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
271
|
+
key: 'PageDown',
|
|
272
|
+
force: true,
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
cy.log(
|
|
276
|
+
'**Then the last option on the currently displayed page is highlighted**'
|
|
277
|
+
)
|
|
278
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
279
|
+
cy.wait(1)
|
|
280
|
+
cy.all(
|
|
281
|
+
() => cy.get('[role="option"]:visible').last().invoke('get', 0),
|
|
282
|
+
() => cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
283
|
+
).then(([lastVisibleOption, highlightedOption]) => {
|
|
284
|
+
expect(highlightedOption).to.equal(lastVisibleOption)
|
|
285
|
+
})
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
it('should highlight the first enabled option after the last (disabled) option on the currently displayed page', () => {
|
|
289
|
+
cy.log(
|
|
290
|
+
'**Given a select with 100 options is displayed and option #17 is disabled**'
|
|
291
|
+
)
|
|
292
|
+
cy.visitStory('Simple Single Select', 'Hundret Options With Disabled')
|
|
293
|
+
|
|
294
|
+
cy.log(
|
|
295
|
+
'**And the 9th option is being selected (will cause it to be the first option on the page when opening the menu)**'
|
|
296
|
+
)
|
|
297
|
+
cy.findByRole('combobox').focus().type(`Select option 9`)
|
|
298
|
+
|
|
299
|
+
cy.log('**And the menu is visible**')
|
|
300
|
+
// first option will be highlighted automatically
|
|
301
|
+
cy.findByRole('combobox').click()
|
|
302
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
303
|
+
|
|
304
|
+
// That option is truly the first option
|
|
305
|
+
cy.get('[role="option"]:visible')
|
|
306
|
+
.first()
|
|
307
|
+
.invoke('attr', 'aria-label')
|
|
308
|
+
.should('equal', 'Select option 9')
|
|
309
|
+
|
|
310
|
+
cy.log('**When the PageDown key is pressed**')
|
|
311
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
312
|
+
key: 'PageDown',
|
|
313
|
+
force: true,
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
317
|
+
cy.wait(1)
|
|
318
|
+
|
|
319
|
+
cy.log(
|
|
320
|
+
'**Then the first enabled option after last option on the currently displayed page is highlighted**'
|
|
321
|
+
)
|
|
322
|
+
cy.all(
|
|
323
|
+
() => cy.findAllByRole('option').invoke('get', 19),
|
|
324
|
+
() => cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
325
|
+
).then(([eighteensOptions, highlightedOption]) => {
|
|
326
|
+
expect(highlightedOption).to.equal(eighteensOptions)
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
cy.log(
|
|
330
|
+
'**And the first enabled option after last option on the currently displayed page is the first visible option**'
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
cy.all(
|
|
334
|
+
() => cy.get('[role="option"]:visible').invoke('get', 0),
|
|
335
|
+
() => cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
336
|
+
).then(([lastVisibleOption, highlightedOption]) => {
|
|
337
|
+
expect(highlightedOption).to.equal(lastVisibleOption)
|
|
338
|
+
})
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
it(
|
|
342
|
+
'should highlight the last option on the next page',
|
|
343
|
+
// We don't want the options to scroll when we check whether they're
|
|
344
|
+
// visible or not (as that'd make them visible)
|
|
345
|
+
{ scrollBehavior: false },
|
|
346
|
+
() => {
|
|
347
|
+
const LAST_VISIBLE_OPTION_INDEX = 8
|
|
348
|
+
|
|
349
|
+
cy.log('**Given a select with 100 options is displayed**')
|
|
350
|
+
cy.visitStory('Simple Single Select', 'Hundret Options')
|
|
351
|
+
|
|
352
|
+
cy.log('**And the last option on the first page is selected**')
|
|
353
|
+
cy.findByRole('combobox').focus().type(`Select option 8`)
|
|
354
|
+
|
|
355
|
+
cy.log('**And the menu is visible**')
|
|
356
|
+
cy.findByRole('combobox').click()
|
|
357
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
358
|
+
|
|
359
|
+
cy.get('[role="option"]')
|
|
360
|
+
.eq(LAST_VISIBLE_OPTION_INDEX)
|
|
361
|
+
.invoke('attr', 'aria-selected')
|
|
362
|
+
.should('equal', 'true')
|
|
363
|
+
|
|
364
|
+
cy.log('**When the PageDown key is pressed**')
|
|
365
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
366
|
+
key: 'PageDown',
|
|
367
|
+
force: true,
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
cy.log('**Then the next page is shown**')
|
|
371
|
+
cy.get('[role="option"]')
|
|
372
|
+
.eq(LAST_VISIBLE_OPTION_INDEX)
|
|
373
|
+
.should('not.be.visible')
|
|
374
|
+
cy.get('[role="option"]')
|
|
375
|
+
.eq(LAST_VISIBLE_OPTION_INDEX + 1)
|
|
376
|
+
.should('be.visible')
|
|
377
|
+
|
|
378
|
+
cy.log('**And the last option on the next page is highlighted**')
|
|
379
|
+
cy.get('[role="option"]:visible')
|
|
380
|
+
.last()
|
|
381
|
+
.invoke('attr', 'aria-selected')
|
|
382
|
+
.should('equal', 'true')
|
|
383
|
+
|
|
384
|
+
cy.log('**And the previously highlighted option is not visible**')
|
|
385
|
+
cy.get('[role="option"]')
|
|
386
|
+
.eq(LAST_VISIBLE_OPTION_INDEX + 1)
|
|
387
|
+
.invoke('attr', 'aria-selected')
|
|
388
|
+
.should('equal', 'false')
|
|
389
|
+
}
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
it(
|
|
393
|
+
'should highlight the first enabled option after the last (disabled) option on the next page',
|
|
394
|
+
// We don't want the options to scroll when we check whether they're
|
|
395
|
+
// visible or not (as that'd make them visible)
|
|
396
|
+
{ scrollBehavior: false },
|
|
397
|
+
() => {
|
|
398
|
+
cy.log(
|
|
399
|
+
'**Given a select with 100 options is displayed and option #17 is disabled**'
|
|
400
|
+
)
|
|
401
|
+
cy.visitStory(
|
|
402
|
+
'Simple Single Select',
|
|
403
|
+
'Hundret Options With Disabled'
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
cy.log('**And the 2nd option is being selected**')
|
|
407
|
+
cy.findByRole('combobox').focus().type(`Select option 9`)
|
|
408
|
+
|
|
409
|
+
cy.log('**And the menu is visible**')
|
|
410
|
+
cy.findByRole('combobox').click()
|
|
411
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
412
|
+
|
|
413
|
+
cy.log(
|
|
414
|
+
'**And the 2nd option is the first option on the current page**'
|
|
415
|
+
)
|
|
416
|
+
cy.all(
|
|
417
|
+
() => cy.findAllByRole('option').eq(1),
|
|
418
|
+
// scrollable div
|
|
419
|
+
() =>
|
|
420
|
+
cy
|
|
421
|
+
.findByRole('option', { selected: true })
|
|
422
|
+
.invoke('parent')
|
|
423
|
+
.invoke('parent')
|
|
424
|
+
).then(([nextTopOption, listBoxParent]) => {
|
|
425
|
+
const { offsetTop } = nextTopOption.get(0)
|
|
426
|
+
listBoxParent.get(0).scrollTop = offsetTop
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
cy.wrap(9).as('lastVisibleOptionIndex')
|
|
430
|
+
|
|
431
|
+
cy.get('@lastVisibleOptionIndex').then((lastVisibleOptionIndex) => {
|
|
432
|
+
cy.get('[role="option"]')
|
|
433
|
+
.eq(lastVisibleOptionIndex)
|
|
434
|
+
.invoke('attr', 'aria-selected')
|
|
435
|
+
.should('equal', 'true')
|
|
436
|
+
})
|
|
437
|
+
|
|
438
|
+
cy.log('**When the PageDown key is pressed**')
|
|
439
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
440
|
+
key: 'PageDown',
|
|
441
|
+
force: true,
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
cy.log('**Then the next page is shown,**')
|
|
445
|
+
// but one option is skipped due to the disabled option at the end of the next page
|
|
446
|
+
cy.get('@lastVisibleOptionIndex').then((lastVisibleOptionIndex) => {
|
|
447
|
+
cy.get('[role="option"]')
|
|
448
|
+
.eq(lastVisibleOptionIndex + 1)
|
|
449
|
+
.should('not.be.visible')
|
|
450
|
+
cy.get('[role="option"]')
|
|
451
|
+
.eq(lastVisibleOptionIndex + 2)
|
|
452
|
+
.should('be.visible')
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
cy.log('**And the last option on the next page is highlighted**')
|
|
456
|
+
cy.get('[role="option"]:visible')
|
|
457
|
+
.last()
|
|
458
|
+
.invoke('attr', 'aria-selected')
|
|
459
|
+
.should('equal', 'true')
|
|
460
|
+
|
|
461
|
+
cy.get('[role="option"]:visible')
|
|
462
|
+
.last()
|
|
463
|
+
.invoke('attr', 'aria-label')
|
|
464
|
+
.should('equal', 'Select option 19')
|
|
465
|
+
}
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
it(
|
|
469
|
+
'should highlight the last option',
|
|
470
|
+
// We don't want the options to scroll when we check whether they're
|
|
471
|
+
// visible or not (as that'd make them visible)
|
|
472
|
+
{ scrollBehavior: false },
|
|
473
|
+
() => {
|
|
474
|
+
cy.log('**Given a select with 100 options is displayed**')
|
|
475
|
+
cy.visitStory('Simple Single Select', 'Hundret Options')
|
|
476
|
+
|
|
477
|
+
cy.log('**And the menu is visible**')
|
|
478
|
+
cy.findByRole('combobox').click()
|
|
479
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
480
|
+
|
|
481
|
+
cy.log(
|
|
482
|
+
'**And the 2nd-last option is being highlighted and visible**'
|
|
483
|
+
)
|
|
484
|
+
for (
|
|
485
|
+
let i = 0;
|
|
486
|
+
i < 98; // This will bring us to the second last option exactly
|
|
487
|
+
++i
|
|
488
|
+
) {
|
|
489
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
490
|
+
key: 'ArrowDown',
|
|
491
|
+
force: true,
|
|
492
|
+
})
|
|
493
|
+
cy.wait(1)
|
|
494
|
+
}
|
|
495
|
+
cy.findAllByRole('option').eq(98).should('be.visible')
|
|
496
|
+
|
|
497
|
+
cy.log('**And the last option is not visible**')
|
|
498
|
+
cy.findAllByRole('option').last().should('not.be.visible')
|
|
499
|
+
|
|
500
|
+
cy.log('**When the PageDown key is pressed**')
|
|
501
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
502
|
+
key: 'PageDown',
|
|
503
|
+
force: true,
|
|
504
|
+
})
|
|
505
|
+
|
|
506
|
+
cy.log('**Then the last option is highlighted**')
|
|
507
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
508
|
+
cy.wait(1)
|
|
509
|
+
cy.all(
|
|
510
|
+
() => cy.findAllByRole('option').last().invoke('get', 0),
|
|
511
|
+
() =>
|
|
512
|
+
cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
513
|
+
).then(([lastOption, highlightedOption]) => {
|
|
514
|
+
expect(highlightedOption).to.equal(lastOption)
|
|
515
|
+
})
|
|
516
|
+
|
|
517
|
+
cy.log('**And the last option is visible**')
|
|
518
|
+
cy.findAllByRole('option').last().should('be.visible')
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
it(
|
|
523
|
+
'should highlight the last enabled option',
|
|
524
|
+
// We don't want the options to scroll when we check whether they're
|
|
525
|
+
// visible or not (as that'd make them visible)
|
|
526
|
+
{ scrollBehavior: false },
|
|
527
|
+
() => {
|
|
528
|
+
cy.log(
|
|
529
|
+
'**Given a select with 100 options is displayed and option #99 is disabled**'
|
|
530
|
+
)
|
|
531
|
+
cy.visitStory(
|
|
532
|
+
'Simple Single Select',
|
|
533
|
+
'Hundret Options With Disabled'
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
cy.log('**And the 3rd-last option is being selected**')
|
|
537
|
+
cy.findByRole('combobox').focus().type(`Select option 97`)
|
|
538
|
+
|
|
539
|
+
cy.log('**And the menu is visible**')
|
|
540
|
+
cy.findByRole('combobox').click()
|
|
541
|
+
cy.findByRole('option', { selected: true }).should('be.visible')
|
|
542
|
+
|
|
543
|
+
cy.log(
|
|
544
|
+
'**And the 3rd-last option is the last option on the current page**'
|
|
545
|
+
)
|
|
546
|
+
cy.all(
|
|
547
|
+
() => cy.findAllByRole('option').eq(89),
|
|
548
|
+
() => cy.findByRole('listbox').invoke('parent') // scrollable div
|
|
549
|
+
).then(([nextTopOption, listBoxParent]) => {
|
|
550
|
+
const { offsetTop } = nextTopOption.get(0)
|
|
551
|
+
listBoxParent.get(0).scrollTop = offsetTop
|
|
552
|
+
})
|
|
553
|
+
|
|
554
|
+
cy.findAllByRole('option').eq(97).should('be.visible')
|
|
555
|
+
cy.findAllByRole('option').eq(98).should('not.be.visible')
|
|
556
|
+
cy.findAllByRole('option').last().should('not.be.visible')
|
|
557
|
+
|
|
558
|
+
cy.log('**When the PageDown key is pressed**')
|
|
559
|
+
cy.findByRole('combobox').trigger('keydown', {
|
|
560
|
+
key: 'PageDown',
|
|
561
|
+
force: true,
|
|
562
|
+
})
|
|
563
|
+
|
|
564
|
+
cy.log('**Then the last option is highlighted**')
|
|
565
|
+
// For some reason, it takes a little time to change the highlighted option
|
|
566
|
+
cy.wait(1)
|
|
567
|
+
cy.all(
|
|
568
|
+
() => cy.findAllByRole('option').invoke('get', 98),
|
|
569
|
+
() =>
|
|
570
|
+
cy.findByRole('option', { selected: true }).invoke('get', 0)
|
|
571
|
+
).then(([secondLastOption, highlightedOption]) => {
|
|
572
|
+
expect(highlightedOption).to.equal(secondLastOption)
|
|
573
|
+
})
|
|
574
|
+
|
|
575
|
+
cy.log('**And the second last option is visible**')
|
|
576
|
+
cy.findAllByRole('option').eq(98).should('be.visible')
|
|
577
|
+
cy.log('**And the last option is not visible**')
|
|
578
|
+
cy.findAllByRole('option').eq(99).should('not.be.visible')
|
|
579
|
+
}
|
|
580
|
+
)
|
|
581
|
+
})
|