Skip to content
Merged
Binary file modified e2e/screenshots/button-variant-danger-.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 modified e2e/screenshots/button-variant-danger-secondary-.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 modified e2e/screenshots/button-variant-error-.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 modified e2e/screenshots/button-variant-primary-.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 modified e2e/screenshots/button-variant-secondary-.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 modified e2e/screenshots/button-variant-tertiary-.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 e2e/screenshots/button-wrap.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 modified e2e/screenshots/dark--button-variant-danger-.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 modified e2e/screenshots/dark--button-variant-danger-secondary-.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 modified e2e/screenshots/dark--button-variant-error-.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 modified e2e/screenshots/dark--button-variant-primary-.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 modified e2e/screenshots/dark--button-variant-secondary-.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 modified e2e/screenshots/dark--button-variant-tertiary-.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 modified e2e/screenshots/dark--link-variant-button-.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 modified e2e/screenshots/dark--link-variant-button-secondary-.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 modified e2e/screenshots/link-variant-button-.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 modified e2e/screenshots/link-variant-button-secondary-.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions packages/react/src/components/Button/screenshots.e2e.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -591,3 +591,28 @@ test('should have screenshot for Button[variant="badge"]', async ({
await setTheme(page, 'dark');
await expect(component).toHaveScreenshot('dark--button[variant=badge]');
});
test('should not wrap text in buttons by default', async ({ mount, page }) => {
await page.setViewportSize({ height: 600, width: 320 });
const internalText =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum';

const component = await mount(
<div
className="Button-wrap"
style={{ display: 'flex', flexDirection: 'column', width: '320px' }}
>
<Button variant="primary">{internalText}</Button>
<Button variant="primary" style={{ minWidth: '10px' }}>
{internalText}
</Button>
</div>
);
await expect(component).toHaveScreenshot('button-wrap');
const buttons = component.getByRole('button');
const firstButton = buttons.first();
const firstButtonBoundingBox = await firstButton.boundingBox();
expect(firstButtonBoundingBox?.height).toBe(36);
const lastButton = buttons.last();
const lastButtonBoundingBox = await lastButton.boundingBox();
expect(lastButtonBoundingBox?.height).toBeGreaterThan(36);
});
1 change: 1 addition & 0 deletions packages/styles/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
justify-items: center;
justify-content: center;
gap: var(--space-smallest);
min-width: max-content;
}

.Button--tag,
Expand Down