-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ButtonGroup): add toolbar interactions for role toolbar (#5200)
* fix(ButtonGroup): add toolbar interactions for role toolbar * Create slow-news-love.md * fix(ButtonGroup): remove unusued import * test(vrt): update snapshots * fix(ButtonGroup): remove focusZoneSettings prop --------- Co-authored-by: francinelucca <francinelucca@users.noreply.github.com>
- Loading branch information
1 parent
706d272
commit b28e6b2
Showing
14 changed files
with
116 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": patch | ||
--- | ||
|
||
fix(ButtonGroup): add toolbar interactions for role toolbar |
Binary file added
BIN
+6.68 KB
.../ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.73 KB
...ents/ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.71 KB
...ttonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.68 KB
.../components/ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.68 KB
.../ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.79 KB
...ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.91 KB
...tonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.79 KB
...components/ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.79 KB
...ButtonGroup.test.ts-snapshots/ButtonGroup-As-Toolbar-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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,58 @@ | ||
import {Button} from '../Button' | ||
import {render, screen} from '@testing-library/react' | ||
import axe from 'axe-core' | ||
import {FeatureFlags} from '../FeatureFlags' | ||
import {behavesAsComponent} from '../utils/testing' | ||
import type {ButtonGroupProps} from './ButtonGroup' | ||
import ButtonGroup from './ButtonGroup' | ||
import React from 'react' | ||
|
||
const TestButtonGroup = (props: ButtonGroupProps) => ( | ||
<ButtonGroup {...props}> | ||
<Button>Button 1</Button> | ||
<Button>Button 2</Button> | ||
<Button>Button 3</Button> | ||
</ButtonGroup> | ||
) | ||
|
||
describe('ButtonGroup', () => { | ||
behavesAsComponent({ | ||
Component: TestButtonGroup, | ||
options: {skipSx: true, skipAs: true}, | ||
}) | ||
|
||
it('should support `className` on the outermost element', () => { | ||
const Element = () => <ButtonGroup className={'test-class-name'} /> | ||
const FeatureFlagElement = () => { | ||
return ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<Element /> | ||
</FeatureFlags> | ||
) | ||
} | ||
expect(render(<Element />).container.firstChild).toHaveClass('test-class-name') | ||
expect(render(<FeatureFlagElement />).container.firstChild).toHaveClass('test-class-name') | ||
}) | ||
|
||
it('renders a <div>', () => { | ||
const container = render(<ButtonGroup data-testid="button-group" />) | ||
expect(container.getByTestId('button-group').tagName).toBe('DIV') | ||
}) | ||
|
||
it('should have no axe violations', async () => { | ||
const {container} = render(<TestButtonGroup />) | ||
const results = await axe.run(container) | ||
expect(results).toHaveNoViolations() | ||
}) | ||
|
||
it('should respect role prop', () => { | ||
render(<ButtonGroup role="toolbar" />) | ||
expect(screen.getByRole('toolbar')).toBeInTheDocument() | ||
}) | ||
}) |
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