-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1523 from Adslot/react18
React18
- Loading branch information
Showing
137 changed files
with
7,801 additions
and
8,485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
{ | ||
"root": true, | ||
"plugins": ["jest-dom"], | ||
"extends": ["adslot", "plugin:jest-dom/recommended", "plugin:import/typescript"], | ||
"extends": ["adslot", "plugin:import/typescript"], | ||
"settings": { | ||
"lodash": { | ||
"version": 4 | ||
}, | ||
"import/resolver": { | ||
"alias": { | ||
"map": [["testing", "./config/testing"]] | ||
} | ||
} | ||
}, | ||
"rules": { | ||
"no-console": ["error", { "allow": ["warn", "error"] }], | ||
"@typescript-eslint/no-explicit-any": "off" | ||
} | ||
}, | ||
|
||
"overrides": [ | ||
{ | ||
"files": ["**/?(*.)spec.js?(x)"], | ||
"extends": ["plugin:jest/recommended", "plugin:jest-dom/recommended", "plugin:testing-library/react"], | ||
"rules": { | ||
"jest/expect-expect": "error", | ||
"jest/no-commented-out-tests": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,43 @@ | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import '@testing-library/jest-dom'; | ||
|
||
window.matchMedia = jest.fn().mockImplementation((query) => { | ||
return { | ||
// for slick-carousel, date picker | ||
Object.defineProperty(window, 'matchMedia', { | ||
writable: true, | ||
value: (query) => ({ | ||
matches: false, | ||
media: query, | ||
onchange: null, | ||
addListener: jest.fn(), | ||
removeListener: jest.fn(), | ||
}; | ||
addEventListener: jest.fn(), | ||
removeEventListener: jest.fn(), | ||
dispatchEvent: jest.fn(), | ||
}), | ||
}); | ||
|
||
Object.defineProperty(window, 'scrollTo', { value: () => {}, writable: true }); | ||
window.ResizeObserver = class ResizeObserver { | ||
observe = jest.fn(); | ||
unobserve = jest.fn(); | ||
disconnect = jest.fn(); | ||
}; | ||
// for RichTextEditor | ||
Object.defineProperty(window, 'scrollTo', { | ||
writable: true, | ||
value: jest.fn(), | ||
}); | ||
|
||
Object.defineProperty(HTMLElement.prototype, 'scrollIntoView', { | ||
writable: true, | ||
value: jest.fn(), | ||
}); | ||
|
||
// for Paragraph | ||
Object.defineProperty(window, 'ResizeObserver', { | ||
writable: true, | ||
value: class ResizeObserver { | ||
observe = jest.fn(); | ||
unobserve = jest.fn(); | ||
disconnect = jest.fn(); | ||
}, | ||
}); | ||
|
||
// for cropperjs | ||
beforeEach(() => { | ||
jest.spyOn(XMLHttpRequest.prototype, 'open').mockReturnValue(); | ||
jest.spyOn(XMLHttpRequest.prototype, 'send').mockReturnValue(); | ||
}); |
Oops, something went wrong.