Skip to content

Commit 1de22f8

Browse files
committed
chore: removed broken image that was no longer broken from main images demo page
1 parent f5e94a5 commit 1de22f8

File tree

3 files changed

+13
-37
lines changed

3 files changed

+13
-37
lines changed

cypress/integration/default/images.spec.ts

+12-26
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
describe('next/images', () => {
55
it('should show static image from /public', () => {
66
cy.visit('/')
7-
cy.findByRole('img').should('be.visible').and(($img) => {
8-
// "naturalWidth" and "naturalHeight" are set when the image loads
9-
expect(
10-
$img[0].naturalWidth,
11-
'image has natural width'
12-
).to.be.greaterThan(0)
13-
})
7+
cy.findByRole('img')
8+
.should('be.visible')
9+
.and(($img) => {
10+
// "naturalWidth" and "naturalHeight" are set when the image loads
11+
expect($img[0].naturalWidth, 'image has natural width').to.be.greaterThan(0)
12+
})
1413
})
1514

1615
it('should show image using next/image', () => {
@@ -20,24 +19,11 @@ describe('next/images', () => {
2019

2120
it('should show image allow-listed with remotePatterns', () => {
2221
cy.visit('/image')
23-
cy.findByRole('img',{ name: /tawny frogmouth/i }).should('be.visible').and(($img) => {
24-
// "naturalWidth" and "naturalHeight" are set when the image loads
25-
expect(
26-
$img[0].naturalWidth,
27-
'image has natural width'
28-
).to.be.greaterThan(0)
29-
})
30-
})
31-
32-
it('should show a broken image if it is not on domains or remotePatterns allowlist', () => {
33-
cy.visit('/image')
34-
cy.findByRole('img',{ name: /jellybeans/i }).should('be.visible').and(($img) => {
35-
expect(
36-
$img[0].style.height
37-
).to.equal('0px')
38-
expect(
39-
$img[0].style.width
40-
).to.equal('0px')
41-
})
22+
cy.findByRole('img', { name: /tawny frogmouth/i })
23+
.should('be.visible')
24+
.and(($img) => {
25+
// "naturalWidth" and "naturalHeight" are set when the image loads
26+
expect($img[0].naturalWidth, 'image has natural width').to.be.greaterThan(0)
27+
})
4228
})
4329
})

demos/default/next.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports = {
7171
},
7272
// https://nextjs.org/docs/basic-features/image-optimization#domains
7373
images: {
74-
domains: ['raw.githubusercontent.com', 'upload.wikimedia.org'],
74+
domains: ['raw.githubusercontent.com'],
7575
remotePatterns: [
7676
{
7777
hostname: '*.imgur.com',

demos/default/pages/image.js

-10
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ const Images = () => (
2222
/>
2323
<Image src="https://i.imgur.com/bxSRS3Jb.png" alt="Tawny Frogmouth" width={160} height={160} />
2424
</p>
25-
26-
<p>
27-
The following image should be broken as the domain is not added to domains or remotePatterns in next.config.js:
28-
</p>
29-
<Image
30-
src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/SIPI_Jelly_Beans_4.1.07.tiff/lossy-page1-256px-SIPI_Jelly_Beans_4.1.07.tiff.jpg"
31-
alt="Jellybeans"
32-
width={146}
33-
height={32}
34-
/>
3525
</div>
3626
)
3727

0 commit comments

Comments
 (0)