diff options
author | 2024-11-15 13:29:52 +0000 | |
---|---|---|
committer | 2024-11-15 13:29:52 +0000 | |
commit | af867f3910ecd8fc04a5337f591d84f03192e3fa (patch) | |
tree | a5e5b267915c01010a1f608629c412c255d13470 /packages/integrations/markdoc/test | |
parent | c8f877cad2d8f1780f70045413872d5b9d32ebed (diff) | |
download | astro-af867f3910ecd8fc04a5337f591d84f03192e3fa.tar.gz astro-af867f3910ecd8fc04a5337f591d84f03192e3fa.tar.zst astro-af867f3910ecd8fc04a5337f591d84f03192e3fa.zip |
feat: experimental responsive images (#12377)
* chore: changeset
* feat: add experimental responsive images config option (#12378)
* feat: add experimental responsive images config option
* Apply suggestions from code review
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* Update config types
* Move config into `images`
* Move jsdocs
---------
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* feat: add responsive image component (#12381)
* feat: add experimental responsive images config option
* Apply suggestions from code review
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* Update config types
* Move config into `images`
* Move jsdocs
* wip: responsive image component
* Improve srcset logic
* Improve fixture
* Lock
* Update styling
* Fix style prop handling
* Update test (there's an extra style for images now)
* Safely access the src props
* Remove unused export
* Handle priority images
* Consolidate styles
* Update tests
* Comment
* Refactor srcset
* Avoid dupes of original image
* Calculate missing dimensions
* Bugfixes
* Add tests
* Fix test
* Correct order
* Lint
* Fix fspath
* Update test
* Fix test
* Conditional component per flag
* Fix class concatenation
* Remove logger
* Rename helper
* Add comments
* Format
* Fix markdoc tests
* Add test for style tag
---------
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* feat: add crop support to image services (#12414)
* wip: add crop support to image services
* Add tests
* Strip crop attributes
* Don't upscale
* Format
* Get build working properly
* Changes from review
* Fix jsdoc
* feat: add responsive support to picture component (#12423)
* feat: add responsive support to picture component
* Add picture tests
* Fix test
* Implement own define vars
* Share logic
* Prevent extra astro-* class
* Use dataset scoping
* Revert unit test
* Revert "Fix test"
This reverts commit f9ec6e2938ff291037234d56f8eec76a93be0c0d.
* Changes from review
* docs: add docs for responsive images (#12429)
* docs: add responsive images flag docs
* docs: adds jsdoc for image components
* chore: updates from review
* Fix jsdoc
* Changes from review
* Add breakpoints option
* typo
---------
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'packages/integrations/markdoc/test')
-rw-r--r-- | packages/integrations/markdoc/test/image-assets.test.js | 4 | ||||
-rw-r--r-- | packages/integrations/markdoc/test/propagated-assets.test.js | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/packages/integrations/markdoc/test/image-assets.test.js b/packages/integrations/markdoc/test/image-assets.test.js index 0f98af4f1..793bf1be6 100644 --- a/packages/integrations/markdoc/test/image-assets.test.js +++ b/packages/integrations/markdoc/test/image-assets.test.js @@ -38,7 +38,7 @@ describe('Markdoc - Image assets', () => { const { document } = parseHTML(html); assert.match( document.querySelector('#relative > img')?.src, - /\/_image\?href=.*%2Fsrc%2Fassets%2Frelative%2Foar.jpg%3ForigWidth%3D420%26origHeight%3D630%26origFormat%3Djpg&f=webp/, + /\/_image\?href=.*%2Fsrc%2Fassets%2Frelative%2Foar.jpg%3ForigWidth%3D420%26origHeight%3D630%26origFormat%3Djpg&w=420&h=630&f=webp/, ); }); @@ -48,7 +48,7 @@ describe('Markdoc - Image assets', () => { const { document } = parseHTML(html); assert.match( document.querySelector('#alias > img')?.src, - /\/_image\?href=.*%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&f=webp/, + /\/_image\?href=.*%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&w=420&h=280&f=webp/, ); }); diff --git a/packages/integrations/markdoc/test/propagated-assets.test.js b/packages/integrations/markdoc/test/propagated-assets.test.js index a0768448f..5fe7369ce 100644 --- a/packages/integrations/markdoc/test/propagated-assets.test.js +++ b/packages/integrations/markdoc/test/propagated-assets.test.js @@ -45,12 +45,12 @@ describe('Markdoc - propagated assets', () => { let styleContents; if (mode === 'dev') { const styles = stylesDocument.querySelectorAll('style'); - assert.equal(styles.length, 1); - styleContents = styles[0].textContent; + assert.equal(styles.length, 2); + styleContents = styles[1].textContent; } else { const links = stylesDocument.querySelectorAll('link[rel="stylesheet"]'); - assert.equal(links.length, 1); - styleContents = await fixture.readFile(links[0].href); + assert.equal(links.length, 2); + styleContents = await fixture.readFile(links[1].href); } assert.equal(styleContents.includes('--color-base-purple: 269, 79%;'), true); }); @@ -58,10 +58,10 @@ describe('Markdoc - propagated assets', () => { it('[fails] Does not bleed styles to other page', async () => { if (mode === 'dev') { const styles = scriptsDocument.querySelectorAll('style'); - assert.equal(styles.length, 0); + assert.equal(styles.length, 1); } else { const links = scriptsDocument.querySelectorAll('link[rel="stylesheet"]'); - assert.equal(links.length, 0); + assert.equal(links.length, 1); } }); }); |