-
Notifications
You must be signed in to change notification settings - Fork 31
Enhancement [DEV-12682] Icon feedback and more #2690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1516454
Add svgs for other arrows rather than transforming
jayb b363e01
Remove svg scale option
jayb c396639
Add alt icon sizing approach
jayb f245cf7
Improve icon accessibility
jayb 902ce38
Improve layout for out of 10
jayb 7de24f8
Fix waffle row gap
jayb ec9ebb1
Border radius cleanup
jayb d2335e1
Fix storybook tests
jayb 9f527ba
Resolve PR feedback
jayb 7e825d7
Fix stylesheet import & breaking test
jayb f8324a1
Handle symlinks in examples directories
jayb 408b594
Fix data bite wrap issues
jayb 95bf776
Scale waffle chart circles when less than 100
jayb 4ea4c38
Reduce height of non-full waffles
jayb 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
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,51 @@ | ||
| import React from 'react' | ||
| import { render, screen } from '@testing-library/react' | ||
| import { describe, expect, it } from 'vitest' | ||
| import TrendArrow from './TrendArrow' | ||
| import { TREND_ARROW_DOWN, TREND_ARROW_NO_CHANGE, TREND_ARROW_UP } from '../../helpers/trendIndicator' | ||
|
|
||
| describe('TrendArrow', () => { | ||
| it('renders the up arrow asset with the registry aria label when no visible text is present', () => { | ||
| const { container } = render(<TrendArrow arrowType={TREND_ARROW_UP} />) | ||
|
|
||
| const icon = screen.getByRole('img', { name: 'Trend up' }) | ||
| expect(icon).toHaveClass('cove-trend-arrow') | ||
| expect(icon).toHaveAttribute('focusable', 'false') | ||
| expect(icon).not.toHaveClass('is-down') | ||
| expect(icon).not.toHaveClass('is-no-change') | ||
| expect(icon).toHaveAttribute('viewBox', '0 0 384 512') | ||
| expect(container.querySelector('path')).toBeInTheDocument() | ||
| }) | ||
|
|
||
| it('renders the down arrow asset without brittle path assertions', () => { | ||
| const { container } = render(<TrendArrow arrowType={TREND_ARROW_DOWN} />) | ||
|
|
||
| const icon = screen.getByRole('img', { name: 'Trend down' }) | ||
| expect(icon).toHaveClass('cove-trend-arrow') | ||
| expect(icon).toHaveAttribute('focusable', 'false') | ||
| expect(icon).not.toHaveClass('is-down') | ||
| expect(icon).not.toHaveClass('is-no-change') | ||
| expect(icon).toHaveAttribute('viewBox', '0 0 384 512') | ||
| expect(container.querySelector('path')).toBeInTheDocument() | ||
| }) | ||
|
|
||
| it('renders the no-change asset with visible label text and a decorative icon', () => { | ||
| const { container } = render( | ||
| <TrendArrow arrowType={TREND_ARROW_NO_CHANGE} wrapperClassName='custom-wrap' label='Steady' /> | ||
| ) | ||
|
|
||
| expect(screen.getByText('Steady')).toHaveClass('cove-trend-arrow__label') | ||
| const wrapper = container.querySelector('.cove-trend-arrow__wrap.custom-wrap') | ||
| expect(wrapper).toBeInTheDocument() | ||
|
|
||
| const icon = container.querySelector('svg') | ||
| expect(screen.queryByRole('img', { name: 'Trend no change' })).not.toBeInTheDocument() | ||
| expect(icon).toHaveAttribute('aria-hidden', 'true') | ||
| expect(icon).toHaveAttribute('focusable', 'false') | ||
| expect(icon).toHaveClass('cove-trend-arrow') | ||
| expect(icon).not.toHaveClass('is-down') | ||
| expect(icon).not.toHaveClass('is-no-change') | ||
| expect(icon).toHaveAttribute('viewBox', '0 0 512 384') | ||
| expect(container.querySelector('path')).toBeInTheDocument() | ||
| }) | ||
| }) |
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
Oops, something went wrong.
Oops, something went wrong.
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.