Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions e2e/components/Avatar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const stories = [
title: 'Size',
id: 'components-avatar-features--size',
},
{
title: 'CSS Size Override Regression',
id: 'components-avatar-dev--css-size-override-regression',
expectedSize: 16,
Comment thread
liuliu-dev marked this conversation as resolved.
},
{
title: 'Size Responsive',
id: 'components-avatar-features--size-responsive',
Expand All @@ -34,8 +39,14 @@ test.describe('Avatar', () => {
},
})

// Default state
await expect(page).toHaveScreenshot(`Avatar.${story.title}.${theme}.png`)
if ('expectedSize' in story) {
const avatar = page.getByRole('img')
await expect(avatar).toHaveCSS('width', `${story.expectedSize}px`)
await expect(avatar).toHaveCSS('height', `${story.expectedSize}px`)
} else {
// Default state
await expect(page).toHaveScreenshot(`Avatar.${story.title}.${theme}.png`)
}
})
})
}
Expand Down
10 changes: 10 additions & 0 deletions packages/react/src/Avatar/Avatar.dev.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Avatar from './Avatar'

export default {
title: 'Components/Avatar/Dev',
}

// Regression fixture for consumer style overrides. Use the size prop for supported sizing.
export const CSSSizeOverrideRegression = () => (
<Avatar alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" style={{width: 16, height: 16}} />
)
Loading