fix Carousel test case

This commit is contained in:
afc163 2019-08-12 15:10:35 +08:00
parent 5e99ed7bbe
commit 9095189bcf
3 changed files with 7 additions and 3 deletions

View File

@ -116,6 +116,11 @@ describe('Carousel', () => {
});
it('should keep initialSlide', () => {
// react unsafe lifecycle don't works in React 15
// https://github.com/akiran/react-slick/commit/97988e897750e1d8f7b10a86b655f50d75d38298
if (process.env.REACT === '15') {
return;
}
const wrapper = mount(<Carousel initialSlide={1} />);
wrapper.setProps({
children: [<div key="1" />, <div key="2" />, <div key="3" />],

View File

@ -1,7 +1,6 @@
import * as React from 'react';
import debounce from 'lodash/debounce';
import { Settings } from 'react-slick';
import { polyfill } from 'react-lifecycles-compat';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
@ -22,7 +21,7 @@ if (typeof window !== 'undefined') {
// make sure matchMedia polyfill run before require('react-slick')
// Fix https://github.com/ant-design/ant-design/issues/6560
// Fix https://github.com/ant-design/ant-design/issues/3308
const SlickCarousel = polyfill(require('react-slick').default);
const SlickCarousel = require('react-slick').default;
export type CarouselEffect = 'scrollx' | 'fade';
export type DotPosition = 'top' | 'bottom' | 'left' | 'right';

View File

@ -90,7 +90,7 @@
"rc-util": "^4.6.0",
"react-lazy-load": "^3.0.13",
"react-lifecycles-compat": "^3.0.4",
"react-slick": "~0.25.0",
"react-slick": "~0.25.2",
"resize-observer-polyfill": "^1.5.1",
"shallowequal": "^1.1.0",
"warning": "~4.0.3"