summaryrefslogtreecommitdiff
path: root/spec/frontend/header_search/components/header_search_autocomplete_items_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/header_search/components/header_search_autocomplete_items_spec.js')
-rw-r--r--spec/frontend/header_search/components/header_search_autocomplete_items_spec.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/frontend/header_search/components/header_search_autocomplete_items_spec.js b/spec/frontend/header_search/components/header_search_autocomplete_items_spec.js
index ecfaa8e9443..bec0cbc8a5c 100644
--- a/spec/frontend/header_search/components/header_search_autocomplete_items_spec.js
+++ b/spec/frontend/header_search/components/header_search_autocomplete_items_spec.js
@@ -110,11 +110,11 @@ describe('HeaderSearchAutocompleteItems', () => {
});
describe.each`
- currentFocusedOption | isFocused
- ${null} | ${false}
- ${{ html_id: 'not-a-match' }} | ${false}
- ${MOCK_SORTED_AUTOCOMPLETE_OPTIONS[0]} | ${true}
- `('isOptionFocused', ({ currentFocusedOption, isFocused }) => {
+ currentFocusedOption | isFocused | ariaSelected
+ ${null} | ${false} | ${undefined}
+ ${{ html_id: 'not-a-match' }} | ${false} | ${undefined}
+ ${MOCK_SORTED_AUTOCOMPLETE_OPTIONS[0]} | ${true} | ${'true'}
+ `('isOptionFocused', ({ currentFocusedOption, isFocused, ariaSelected }) => {
describe(`when currentFocusedOption.html_id is ${currentFocusedOption?.html_id}`, () => {
beforeEach(() => {
createComponent({}, {}, { currentFocusedOption });
@@ -123,6 +123,10 @@ describe('HeaderSearchAutocompleteItems', () => {
it(`should${isFocused ? '' : ' not'} have gl-bg-gray-50 applied`, () => {
expect(findFirstDropdownItem().classes('gl-bg-gray-50')).toBe(isFocused);
});
+
+ it(`sets "aria-selected to ${ariaSelected}`, () => {
+ expect(findFirstDropdownItem().attributes('aria-selected')).toBe(ariaSelected);
+ });
});
});
});