Fix the image tests (#5338)
* Fix the image tests * fix more base tests
This commit is contained in:
parent
230d71f4b7
commit
faa01cec73
8 changed files with 10 additions and 8 deletions
|
@ -2,6 +2,7 @@
|
|||
import socialJpg from '../assets/social.jpg';
|
||||
import introJpg from '../assets/blog/introducing astro.jpg';
|
||||
import { Image } from '@astrojs/image/components';
|
||||
const publicImage = new URL('./hero.jpg', Astro.url);
|
||||
---
|
||||
|
||||
<html>
|
||||
|
@ -9,7 +10,7 @@ import { Image } from '@astrojs/image/components';
|
|||
<!-- Head Stuff -->
|
||||
</head>
|
||||
<body>
|
||||
<Image id="hero" src="/hero.jpg" width={768} height={414} format="webp" alt="hero" />
|
||||
<Image id="hero" src={publicImage.pathname} width={768} height={414} format="webp" alt="hero" />
|
||||
<br />
|
||||
<Image id="spaces" src={introJpg} width={768} height={414} format="webp" alt="spaces" />
|
||||
<br />
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import socialJpg from '../assets/social.jpg';
|
||||
import introJpg from '../assets/blog/introducing astro.jpg';
|
||||
import { Picture } from '@astrojs/image/components';
|
||||
const publicImage = new URL('./hero.jpg', Astro.url);
|
||||
---
|
||||
|
||||
<html>
|
||||
|
@ -9,7 +10,7 @@ import { Picture } from '@astrojs/image/components';
|
|||
<!-- Head Stuff -->
|
||||
</head>
|
||||
<body>
|
||||
<Picture id="hero" src="/hero.jpg" sizes="100vw" widths={[384, 768]} aspectRatio={768/414} alt="Hero image" />
|
||||
<Picture id="hero" src={publicImage.pathname} sizes="100vw" widths={[384, 768]} aspectRatio={768/414} alt="Hero image" />
|
||||
<br />
|
||||
<Picture id="spaces" src={introJpg} sizes="100vw" widths={[384, 768]} aspectRatio={768/414} alt="spaces" />
|
||||
<br />
|
||||
|
|
|
@ -164,7 +164,7 @@ describe('SSG images with subpath - dev', function () {
|
|||
title: 'Public images',
|
||||
id: '#hero',
|
||||
url: '/_image',
|
||||
query: { f: 'webp', w: '768', h: '414', href: '/hero.jpg' },
|
||||
query: { f: 'webp', w: '768', h: '414', href: '/docs/hero.jpg' },
|
||||
},
|
||||
{
|
||||
title: 'Background color',
|
||||
|
|
|
@ -186,7 +186,7 @@ describe('SSR images with subpath - build', function () {
|
|||
title: 'Public images',
|
||||
id: '#hero',
|
||||
url: '/_image',
|
||||
query: { f: 'webp', w: '768', h: '414', href: '/hero.jpg' },
|
||||
query: { f: 'webp', w: '768', h: '414', href: '/docs/hero.jpg' },
|
||||
},
|
||||
{
|
||||
title: 'Background color',
|
||||
|
|
|
@ -199,7 +199,7 @@ describe('SSR images with subpath - dev', function () {
|
|||
f: 'webp',
|
||||
w: '768',
|
||||
h: '414',
|
||||
href: '/hero.jpg',
|
||||
href: '/docs/hero.jpg',
|
||||
},
|
||||
contentType: 'image/webp',
|
||||
},
|
||||
|
|
|
@ -154,7 +154,7 @@ describe('SSG pictures with subpath - dev', function () {
|
|||
title: 'Public images',
|
||||
id: '#hero',
|
||||
url: '/_image',
|
||||
query: { f: 'jpg', w: '768', h: '414', href: '/hero.jpg' },
|
||||
query: { f: 'jpg', w: '768', h: '414', href: '/docs/hero.jpg' },
|
||||
alt: 'Hero image',
|
||||
},
|
||||
].forEach(({ title, id, url, query, alt }) => {
|
||||
|
|
|
@ -175,7 +175,7 @@ describe('SSR pictures with subpath - build', function () {
|
|||
title: 'Public images',
|
||||
id: '#hero',
|
||||
url: '/_image',
|
||||
query: { f: 'jpg', w: '768', h: '414', href: '/hero.jpg' },
|
||||
query: { f: 'jpg', w: '768', h: '414', href: '/docs/hero.jpg' },
|
||||
alt: 'Hero image',
|
||||
},
|
||||
{
|
||||
|
|
|
@ -213,7 +213,7 @@ describe('SSR pictures with subpath - dev', function () {
|
|||
f: 'jpg',
|
||||
w: '768',
|
||||
h: '414',
|
||||
href: '/hero.jpg',
|
||||
href: '/docs/hero.jpg',
|
||||
},
|
||||
contentType: 'image/jpeg',
|
||||
alt: 'Hero image',
|
||||
|
|
Loading…
Reference in a new issue