File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module.exports = {
6
6
'^.+\\.tsx?$' : 'ts-jest' ,
7
7
} ,
8
8
transformIgnorePatterns : [ '/node_modules/' ] ,
9
+ coveragePathIgnorePatterns : [ '/tests/unit/' ] ,
9
10
moduleNameMapper : {
10
11
'^@/(.*)$' : '<rootDir>/src/$1' ,
11
12
} ,
Original file line number Diff line number Diff line change @@ -79,14 +79,21 @@ export namespace mockImageOnload {
79
79
const originalImgProtoDesc = Object . getOwnPropertyDescriptor (
80
80
window . Image . prototype ,
81
81
'src'
82
- ) as PropertyDecorator
82
+ ) as PropertyDescriptor
83
83
84
84
const mockImgProtoDesc = {
85
85
set ( this : HTMLImageElement , value : string ) {
86
+ if ( originalImgProtoDesc . set ) {
87
+ originalImgProtoDesc . set . call ( this , value )
88
+ }
86
89
loadedImgs . add ( value )
87
90
this . dispatchEvent ( new CustomEvent ( 'load' ) )
91
+ const [ , width = 0 , height = 0 ] =
92
+ value . match ( / h t t p s : \/ \/ p l a c e i m g .c o m \/ ( \d + ) \/ ( \d + ) \/ a n y / ) || [ ]
93
+ this . width = + width
94
+ this . height = + height
88
95
} ,
89
- }
96
+ } as PropertyDescriptor
90
97
91
98
const setImgProtoSrc = ( enableMock : boolean ) => {
92
99
const desc = enableMock ? mockImgProtoDesc : originalImgProtoDesc
You can’t perform that action at this time.
0 commit comments