File tree Expand file tree Collapse file tree 4 files changed +49
-1
lines changed
test/integration/image-component/default Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ function handleLoading(
265
265
const p = 'decode' in img ? img . decode ( ) : Promise . resolve ( )
266
266
p . catch ( ( ) => { } ) . then ( ( ) => {
267
267
if ( placeholder === 'blur' ) {
268
- img . style . filter = 'none '
268
+ img . style . filter = ''
269
269
img . style . backgroundSize = 'none'
270
270
img . style . backgroundImage = 'none'
271
271
}
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import Image from 'next/image'
3
+ import style from '../style.module.css'
4
+ import img from '../public/test.jpg'
5
+
6
+ const Page = ( ) => {
7
+ return (
8
+ < div >
9
+ < h1 > Image Style Filter</ h1 >
10
+
11
+ < Image
12
+ className = { style . opacity50 }
13
+ id = "img-plain"
14
+ src = "/test.jpg"
15
+ width = { 400 }
16
+ height = { 400 }
17
+ />
18
+
19
+ < Image
20
+ className = { style . opacity50 }
21
+ id = "img-blur"
22
+ placeholder = "blur"
23
+ src = { img }
24
+ />
25
+
26
+ < footer > Footer</ footer >
27
+ </ div >
28
+ )
29
+ }
30
+
31
+ export default Page
Original file line number Diff line number Diff line change 9
9
.mainContainer img {
10
10
border-radius : 139px ;
11
11
}
12
+
13
+ .opacity50 {
14
+ filter : opacity (0.5 );
15
+ }
Original file line number Diff line number Diff line change @@ -828,6 +828,19 @@ function runTests(mode) {
828
828
}
829
829
} )
830
830
831
+ it ( 'should apply filter style after image loads' , async ( ) => {
832
+ const browser = await webdriver ( appPort , '/style-filter' )
833
+ await check ( ( ) => getSrc ( browser , 'img-plain' ) , / ^ \/ _ n e x t \/ i m a g e / )
834
+ await check ( ( ) => getSrc ( browser , 'img-blur' ) , / ^ \/ _ n e x t \/ i m a g e / )
835
+ await waitFor ( 1000 )
836
+
837
+ const plain = await getComputedStyle ( browser , 'img-plain' , 'filter' )
838
+ expect ( plain ) . toBe ( 'opacity(0.5)' )
839
+
840
+ const blur = await getComputedStyle ( browser , 'img-blur' , 'filter' )
841
+ expect ( blur ) . toBe ( 'opacity(0.5)' )
842
+ } )
843
+
831
844
// Tests that use the `unsized` attribute:
832
845
if ( mode !== 'dev' ) {
833
846
it ( 'should correctly rotate image' , async ( ) => {
You can’t perform that action at this time.
0 commit comments