mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
test: ✅ fix eslint jest rules
This commit is contained in:
parent
e09040f3af
commit
0de1358924
@ -113,6 +113,9 @@ module.exports = {
|
|||||||
|
|
||||||
'jest/no-test-callback': 0,
|
'jest/no-test-callback': 0,
|
||||||
'jest/expect-expect': 0,
|
'jest/expect-expect': 0,
|
||||||
|
'jest/no-done-callback': 0,
|
||||||
|
'jest/valid-title': 0,
|
||||||
|
'jest/no-conditional-expect': 0,
|
||||||
|
|
||||||
'unicorn/better-regex': 2,
|
'unicorn/better-regex': 2,
|
||||||
'unicorn/prefer-trim-start-end': 2,
|
'unicorn/prefer-trim-start-end': 2,
|
||||||
|
@ -186,7 +186,7 @@ describe('Affix Render', () => {
|
|||||||
it.each([
|
it.each([
|
||||||
{ name: 'inner', index: 0 },
|
{ name: 'inner', index: 0 },
|
||||||
{ name: 'outer', index: 1 },
|
{ name: 'outer', index: 1 },
|
||||||
])(name, async ({ index }) => {
|
])('inner or outer', async ({ index }) => {
|
||||||
document.body.innerHTML = '<div id="mounter" />';
|
document.body.innerHTML = '<div id="mounter" />';
|
||||||
|
|
||||||
const updateCalled = jest.fn();
|
const updateCalled = jest.fn();
|
||||||
|
@ -214,7 +214,7 @@ describe('Calendar', () => {
|
|||||||
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('3'));
|
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('3'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('if start.month > value.month, set value.month to start.month ', () => {
|
it('if start.month > value.month, set value.month to start.month', () => {
|
||||||
const value = new Moment('1990-01-03');
|
const value = new Moment('1990-01-03');
|
||||||
const start = new Moment('2019-11-01');
|
const start = new Moment('2019-11-01');
|
||||||
const end = new Moment('2019-03-01');
|
const end = new Moment('2019-03-01');
|
||||||
@ -223,7 +223,7 @@ describe('Calendar', () => {
|
|||||||
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('10'));
|
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('10'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('if change year and new month > end month, set value.month to end.month ', () => {
|
it('if change year and new month > end month, set value.month to end.month', () => {
|
||||||
const value = new Moment('2018-11-03');
|
const value = new Moment('2018-11-03');
|
||||||
const start = new Moment('2000-01-01');
|
const start = new Moment('2000-01-01');
|
||||||
const end = new Moment('2019-03-01');
|
const end = new Moment('2019-03-01');
|
||||||
|
@ -86,6 +86,7 @@ describe('Carousel', () => {
|
|||||||
|
|
||||||
describe('should works for dotPosition', () => {
|
describe('should works for dotPosition', () => {
|
||||||
['left', 'right', 'top', 'bottom'].forEach(dotPosition => {
|
['left', 'right', 'top', 'bottom'].forEach(dotPosition => {
|
||||||
|
// eslint-disable-next-line jest/valid-title
|
||||||
it(dotPosition, () => {
|
it(dotPosition, () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<Carousel dotPosition={dotPosition}>
|
<Carousel dotPosition={dotPosition}>
|
||||||
@ -118,12 +119,7 @@ describe('Carousel', () => {
|
|||||||
children: [<div key="1" />, <div key="2" />, <div key="3" />],
|
children: [<div key="1" />, <div key="2" />, <div key="3" />],
|
||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(
|
expect(wrapper.find('.slick-dots li').at(1).hasClass('slick-active')).toBeTruthy();
|
||||||
wrapper
|
|
||||||
.find('.slick-dots li')
|
|
||||||
.at(1)
|
|
||||||
.hasClass('slick-active'),
|
|
||||||
).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ describe('Upload', () => {
|
|||||||
errorSpy.mockRestore();
|
errorSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it should be treated as file but not an image', () => {
|
it('should be treated as file but not an image', () => {
|
||||||
const file = {
|
const file = {
|
||||||
status: 'done',
|
status: 'done',
|
||||||
uid: '-1',
|
uid: '-1',
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
"@types/enzyme": "^3.10.5",
|
"@types/enzyme": "^3.10.5",
|
||||||
"@types/gtag.js": "^0.0.3",
|
"@types/gtag.js": "^0.0.3",
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.0",
|
||||||
"@types/jest-image-snapshot": "^3.1.0",
|
"@types/jest-image-snapshot": "^4.1.0",
|
||||||
"@types/lodash": "^4.14.139",
|
"@types/lodash": "^4.14.139",
|
||||||
"@types/puppeteer": "^3.0.0",
|
"@types/puppeteer": "^3.0.0",
|
||||||
"@types/raf": "^3.4.0",
|
"@types/raf": "^3.4.0",
|
||||||
@ -202,7 +202,7 @@
|
|||||||
"eslint-config-prettier": "^6.0.0",
|
"eslint-config-prettier": "^6.0.0",
|
||||||
"eslint-plugin-babel": "^5.3.0",
|
"eslint-plugin-babel": "^5.3.0",
|
||||||
"eslint-plugin-import": "^2.21.1",
|
"eslint-plugin-import": "^2.21.1",
|
||||||
"eslint-plugin-jest": "^23.0.2",
|
"eslint-plugin-jest": "^24.0.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||||
"eslint-plugin-markdown": "^1.0.0",
|
"eslint-plugin-markdown": "^1.0.0",
|
||||||
"eslint-plugin-react": "^7.14.2",
|
"eslint-plugin-react": "^7.14.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user