Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const COMMON_PROPS: (keyof Omit<ImageElementProps, 'src'>)[] = [
'srcSet',
'useMap',
'alt',
'fetchPriority',
];
1 change: 1 addition & 0 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type ImageElementProps = Pick<
| 'srcSet'
| 'useMap'
| 'alt'
| 'fetchPriority'
>;

export type PreviewImageElementProps = {
Expand Down
11 changes: 11 additions & 0 deletions tests/basic.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ describe('Basic', () => {
expect(onClickMock).toHaveBeenCalledTimes(1);
});

it('should pass fetchPriority to img element', () => {
const { container } = render(
<Image
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
fetchPriority="high"
/>,
);
const img = container.querySelector('img');
expect(img).toHaveAttribute('fetchpriority', 'high');
});

it('className and style props should work on img element', () => {
const { container } = render(
<Image
Expand Down