From 48789924009ee3c563e3cc7f7c51f364f77ce376 Mon Sep 17 00:00:00 2001 From: Vitaliy Mazurenko Date: Wed, 27 Feb 2019 17:28:48 +0200 Subject: [PATCH 1/9] add responsive property to carousel (#15071) * add responsive property to carousel #15065 * extend carousel props from Slick type definitions #15065 --- components/carousel/index.tsx | 38 ++--------------------------------- package.json | 2 +- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index f74aaaadd3..611635f79d 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import debounce from 'lodash/debounce'; import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; +import { Settings } from 'react-slick'; // matchMedia polyfill for // https://github.com/WickyNilliams/enquire.js/issues/82 @@ -23,45 +24,10 @@ const SlickCarousel = require('react-slick').default; export type CarouselEffect = 'scrollx' | 'fade'; // Carousel -export interface CarouselProps { +export interface CarouselProps extends Settings { effect?: CarouselEffect; - dots?: boolean; - vertical?: boolean; - autoplay?: boolean; - easing?: string; - beforeChange?: (from: number, to: number) => void; - afterChange?: (current: number) => void; style?: React.CSSProperties; prefixCls?: string; - accessibility?: boolean; - nextArrow?: HTMLElement | any; - prevArrow?: HTMLElement | any; - pauseOnHover?: boolean; - className?: string; - adaptiveHeight?: boolean; - arrows?: boolean; - autoplaySpeed?: number; - centerMode?: boolean; - centerPadding?: string | any; - cssEase?: string | any; - dotsClass?: string; - draggable?: boolean; - fade?: boolean; - focusOnSelect?: boolean; - infinite?: boolean; - initialSlide?: number; - lazyLoad?: boolean; - rtl?: boolean; - slide?: string; - slidesToShow?: number; - slidesToScroll?: number; - speed?: number; - swipe?: boolean; - swipeToSlide?: boolean; - touchMove?: boolean; - touchThreshold?: number; - variableWidth?: boolean; - useCSS?: boolean; slickGoTo?: number; } diff --git a/package.json b/package.json index 21fbd0b2c1..6d8770fbfa 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "dependencies": { "@ant-design/icons": "~1.1.16", "@ant-design/icons-react": "~1.1.2", + "@types/react-slick": "^0.23.3", "array-tree-filter": "^2.1.0", "babel-runtime": "6.x", "classnames": "~2.2.6", @@ -98,7 +99,6 @@ "@types/react": "~16.8.1", "@types/react-dom": "^16.0.11", "@types/react-intl": "^2.3.14", - "@types/react-slick": "^0.23.2", "@types/warning": "^3.0.0", "@yesmeck/offline-plugin": "^5.0.5", "ansi-styles": "^3.2.1", From c5f9ed1d4f5ccde842ca4fdc5e56e380de03a6bb Mon Sep 17 00:00:00 2001 From: zombieJ Date: Thu, 28 Feb 2019 11:05:47 +0800 Subject: [PATCH 2/9] rm key in OptionProps (#15104) --- components/select/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index 247eca7eb5..dccd69155b 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -83,7 +83,6 @@ export interface OptionProps { title?: string; children?: React.ReactNode; className?: string; - key?: string; style?: React.CSSProperties; } From 34eafbfae5f8d1114bb0987529d15acf0732342f Mon Sep 17 00:00:00 2001 From: zombiej Date: Thu, 28 Feb 2019 16:38:24 +0800 Subject: [PATCH 3/9] update doc --- docs/react/faq.en-US.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/react/faq.en-US.md b/docs/react/faq.en-US.md index 0d8b58b3cd..7ddb5a9185 100644 --- a/docs/react/faq.en-US.md +++ b/docs/react/faq.en-US.md @@ -133,7 +133,7 @@ Alibaba pays us. --- -## Errors & Warnings +## Errors and Warnings Here are some errors & warnings that you may meet while using antd, but most of them are not bugs of antd. From 66786c7c4b6ff2af580826f1cd3a2137be436121 Mon Sep 17 00:00:00 2001 From: zombieJ Date: Fri, 1 Mar 2019 11:19:35 +0800 Subject: [PATCH 4/9] fix cascader should tab twice to exist (#15117) * fix cascader should tab twice to exist * update snapshot --- .../__tests__/__snapshots__/demo.test.js.snap | 14 ++++++++++++++ .../__tests__/__snapshots__/index.test.js.snap | 1 + components/cascader/index.tsx | 1 + .../__snapshots__/components.test.js.snap | 3 +++ .../__tests__/__snapshots__/demo.test.js.snap | 1 + .../form/__tests__/__snapshots__/demo.test.js.snap | 2 ++ .../__tests__/__snapshots__/demo.test.js.snap | 1 + 7 files changed, 23 insertions(+) diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap index a9c83b18e7..eeeaf8b127 100644 --- a/components/cascader/__tests__/__snapshots__/demo.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -13,6 +13,7 @@ exports[`renders ./components/cascader/demo/basic.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -50,6 +51,7 @@ exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] = class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -101,6 +103,7 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " readonly="" + tabindex="-1" type="text" value="" /> @@ -170,6 +173,7 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " readonly="" + tabindex="-1" type="text" value="" /> @@ -226,6 +230,7 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -263,6 +268,7 @@ exports[`renders ./components/cascader/demo/fields-name.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -300,6 +306,7 @@ exports[`renders ./components/cascader/demo/hover.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -337,6 +344,7 @@ exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -373,6 +381,7 @@ exports[`renders ./components/cascader/demo/search.md correctly 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " placeholder="Please select" + tabindex="-1" type="text" value="" /> @@ -411,6 +420,7 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` class="ant-input ant-cascader-input ant-input-lg" placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -447,6 +457,7 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -483,6 +494,7 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` class="ant-input ant-cascader-input ant-input-sm" placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -524,6 +536,7 @@ exports[`renders ./components/cascader/demo/suffix.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> @@ -559,6 +572,7 @@ exports[`renders ./components/cascader/demo/suffix.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Please select" readonly="" + tabindex="-1" type="text" value="" /> diff --git a/components/cascader/__tests__/__snapshots__/index.test.js.snap b/components/cascader/__tests__/__snapshots__/index.test.js.snap index 4d75308d05..b9d3bba79f 100644 --- a/components/cascader/__tests__/__snapshots__/index.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/index.test.js.snap @@ -1237,6 +1237,7 @@ exports[`Cascader support controlled mode 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " readonly="" + tabindex="-1" type="text" value="" /> diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 968f28e4a1..3df6635a9a 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -520,6 +520,7 @@ class Cascader extends React.Component { {this.getLabel()} 0 ? undefined : placeholder} diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index ab0a4045b4..aaca83932d 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -5799,6 +5799,7 @@ exports[`ConfigProvider components Cascader configProvider 1`] = ` autocomplete="off" class="config-input config-cascader-input " placeholder="Please select" + tabindex="-1" type="text" value="" /> @@ -5835,6 +5836,7 @@ exports[`ConfigProvider components Cascader normal 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " placeholder="Please select" + tabindex="-1" type="text" value="" /> @@ -5871,6 +5873,7 @@ exports[`ConfigProvider components Cascader prefixCls 1`] = ` autocomplete="off" class="ant-input prefix-Cascader-input " placeholder="Please select" + tabindex="-1" type="text" value="" /> diff --git a/components/empty/__tests__/__snapshots__/demo.test.js.snap b/components/empty/__tests__/__snapshots__/demo.test.js.snap index a5cb1a904d..74387b633f 100644 --- a/components/empty/__tests__/__snapshots__/demo.test.js.snap +++ b/components/empty/__tests__/__snapshots__/demo.test.js.snap @@ -146,6 +146,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " placeholder="Please select" + tabindex="-1" type="text" value="" /> diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index d97ee48da5..76d46ef57d 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -1711,6 +1711,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = ` data-__meta="[object Object]" id="register_residence" readonly="" + tabindex="-1" type="text" value="" /> @@ -4692,6 +4693,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = ` autocomplete="off" class="ant-input ant-cascader-input " readonly="" + tabindex="-1" type="text" value="" /> diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index ae9d79bff6..8eb1584ac1 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -898,6 +898,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = ` class="ant-input ant-cascader-input " placeholder="Select Address" readonly="" + tabindex="-1" type="text" value="" /> From 29647f073a212a5088ea7715183ba8d16d78bd97 Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Fri, 1 Mar 2019 11:17:54 +0800 Subject: [PATCH 5/9] Drawer Body padding should be variable --- components/drawer/style/drawer.less | 4 ++-- components/style/themes/default.less | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/drawer/style/drawer.less b/components/drawer/style/drawer.less index 569abeb09d..0bd8da250c 100644 --- a/components/drawer/style/drawer.less +++ b/components/drawer/style/drawer.less @@ -150,7 +150,7 @@ &-header { position: relative; - padding: 16px 24px; + padding: @drawer-header-padding; color: @text-color; background: @component-background; border-bottom: @border-width-base @border-style-base @border-color-split; @@ -163,7 +163,7 @@ } &-body { - padding: 24px; + padding: @drawer-body-padding; font-size: @font-size-base; line-height: @line-height-base; word-wrap: break-word; diff --git a/components/style/themes/default.less b/components/style/themes/default.less index d804254902..a91f4f816c 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -579,3 +579,8 @@ @statistic-content-font-size: 24px; @statistic-unit-font-size: 16px; @statistic-font-family: Tahoma, 'Helvetica Neue', @font-family; + +// Drawer +// --- +@drawer-header-padding: 16px 24px; +@drawer-body-padding: 24px; From e26c5133a5cef1626016da26115ea129c21865a8 Mon Sep 17 00:00:00 2001 From: Yann Normand Date: Fri, 1 Mar 2019 15:50:28 +1000 Subject: [PATCH 6/9] fix DatePicker to support an array of formats (#15116) ref #13148 --- components/date-picker/RangePicker.tsx | 11 ++-- .../date-picker/__tests__/DatePicker.test.js | 7 +++ .../__tests__/__snapshots__/demo.test.js.snap | 50 +++++++++++++++++++ components/date-picker/createPicker.tsx | 5 +- components/date-picker/demo/format.md | 5 ++ components/date-picker/index.en-US.md | 6 +-- components/date-picker/utils.ts | 11 ++++ 7 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 components/date-picker/utils.ts diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index af65933920..c20c13a3de 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -12,6 +12,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; import warning from '../_util/warning'; import interopDefault from '../_util/interopDefault'; import { RangePickerValue, RangePickerPresetRange } from './interface'; +import { formatDate } from './utils'; export interface RangePickerState { value?: RangePickerValue; @@ -30,10 +31,6 @@ function getShowDateFromValue(value: RangePickerValue) { return [start, newEnd] as RangePickerValue; } -function formatValue(value: moment.Moment | undefined, format: string): string { - return (value && value.format(format)) || ''; -} - function pickerValueAdapter( value?: moment.Moment | RangePickerValue, ): RangePickerValue | undefined { @@ -148,7 +145,7 @@ class RangePicker extends React.Component { })); } const [start, end] = value; - props.onChange(value, [formatValue(start, props.format), formatValue(end, props.format)]); + props.onChange(value, [formatDate(start, props.format), formatDate(end, props.format)]); }; handleOpenChange = (open: boolean) => { @@ -383,7 +380,7 @@ class RangePicker extends React.Component { { { expect(extraNode.length).toBe(1); expect(extraNode.text()).toBe('decade'); }); + + it('supports multiple formats', () => { + const wrapper = mount(); + openPanel(wrapper); + wrapper.find('.ant-calendar-input').simulate('change', { target: { value: '02/07/18' } }); + expect(wrapper.find('.ant-calendar-picker-input').getDOMNode().value).toBe('02/07/2018'); + }); }); diff --git a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap index 8f93d6e3e8..6e16005cd2 100644 --- a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap @@ -700,6 +700,56 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
+ +
+ + + + + + + +
+
+
diff --git a/components/date-picker/createPicker.tsx b/components/date-picker/createPicker.tsx index 2f99c557b6..06b0d5910d 100644 --- a/components/date-picker/createPicker.tsx +++ b/components/date-picker/createPicker.tsx @@ -11,6 +11,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; import warning from '../_util/warning'; import interopDefault from '../_util/interopDefault'; import getDataOrAriaProps from '../_util/getDataOrAriaProps'; +import { formatDate } from './utils'; export interface PickerProps { value?: moment.Moment; @@ -98,7 +99,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any { showDate: value, }); } - props.onChange(value, (value && value.format(props.format)) || ''); + props.onChange(value, formatDate(value, props.format)); }; handleCalendarChange = (value: moment.Moment) => { @@ -227,7 +228,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any { ref={this.saveInput} disabled={props.disabled} readOnly - value={(inputValue && inputValue.format(props.format)) || ''} + value={formatDate(inputValue, props.format)} placeholder={placeholder} className={props.pickerInputClass} tabIndex={props.tabIndex} diff --git a/components/date-picker/demo/format.md b/components/date-picker/demo/format.md index 9b1fc9d4bd..3233fd6c84 100644 --- a/components/date-picker/demo/format.md +++ b/components/date-picker/demo/format.md @@ -21,9 +21,14 @@ const { MonthPicker, RangePicker } = DatePicker; const dateFormat = 'YYYY/MM/DD'; const monthFormat = 'YYYY/MM'; + +const dateFormatList = ['DD/MM/YYYY','DD/MM/YY'] + ReactDOM.render(
+
+

diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index 14fc6225ea..e7a2f34cce 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -80,7 +80,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke | defaultValue | to set default date | [moment](http://momentjs.com/) | - | | defaultPickerValue | to set default picker date | [moment](http://momentjs.com/) | - | | disabledTime | to specify the time that cannot be selected | function(date) | - | -| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" | +| format | to set the date format, refer to [moment.js](http://momentjs.com/). When an array is provided, all values are used for parsing and first value is used for formatting. | string \| string[] | "YYYY-MM-DD" | | renderExtraFooter | render extra footer in panel | (mode) => React.ReactNode | - | | showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | | showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() | @@ -95,7 +95,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke | -------- | ----------- | ---- | ------- | | defaultValue | to set default date | [moment](http://momentjs.com/) | - | | defaultPickerValue | to set default picker date | [moment](http://momentjs.com/) | - | -| format | to set the date format. When an array is provided, all values are used for parsing and first value for display. refer to [moment.js](http://momentjs.com/) | string \| string[] | "YYYY-MM" | +| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM" | | monthCellContentRender | Custom month cell content render method | function(date, locale): ReactNode | - | | renderExtraFooter | render extra footer in panel | () => React.ReactNode | - | | value | to set date | [moment](http://momentjs.com/) | - | @@ -119,7 +119,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke | defaultValue | to set default date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | | defaultPickerValue | to set default picker date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)\] | - | | disabledTime | to specify the time that cannot be selected | function(dates: \[moment, moment], partial: `'start'|'end'`) | - | -| format | to set the date format | string | "YYYY-MM-DD HH:mm:ss" | +| format | to set the date format, refer to [moment.js](http://momentjs.com/). When an array is provided, all values are used for parsing and first value is used for formatting. | string \| string[] | "YYYY-MM-DD HH:mm:ss" | | ranges | preseted ranges for quick selection | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | | renderExtraFooter | render extra footer in panel | () => React.ReactNode | - | | showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | diff --git a/components/date-picker/utils.ts b/components/date-picker/utils.ts new file mode 100644 index 0000000000..94b1d28434 --- /dev/null +++ b/components/date-picker/utils.ts @@ -0,0 +1,11 @@ +import * as moment from 'moment'; + +export function formatDate(value: moment.Moment | undefined | null, format: string | string[]): string { + if (!value) { + return ''; + } + if (Array.isArray(format)) { + format = format[0]; + } + return value.format(format); +} From 959987ad23be97a95bccd4730e3f6fa460e6d2b3 Mon Sep 17 00:00:00 2001 From: xiaohuoni <448627663@qq.com> Date: Sat, 2 Mar 2019 14:28:42 +0800 Subject: [PATCH 7/9] table reader mobile friendly --- site/theme/static/markdown.less | 62 ++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/site/theme/static/markdown.less b/site/theme/static/markdown.less index 310af0e411..6328d5e657 100644 --- a/site/theme/static/markdown.less +++ b/site/theme/static/markdown.less @@ -204,35 +204,39 @@ clear: both; } -.markdown.api-container table { - margin: 2em 0; - font-size: @font-size-base; - font-family: @code-family; - line-height: @line-height-base; - border-width: 0; - th, - td { - padding: 14px 16px; - border-width: 1px 0; - border-color: @border-color-split; - } - th { - border-width: 0 0 2px 0; - } - td:first-child { - width: 20%; - color: @blue-9; - font-weight: 500; - } - td:nth-child(3) { - width: 22%; - color: @magenta-7; - font-size: @font-size-base - 1px; - word-break: break-all; - } - td:last-child { - width: 13%; - font-size: @font-size-base - 1px; +.markdown.api-container { + overflow-x: auto; + table { + min-width: 719px; + margin: 2em 0; + font-size: @font-size-base; + font-family: @code-family; + line-height: @line-height-base; + border-width: 0; + th, + td { + padding: 14px 16px; + border-width: 1px 0; + border-color: @border-color-split; + } + th { + border-width: 0 0 2px 0; + } + td:first-child { + width: 20%; + color: @blue-9; + font-weight: 500; + } + td:nth-child(3) { + width: 22%; + color: @magenta-7; + font-size: @font-size-base - 1px; + word-break: break-all; + } + td:last-child { + width: 13%; + font-size: @font-size-base - 1px; + } } } From 4e331a5049f0b817ca1e5f26180f8a2bc766618c Mon Sep 17 00:00:00 2001 From: DiamondYuan Date: Fri, 1 Mar 2019 11:21:00 +0800 Subject: [PATCH 8/9] up --- components/input/__tests__/index.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js index 397be174c8..45c349e912 100644 --- a/components/input/__tests__/index.test.js +++ b/components/input/__tests__/index.test.js @@ -44,6 +44,27 @@ describe('TextArea', () => { expect(mockFunc).toHaveBeenCalledTimes(2); }); + it('should use settimeout when ', () => { + const backup = window.requestAnimationFrame; + const setTimeoutBackUp = window.setTimeout; + // window.requestAnimationFrame = null; + window.setTimeout = jest.fn((cb, time) => { + setTimeoutBackUp(cb, time); + }); + const wrapper = mount(