mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
test: rm unnecessary async (#48033)
* chore: rm unnecessary React.useMemo * Revert "chore: reset commit" This reverts commit 2fa5df518582211884fbec5911641d0998d5a6fa. * test: rm unnecessary async
This commit is contained in:
parent
e17cd4ae27
commit
a3077e449e
@ -1,12 +1,12 @@
|
|||||||
import getScroll from '../getScroll';
|
import getScroll from '../getScroll';
|
||||||
|
|
||||||
describe('getScroll', () => {
|
describe('getScroll', () => {
|
||||||
it('getScroll target null', async () => {
|
it('getScroll target null', () => {
|
||||||
expect(getScroll(null, true)).toBe(0);
|
expect(getScroll(null, true)).toBe(0);
|
||||||
expect(getScroll(null, false)).toBe(0);
|
expect(getScroll(null, false)).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getScroll window', async () => {
|
it('getScroll window', () => {
|
||||||
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
||||||
window.pageXOffset = x;
|
window.pageXOffset = x;
|
||||||
window.pageYOffset = y;
|
window.pageYOffset = y;
|
||||||
@ -17,7 +17,7 @@ describe('getScroll', () => {
|
|||||||
scrollToSpy.mockRestore();
|
scrollToSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getScroll document', async () => {
|
it('getScroll document', () => {
|
||||||
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
||||||
document.documentElement.scrollLeft = x;
|
document.documentElement.scrollLeft = x;
|
||||||
document.documentElement.scrollTop = y;
|
document.documentElement.scrollTop = y;
|
||||||
@ -28,7 +28,7 @@ describe('getScroll', () => {
|
|||||||
scrollToSpy.mockRestore();
|
scrollToSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getScroll div', async () => {
|
it('getScroll div', () => {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
||||||
div.scrollLeft = x;
|
div.scrollLeft = x;
|
||||||
@ -40,7 +40,7 @@ describe('getScroll', () => {
|
|||||||
scrollToSpy.mockRestore();
|
scrollToSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getScroll documentElement', async () => {
|
it('getScroll documentElement', () => {
|
||||||
const div: any = {};
|
const div: any = {};
|
||||||
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
const scrollToSpy = jest.spyOn(window, 'scrollTo').mockImplementation((x, y) => {
|
||||||
div.scrollLeft = null;
|
div.scrollLeft = null;
|
||||||
|
@ -244,7 +244,7 @@ describe('Drawer', () => {
|
|||||||
errorSpy.mockRestore();
|
errorSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should hide close button when closeIcon is null or false', async () => {
|
it('should hide close button when closeIcon is null or false', () => {
|
||||||
const { baseElement, rerender } = render(
|
const { baseElement, rerender } = render(
|
||||||
<Drawer open closeIcon={null}>
|
<Drawer open closeIcon={null}>
|
||||||
Here is content of Drawer
|
Here is content of Drawer
|
||||||
@ -311,7 +311,7 @@ describe('Drawer', () => {
|
|||||||
expect(baseElement.querySelector('.anticon-close')).not.toBeNull();
|
expect(baseElement.querySelector('.anticon-close')).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('match between styles and deprecated style prop', async () => {
|
it('match between styles and deprecated style prop', () => {
|
||||||
const initialFontSize = 10;
|
const initialFontSize = 10;
|
||||||
let fontSize1 = initialFontSize;
|
let fontSize1 = initialFontSize;
|
||||||
let fontSize2 = initialFontSize;
|
let fontSize2 = initialFontSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user