Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADS-5897] React18 #1523

Merged
merged 4 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .eslintrc
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"
}
}
]
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ window.Perf = Perf;
- Interact the component in the way that feels slow.
- Run `Perf.stop()` to stop recording.
- Run `Perf.printWasted()` to see the nodes that are re–rendering but do not change the DOM.
- Use fastStatelessWrapper to wrap this component, passing in the properties to check.
- Re-test to make sure you're improving performance.

## Design tokens
Expand Down
6 changes: 3 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
coverage:
round: down
precision: 2
range: 98...100
range: 95...100
ignore:
- 'src/components/**/*.spec.*'
- 'src/components/**/mocks.*'
- 'src/**/*.spec.*'
- 'src/**/mocks.*'
status:
project:
default:
Expand Down
45 changes: 35 additions & 10 deletions config/testSetup.js
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();
});
Loading