diff --git a/lib/exporter/image.responsive.options.test.ts b/lib/exporter/image.responsive.options.test.ts
index a845df3..09308e8 100644
--- a/lib/exporter/image.responsive.options.test.ts
+++ b/lib/exporter/image.responsive.options.test.ts
@@ -35,4 +35,53 @@ describe('image responsive/export options', () => {
expect(html).toMatch(/
![]()
]*srcset="https:\/\/example.com\/hero.jpg 1x, https:\/\/example.com\/hero@2x.jpg 2x"/)
expect(html).toMatch(/
![]()
]*sizes="\(max-width: 640px\) 100vw, 600px"/)
})
+
+ it('applies default sizes when srcset is provided and imageAutoSizes is true', () => {
+ const options: ExportOptions = {
+ imageSrcset: 'https://example.com/hero.jpg 1x, https://example.com/hero@2x.jpg 2x',
+ imageAutoSizes: true,
+ }
+ const { html } = exportPage(basePage, options)
+ expect(html).toMatch(/
![]()
]*srcset="https:\/\/example.com\/hero.jpg 1x, https:\/\/example.com\/hero@2x.jpg 2x"/)
+ expect(html).toMatch(/
![]()
]*sizes="\(max-width: 640px\) 100vw, 600px"/)
+ })
+
+ it('does not include sizes when srcset is provided but imageAutoSizes is false and sizes not provided', () => {
+ const options: ExportOptions = {
+ imageSrcset: 'https://example.com/hero.jpg 1x, https://example.com/hero@2x.jpg 2x',
+ imageAutoSizes: false,
+ }
+ const { html } = exportPage(basePage, options)
+ expect(html).toMatch(/
![]()
]*srcset="https:\/\/example.com\/hero.jpg 1x, https:\/\/example.com\/hero@2x.jpg 2x"/)
+ expect(html).not.toMatch(/
![]()
]*sizes="/)
+ })
+
+ it('applies preset sizes when imageSizesPreset is set (mobile-first)', () => {
+ const options: ExportOptions = {
+ imageSrcset: 'https://example.com/hero.jpg 1x, https://example.com/hero@2x.jpg 2x',
+ imageSizesPreset: 'mobile-first',
+ }
+ const { html } = exportPage(basePage, options)
+ expect(html).toMatch(/
![]()
]*sizes="\(max-width: 640px\) 100vw, 800px"/)
+ })
+
+ it('applies desktop-fixed preset when selected', () => {
+ const options: ExportOptions = {
+ imageSrcset: 'https://example.com/hero.jpg 1x, https://example.com/hero@2x.jpg 2x',
+ imageSizesPreset: 'desktop-fixed',
+ }
+ const { html } = exportPage(basePage, options)
+ expect(html).toMatch(/
![]()
]*sizes="1200px"/)
+ })
+
+ it('explicit imageSizes overrides presets and auto', () => {
+ const options: ExportOptions = {
+ imageSrcset: 'https://example.com/hero.jpg 1x, https://example.com/hero@2x.jpg 2x',
+ imageAutoSizes: true,
+ imageSizesPreset: 'desktop-fixed',
+ imageSizes: '(max-width: 768px) 100vw, 700px',
+ }
+ const { html } = exportPage(basePage, options)
+ expect(html).toMatch(/
![]()
]*sizes="\(max-width: 768px\) 100vw, 700px"/)
+ })
})