Repository navigation
fix(mosaic): keep a badge whole beside truncating text #10761
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ export const styles = stylex.create({ | |
| paddingInline: space['2'], | ||
| alignItems: 'center', | ||
| display: 'inline-flex', | ||
| flexShrink: 0, | ||
|
Contributor
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.
|
||
| fontFamily: fontFamilyVars['--cl-font-family-sans'], | ||
| fontSize: typeScaleVars['--cl-text-xs-size'], | ||
| fontWeight: fontWeightVars['--cl-font-medium'], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { cleanup, render, screen } from '@testing-library/react'; | ||
| import { afterEach, describe, expect, it } from 'vitest'; | ||
|
|
||
| import { Badge } from '../badge'; | ||
| import { Entity } from './entity'; | ||
|
|
||
| afterEach(() => cleanup()); | ||
|
|
||
| describe('Entity.Label', () => { | ||
| it('truncates the label text and keeps a badge beside it whole', () => { | ||
| render( | ||
| <div style={{ width: 160 }}> | ||
| <Entity.Label> | ||
| Cameron Alexander Walker | ||
| <Badge>Default</Badge> | ||
| </Entity.Label> | ||
| </div>, | ||
| ); | ||
|
|
||
| const name = screen.getByText('Cameron Alexander Walker'); | ||
| const badgeText = screen.getByText('Default'); | ||
|
|
||
| expect(name.scrollWidth).toBeGreaterThan(name.clientWidth); | ||
| expect(badgeText.scrollWidth).toBe(badgeText.clientWidth); | ||
| }); | ||
| }); |
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.
Script executed:
Repository: clerk/javascript
Length of output: 3387
Script executed:
Repository: clerk/javascript
Length of output: 13043
Script executed:
Repository: clerk/javascript
Length of output: 27265
Script executed:
Repository: clerk/javascript
Length of output: 8692
Add a Mosaic changeset for this fix.
The empty changeset does not schedule a release for this fix or record it for consumers. Add a patch entry and a user-facing summary.
Suggested changeset
Committable suggestion