diff --git a/src/common.ts b/src/common.ts index a52a58ae..abaaf1fe 100644 --- a/src/common.ts +++ b/src/common.ts @@ -10,4 +10,5 @@ export const COMMON_PROPS: (keyof Omit)[] = [ 'srcSet', 'useMap', 'alt', + 'fetchPriority', ]; diff --git a/src/interface.ts b/src/interface.ts index 42120a73..0c5b1106 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -13,6 +13,7 @@ export type ImageElementProps = Pick< | 'srcSet' | 'useMap' | 'alt' + | 'fetchPriority' >; export type PreviewImageElementProps = { diff --git a/tests/basic.test.tsx b/tests/basic.test.tsx index 526823e4..243d0870 100644 --- a/tests/basic.test.tsx +++ b/tests/basic.test.tsx @@ -51,6 +51,17 @@ describe('Basic', () => { expect(onClickMock).toHaveBeenCalledTimes(1); }); + it('should pass fetchPriority to img element', () => { + const { container } = render( + , + ); + const img = container.querySelector('img'); + expect(img).toHaveAttribute('fetchpriority', 'high'); + }); + it('className and style props should work on img element', () => { const { container } = render(