File tree 3 files changed +13
-37
lines changed
cypress/integration/default
3 files changed +13
-37
lines changed Original file line number Diff line number Diff line change 4
4
describe ( 'next/images' , ( ) => {
5
5
it ( 'should show static image from /public' , ( ) => {
6
6
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
+ } )
14
13
} )
15
14
16
15
it ( 'should show image using next/image' , ( ) => {
@@ -20,24 +19,11 @@ describe('next/images', () => {
20
19
21
20
it ( 'should show image allow-listed with remotePatterns' , ( ) => {
22
21
cy . visit ( '/image' )
23
- cy . findByRole ( 'img' , { name : / t a w n y f r o g m o u t h / 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 : / j e l l y b e a n s / 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 : / t a w n y f r o g m o u t h / 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
+ } )
42
28
} )
43
29
} )
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ module.exports = {
71
71
} ,
72
72
// https://nextjs.org/docs/basic-features/image-optimization#domains
73
73
images : {
74
- domains : [ 'raw.githubusercontent.com' , 'upload.wikimedia.org' ] ,
74
+ domains : [ 'raw.githubusercontent.com' ] ,
75
75
remotePatterns : [
76
76
{
77
77
hostname : '*.imgur.com' ,
Original file line number Diff line number Diff line change @@ -22,16 +22,6 @@ const Images = () => (
22
22
/>
23
23
< Image src = "https://i.imgur.com/bxSRS3Jb.png" alt = "Tawny Frogmouth" width = { 160 } height = { 160 } />
24
24
</ 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
- />
35
25
</ div >
36
26
)
37
27
You can’t perform that action at this time.
0 commit comments