-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SelectPanel): add support for announcements to SelectPanel.Loadi…
…ng (#4407) * feat(SelectPanel): add support for announcements to SelectPanel.Loading * chore: add changeset * chore: run format * Update .changeset/rare-moose-destroy.md Co-authored-by: Siddharth Kshetrapal <siddharthkp@github.com> --------- Co-authored-by: Josh Black <joshblack@users.noreply.github.com> Co-authored-by: Siddharth Kshetrapal <siddharthkp@github.com>
- Loading branch information
1 parent
c090174
commit 4a7e44a
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
experimental/SelectPanel: Add support for announcements to SelectPanel.Loading |
This file contains 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
19 changes: 19 additions & 0 deletions
19
packages/react/src/drafts/SelectPanel2/__tests__/SelectPanelLoading.test.tsx
This file contains 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,19 @@ | ||
import {render} from '@testing-library/react' | ||
import React from 'react' | ||
import {SelectPanel} from '../' | ||
|
||
describe('SelectPanel.Loading', () => { | ||
it('should announce children as a polite message', () => { | ||
render(<SelectPanel.Loading>test</SelectPanel.Loading>) | ||
|
||
const liveRegion = document.querySelector('live-region')! | ||
expect(liveRegion.getMessage('polite')).toBe('test') | ||
}) | ||
|
||
it('should announce a default message when no children are provided', () => { | ||
render(<SelectPanel.Loading />) | ||
|
||
const liveRegion = document.querySelector('live-region')! | ||
expect(liveRegion.getMessage('polite')).toBe('Fetching items...') | ||
}) | ||
}) |