diff --git a/components/calendar/__tests__/index.test.js b/components/calendar/__tests__/index.test.js
index 6b5b52134d..521ba06af8 100644
--- a/components/calendar/__tests__/index.test.js
+++ b/components/calendar/__tests__/index.test.js
@@ -16,10 +16,7 @@ describe('Calendar', () => {
rtlTest(Calendar, true);
function openSelect(wrapper, className) {
- wrapper
- .find(className)
- .find('.ant-select-selector')
- .simulate('mousedown');
+ wrapper.find(className).find('.ant-select-selector').simulate('mousedown');
}
function findSelectItem(wrapper) {
@@ -27,18 +24,13 @@ describe('Calendar', () => {
}
function clickSelectItem(wrapper, index = 0) {
- findSelectItem(wrapper)
- .at(index)
- .simulate('click');
+ findSelectItem(wrapper).at(index).simulate('click');
}
it('Calendar should be selectable', () => {
const onSelect = jest.fn();
const wrapper = mount();
- wrapper
- .find('.ant-picker-cell')
- .at(0)
- .simulate('click');
+ wrapper.find('.ant-picker-cell').at(0).simulate('click');
expect(onSelect).toHaveBeenCalledWith(expect.anything());
const value = onSelect.mock.calls[0][0];
expect(Moment.isMoment(value)).toBe(true);
@@ -50,14 +42,8 @@ describe('Calendar', () => {
const wrapper = mount(
,
);
- wrapper
- .find('[title="2018-02-01"]')
- .at(0)
- .simulate('click');
- wrapper
- .find('[title="2018-02-02"]')
- .at(0)
- .simulate('click');
+ wrapper.find('[title="2018-02-01"]').at(0).simulate('click');
+ wrapper.find('[title="2018-02-02"]').at(0).simulate('click');
expect(onSelect.mock.calls.length).toBe(1);
});
@@ -67,10 +53,7 @@ describe('Calendar', () => {
const wrapper = mount(
,
);
- wrapper
- .find('[title="2018-02-20"]')
- .at(0)
- .simulate('click');
+ wrapper.find('[title="2018-02-20"]').at(0).simulate('click');
const elem = wrapper.find('[title="2018-02-20"]').hasClass('ant-picker-cell-disabled');
expect(elem).toEqual(true);
expect(onSelect.mock.calls.length).toBe(0);
@@ -87,32 +70,13 @@ describe('Calendar', () => {
mode="year"
/>,
);
- expect(
- wrapper
- .find('[title="2018-01"]')
- .at(0)
- .hasClass('ant-picker-cell-disabled'),
- ).toBe(true);
- expect(
- wrapper
- .find('[title="2018-02"]')
- .at(0)
- .hasClass('ant-picker-cell-disabled'),
- ).toBe(false);
- expect(
- wrapper
- .find('[title="2018-06"]')
- .at(0)
- .hasClass('ant-picker-cell-disabled'),
- ).toBe(true);
- wrapper
- .find('[title="2018-01"]')
- .at(0)
- .simulate('click');
- wrapper
- .find('[title="2018-03"]')
- .at(0)
- .simulate('click');
+ expect(wrapper.find('[title="2018-01"]').at(0).hasClass('ant-picker-cell-disabled')).toBe(true);
+ expect(wrapper.find('[title="2018-02"]').at(0).hasClass('ant-picker-cell-disabled')).toBe(
+ false,
+ );
+ expect(wrapper.find('[title="2018-06"]').at(0).hasClass('ant-picker-cell-disabled')).toBe(true);
+ wrapper.find('[title="2018-01"]').at(0).simulate('click');
+ wrapper.find('[title="2018-03"]').at(0).simulate('click');
expect(onSelect.mock.calls.length).toBe(1);
});
@@ -155,7 +119,7 @@ describe('Calendar', () => {
});
it('Calendar should support locale', () => {
- MockDate.set(Moment('2018-10-19'));
+ MockDate.set(Moment('2018-10-19').valueOf());
// eslint-disable-next-line global-require
const zhCN = require('../locale/zh_CN').default;
const wrapper = mount();
@@ -168,10 +132,7 @@ describe('Calendar', () => {
const date = new Moment('1990-09-03');
const wrapper = mount();
- wrapper
- .find('.ant-picker-cell')
- .at(0)
- .simulate('click');
+ wrapper.find('.ant-picker-cell').at(0).simulate('click');
expect(onPanelChange).toHaveBeenCalled();
expect(onPanelChange.mock.calls[0][0].month()).toEqual(date.month() - 1);
@@ -242,10 +203,7 @@ describe('Calendar', () => {
/>,
);
openSelect(wrapper, '.ant-picker-calendar-year-select');
- wrapper
- .find('.ant-select-item-option')
- .last()
- .simulate('click');
+ wrapper.find('.ant-select-item-option').last().simulate('click');
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('2'));
});
@@ -283,10 +241,7 @@ describe('Calendar', () => {
type="date"
/>,
);
- wrapper
- .find('input[type="radio"]')
- .at(1)
- .simulate('change');
+ wrapper.find('input[type="radio"]').at(1).simulate('change');
expect(onTypeChange).toHaveBeenCalledWith('year');
});
@@ -324,9 +279,7 @@ describe('Calendar', () => {
openSelect(wrapperWithYear, '.ant-select');
wrapperWithYear.update();
- findSelectItem(wrapperWithYear)
- .last()
- .simulate('click');
+ findSelectItem(wrapperWithYear).last().simulate('click');
expect(onYearChange).toHaveBeenCalled();
@@ -371,9 +324,7 @@ describe('Calendar', () => {
openSelect(wrapperWithMonth, '.ant-select');
wrapperWithMonth.update();
- findSelectItem(wrapperWithMonth)
- .last()
- .simulate('click');
+ findSelectItem(wrapperWithMonth).last().simulate('click');
expect(onMonthChange).toHaveBeenCalled();
@@ -391,10 +342,7 @@ describe('Calendar', () => {
,
);
- wrapperWithTypeChange
- .find('.ant-radio-button-input')
- .last()
- .simulate('change');
+ wrapperWithTypeChange.find('.ant-radio-button-input').last().simulate('change');
expect(onTypeChange).toHaveBeenCalled();
});
@@ -402,23 +350,13 @@ describe('Calendar', () => {
const wrapper = mount(
Bamboo
} />,
);
- expect(
- wrapper
- .find('.light')
- .first()
- .text(),
- ).toEqual('Bamboo');
+ expect(wrapper.find('.light').first().text()).toEqual('Bamboo');
});
it('monthFullCellRender', () => {
const wrapper = mount(
Light
} />,
);
- expect(
- wrapper
- .find('.bamboo')
- .first()
- .text(),
- ).toEqual('Light');
+ expect(wrapper.find('.bamboo').first().text()).toEqual('Light');
});
});
diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js
index 11ff5c70ce..aedd9ef5d5 100644
--- a/components/date-picker/__tests__/DatePicker.test.js
+++ b/components/date-picker/__tests__/DatePicker.test.js
@@ -11,7 +11,7 @@ describe('DatePicker', () => {
focusTest(DatePicker, { refFocus: true });
beforeEach(() => {
- MockDate.set(moment('2016-11-22'));
+ MockDate.set(moment('2016-11-22').valueOf());
});
afterEach(() => {
diff --git a/components/locale-provider/__tests__/index.test.js b/components/locale-provider/__tests__/index.test.js
index a604f764cc..e9c027f709 100644
--- a/components/locale-provider/__tests__/index.test.js
+++ b/components/locale-provider/__tests__/index.test.js
@@ -174,7 +174,7 @@ describe('Locale Provider', () => {
));
beforeAll(() => {
- MockDate.set(moment('2017-09-18T03:30:07.795'));
+ MockDate.set(moment('2017-09-18T03:30:07.795').valueOf());
});
afterAll(() => {
diff --git a/components/statistic/__tests__/index.test.js b/components/statistic/__tests__/index.test.js
index 0c979ffcea..d251db4869 100644
--- a/components/statistic/__tests__/index.test.js
+++ b/components/statistic/__tests__/index.test.js
@@ -14,7 +14,7 @@ describe('Statistic', () => {
rtlTest(Statistic);
beforeAll(() => {
- MockDate.set(moment('2018-11-28 00:00:00'));
+ MockDate.set(moment('2018-11-28 00:00:00').valueOf());
});
afterAll(() => {
@@ -102,7 +102,7 @@ describe('Statistic', () => {
const wrapper = mount();
wrapper.update();
- MockDate.set(moment('2019-11-28 00:00:00'));
+ MockDate.set(moment('2019-11-28 00:00:00').valueOf());
jest.runAllTimers();
expect(onFinish).toHaveBeenCalled();
diff --git a/netlify.toml b/netlify.toml
deleted file mode 100644
index 6ea217a1d5..0000000000
--- a/netlify.toml
+++ /dev/null
@@ -1,111 +0,0 @@
-[build]
- publish = "_site"
- command = "npm run site"
-
-[[redirects]]
- from = "/docs/resource/download"
- to = "/docs/spec/download"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/resource/download-cn"
- to = "/docs/spec/download-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/resource/reference"
- to = "/docs/spec/reference"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/resource/reference-cn"
- to = "/docs/spec/reference-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/spec/feature"
- to = "/docs/spec/values"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/spec/feature-cn"
- to = "/docs/spec/values-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/advanced-search"
- to = "/docs/spec/overview"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/advanced-search-cn"
- to = "/docs/spec/overview-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/complex-table"
- to = "/docs/spec/overview"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/complex-table-cn"
- to = "/docs/spec/overview-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/form"
- to = "/docs/spec/overview"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/form-cn"
- to = "/docs/spec/overview-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/list"
- to = "/docs/spec/overview"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/list-cn"
- to = "/docs/spec/overview-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/navigation"
- to = "/docs/spec/overview"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/navigation-cn"
- to = "/docs/spec/overview-cn"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/table"
- to = "/docs/spec/overview"
- status = 301
- force = false
-
-[[redirects]]
- from = "/docs/pattern/table-cn"
- to = "/docs/spec/overview-cn"
- status = 301
- force = false
diff --git a/package.json b/package.json
index 8618a7e6a8..e8681dc293 100644
--- a/package.json
+++ b/package.json
@@ -62,7 +62,7 @@
"deploy": "bisheng gh-pages --push-only --dotfiles",
"deploy:china-mirror": "git checkout gh-pages && git pull origin gh-pages && git push git@gitee.com:ant-design/ant-design.git gh-pages",
"dist": "antd-tools run dist",
- "lint": "npm run lint:tsc && npm run lint:script && npm run lint:demo && npm run lint:style && npm run lint:deps && npm run lint:md",
+ "lint": "npm run tsc && npm run lint:script && npm run lint:demo && npm run lint:style && npm run lint:deps && npm run lint:md",
"lint-fix": "npm run lint-fix:script && npm run lint-fix:demo && npm run lint-fix:style",
"lint-fix:demo": "eslint-tinker ./components/*/demo/*.md",
"lint-fix:script": "npm run lint:script -- --fix",
@@ -72,7 +72,6 @@
"lint:md": "remark . -f -q",
"lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
"lint:style": "stylelint '{site,components}/**/*.less' --syntax less",
- "lint:tsc": "npm run tsc -- --noEmit",
"pre-publish": "npm run check-commit && npm run test-all",
"prettier": "prettier -c --write '**/*'",
"pretty-quick": "pretty-quick",
@@ -87,7 +86,7 @@
"test:update": "jest --config .jest.js --no-cache --update-snapshot",
"test-all": "./scripts/test-all.sh",
"test-node": "jest --config .jest.node.js --no-cache",
- "tsc": "tsc",
+ "tsc": "tsc --noEmit",
"site:test": "jest --config .jest.site.js --cache=false",
"test:image": "npm install puppeteer@2.1.1 --no-save && jest --config .jest.image.js --no-cache",
"version": "node ./scripts/generate-version"
@@ -160,10 +159,10 @@
"@types/enzyme": "^3.10.5",
"@types/gtag.js": "^0.0.3",
"@types/jest": "^25.1.0",
- "@types/jest-image-snapshot": "^2.12.0",
+ "@types/jest-image-snapshot": "^3.1.0",
"@types/lodash": "^4.14.139",
"@types/prop-types": "^15.7.1",
- "@types/puppeteer": "^2.0.1",
+ "@types/puppeteer": "^3.0.0",
"@types/raf": "^3.4.0",
"@types/react": "^16.9.21",
"@types/react-color": "^3.0.1",
@@ -216,7 +215,7 @@
"inquirer": "^7.1.0",
"intersection-observer": "^0.10.0",
"jest": "^26.0.0",
- "jest-image-snapshot": "^3.1.0",
+ "jest-image-snapshot": "^4.0.0",
"jest-stare": "^2.0.1",
"jquery": "^3.4.1",
"jsdom": "^16.0.0",
@@ -225,7 +224,7 @@
"logrocket": "^1.0.0",
"logrocket-react": "^4.0.0",
"lz-string": "^1.4.4",
- "mockdate": "^2.0.2",
+ "mockdate": "^3.0.0",
"node-fetch": "^2.6.0",
"open": "^7.0.3",
"preact": "^10.0.0",
diff --git a/tests/shared/demoTest.ts b/tests/shared/demoTest.ts
index 42991ffda5..1997cd0e35 100644
--- a/tests/shared/demoTest.ts
+++ b/tests/shared/demoTest.ts
@@ -53,7 +53,7 @@ export default function demoTest(component: string, options: Options = {}) {
testMethod = test.skip;
}
testMethod(`renders ${file} correctly`, () => {
- MockDate.set(moment('2016-11-22').toDate());
+ MockDate.set(moment('2016-11-22').valueOf());
const demo = require(`../.${file}`).default; // eslint-disable-line global-require, import/no-dynamic-require
const wrapper = render(demo);
diff --git a/tests/shared/rtlTest.tsx b/tests/shared/rtlTest.tsx
index aba03cffd5..e1e3c13ac8 100644
--- a/tests/shared/rtlTest.tsx
+++ b/tests/shared/rtlTest.tsx
@@ -9,7 +9,7 @@ export default function rtlTest(Component: React.ComponentType, mockDate?: boole
describe(`rtl render`, () => {
it(`component should be rendered correctly in RTL direction`, () => {
if (mockDate) {
- MockDate.set(Moment('2000-09-28').toDate());
+ MockDate.set(Moment('2000-09-28').valueOf());
}
const wrapper = mount(
diff --git a/tests/utils.ts b/tests/utils.ts
index 26f9adee07..53b05cc741 100644
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -1,8 +1,7 @@
-import moment from 'moment';
import MockDate from 'mockdate';
export function setMockDate(dateString = '2017-09-18T03:30:07.795') {
- MockDate.set(moment(dateString).toDate());
+ MockDate.set(dateString);
}
export function resetMockDate() {