This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
fix(Splitbutton) accessibility - screen reader fixes #2090
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e471b6d
fix: 1.disable example 2.Jaws narration 3.closing menu by tab
mituron 09a9585
Merge branch 'master' into mituron/splitbutton-disabled-reader-fix
kolaps33 77f57fc
Merge branch 'master' into mituron/splitbutton-disabled-reader-fix
kolaps33 61e9993
adding test verify aria-haspopup is not defined
mituron 3282894
adding tests for keys support
mituron 833da93
rename for better readability
mituron b008cc4
rename test name
mituron 9fff036
Merge branch 'master' into mituron/splitbutton-disabled-reader-fix
kolaps33 571f95a
adding description from menuButton, removing no neeeded role from men…
mituron a1ab56a
Merge branch 'mituron/splitbutton-disabled-reader-fix' of https://git…
mituron fc02ebf
improve description
mituron 9e823f4
removing role from test
mituron f917028
Merge branch 'master' into mituron/splitbutton-disabled-reader-fix
kolaps33 59887e3
editing changelog
mituron 36b4b06
improving changelog
mituron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/accessibility/test/behaviors/splitButtonBehavior-test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { splitButtonBehavior } from '@stardust-ui/accessibility' | ||
| import * as keyboardKey from 'keyboard-key' | ||
| import * as _ from 'lodash' | ||
|
|
||
| function verifyKeys(supportedKeys, keysFromBehavior) { | ||
| keysFromBehavior.forEach(keyCombination => { | ||
| const keyCombinationFound = _.find(supportedKeys, keyCombination) | ||
| expect(keyCombinationFound).toEqual(keyCombination) | ||
| }) | ||
| } | ||
|
|
||
| describe('SplitButtonBehavior.ts', () => { | ||
| test('aria-haspopup is not defined for splitButton', () => { | ||
| const property = { | ||
| contextMenu: false, | ||
| } | ||
| const expectedResult = splitButtonBehavior(property) | ||
| expect( | ||
| expectedResult['childBehaviors']['menuButton'](property).attributes.trigger['aria-haspopup'], | ||
| ).toBe(undefined) | ||
| }) | ||
|
|
||
| test('close menu with different keys', () => { | ||
| const property = {} | ||
| const supportedKeys = [ | ||
| { keyCode: keyboardKey.Escape }, | ||
| { altKey: true, keyCode: keyboardKey.ArrowUp }, | ||
| { keyCode: keyboardKey.Tab, shiftKey: false }, | ||
| { keyCode: keyboardKey.Tab, shiftKey: true }, | ||
| ] | ||
| const keysFromBehavior = splitButtonBehavior(property)['childBehaviors']['menuButton'](property) | ||
| .keyActions.popup.closeAndFocusTrigger.keyCombinations | ||
| verifyKeys(supportedKeys, keysFromBehavior) | ||
| }) | ||
|
|
||
| test('open menu with alt + arrow down ', () => { | ||
| const property = {} | ||
| const supportedKeys = [{ altKey: true, keyCode: keyboardKey.ArrowDown }] | ||
| const keysFromBehavior = splitButtonBehavior(property)['childBehaviors']['menuButton'](property) | ||
| .keyActions.trigger.open.keyCombinations | ||
| verifyKeys(supportedKeys, keysFromBehavior) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.