-
Notifications
You must be signed in to change notification settings - Fork 344
refactor(breadcrumbs): convert to TypeScript and RTL tests #3948
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
Closed
devin-ai-integration
wants to merge
23
commits into
master
from
devin-ai/convert-ts-breadcrumbs-1740170224
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
08e23f5
refactor(breadcrumbs): convert to TypeScript
devin-ai-integration[bot] b84d8ba
refactor(breadcrumbs): convert to TypeScript and RTL tests
devin-ai-integration[bot] 07f4fcb
chore: update dependencies and tsconfig
devin-ai-integration[bot] 4c2a6c6
chore: cleanup old files
devin-ai-integration[bot] 7b74be6
chore: restore original files
devin-ai-integration[bot] dfb99b6
refactor(breadcrumbs): update BreadcrumbDelimiter to use Gray50 token
devin-ai-integration[bot] ce8acb1
refactor(breadcrumbs): update BreadcrumbDropdown
devin-ai-integration[bot] 082aecf
refactor(breadcrumbs): update InlineBreadcrumbs type and props
devin-ai-integration[bot] e11c56e
fix(breadcrumbs): fix syntax and type errors
devin-ai-integration[bot] 5042f62
test(breadcrumbs): remove type assertions and jest-dom import
devin-ai-integration[bot] 0f78325
chore: remove unnecessary index.ts file
devin-ai-integration[bot] 2cfdaa4
chore: restore tsconfig.json to original state
devin-ai-integration[bot] 87f7ac9
test: add polyfills for setImmediate and TextEncoder
devin-ai-integration[bot] 46c7771
test: fix duplicate ResizeObserver class
devin-ai-integration[bot] 755faf8
test: add matchMedia polyfill for tests
devin-ai-integration[bot] 52c86bc
fix(breadcrumbs): fix aria-label and onCrumbClick handler
devin-ai-integration[bot] df8ca1b
chore: remove auto-generated testing-library.js
devin-ai-integration[bot] 09f59fa
fix(breadcrumbs): remove unused imports and props
devin-ai-integration[bot] 5f17b7d
chore(i18n): update translations
devin-ai-integration[bot] 3b6f12f
chore(i18n): update translations from build
devin-ai-integration[bot] 0bca636
fix(breadcrumbs): restore code patterns and fix TS errors
devin-ai-integration[bot] 9bda568
fix(breadcrumbs): update dropdown button aria-label
devin-ai-integration[bot] ce7225b
fix(breadcrumbs): restore original code patterns and fix test
devin-ai-integration[bot] 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
20 changes: 7 additions & 13 deletions
20
...elements/common/breadcrumbs/Breadcrumb.js → ...lements/common/breadcrumbs/Breadcrumb.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
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
18 changes: 5 additions & 13 deletions
18
.../common/breadcrumbs/BreadcrumbDropdown.js → ...common/breadcrumbs/BreadcrumbDropdown.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
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
14 changes: 0 additions & 14 deletions
14
src/elements/common/breadcrumbs/__tests__/Breadcrumbs.test.js
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/elements/common/breadcrumbs/__tests__/Breadcrumbs.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,40 @@ | ||
| import * as React from 'react'; | ||
| import { render, screen } from '../../../../test-utils/testing-library'; | ||
| import Breadcrumbs from '../Breadcrumbs'; | ||
| import messages from '../../messages'; | ||
|
|
||
| describe('elements/common/breadcrumbs/Breadcrumbs', () => { | ||
| const renderComponent = (props = {}) => { | ||
| const defaultProps = { | ||
| crumbs: [{ id: '0', name: 'All Files' }], | ||
| delimiter: 'caret' as const, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update above two lines to |
||
| onCrumbClick: jest.fn(), | ||
| rootId: '123123', | ||
| }; | ||
| render(<Breadcrumbs {...defaultProps} {...props} />); | ||
| }; | ||
|
|
||
| test('should render "All Files" breadcrumb', () => { | ||
| renderComponent(); | ||
| expect(screen.getByRole('button', { name: 'All Files' })).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test('should render dropdown when there are three or more crumbs', () => { | ||
| const crumbs = [ | ||
| { id: '0', name: 'All Files' }, | ||
| { id: '1', name: 'Folder 1' }, | ||
| { id: '2', name: 'Folder 2' }, | ||
| ]; | ||
| renderComponent({ crumbs }); | ||
| expect(screen.getByRole('button', { name: messages.breadcrumbLabel.defaultMessage })).toBeInTheDocument(); | ||
| expect(screen.getByRole('button', { name: 'Folder 2' })).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test('should call onCrumbClick when clicking a breadcrumb', () => { | ||
| const onCrumbClick = jest.fn(); | ||
| const crumbs = [{ id: '0', name: 'All Files' }]; | ||
| renderComponent({ crumbs, onCrumbClick }); | ||
| screen.getByRole('button', { name: 'All Files' }).click(); | ||
| expect(onCrumbClick).toHaveBeenCalledWith(crumbs[0]); | ||
| }); | ||
| }); | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore the change made in jest-setup.ts file