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