From 0e92fa3f237e4df337e518972e9c00b04c5dedef Mon Sep 17 00:00:00 2001 From: "HJin.me" Date: Tue, 20 Dec 2016 14:37:33 +0800 Subject: [PATCH 1/4] chore: improve Cascader and Tooltip's get(Popup|Tooltip)Container declaration (#4303) --- components/cascader/index.tsx | 1 + components/tooltip/index.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index fcc0a83205..17d057ce96 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -59,6 +59,7 @@ export interface CascaderProps { onPopupVisibleChange?: (popupVisible: boolean) => void; prefixCls?: string; inputPrefixCls?: string; + getPopupContainer?: (triggerNode: Element) => HTMLElement; } function highlightKeyword(str: string, keyword: string, prefixCls: string) { diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 944b1b7bb0..dfe22a186b 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -22,7 +22,7 @@ export interface AbstractTooltipProps { trigger?: 'hover' | 'focus' | 'click'; openClassName?: string; arrowPointAtCenter?: boolean; - getTooltipContainer?: (triggerNode: React.ReactNode) => HTMLElement; + getTooltipContainer?: (triggerNode: Element) => HTMLElement; children?: React.ReactElement; } From 83820234092fed80e73fcdbcafdd6fc75a1c5c21 Mon Sep 17 00:00:00 2001 From: Edd Hannay Date: Tue, 20 Dec 2016 12:28:44 +0000 Subject: [PATCH 2/4] docs: fix typo in Form demo (#4313) - Rename checkPassowrd function checkPassword --- components/form/demo/register.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/form/demo/register.md b/components/form/demo/register.md index 34b19f2241..117e8791e0 100644 --- a/components/form/demo/register.md +++ b/components/form/demo/register.md @@ -60,7 +60,7 @@ const RegistrationForm = Form.create()(React.createClass({ const value = e.target.value; this.setState({ passwordDirty: this.state.passwordDirty || !!value }); }, - checkPassowrd(rule, value, callback) { + checkPassword(rule, value, callback) { const form = this.props.form; if (value && value !== form.getFieldValue('password')) { callback('Two passwords that you enter is inconsistent!'); @@ -135,7 +135,7 @@ const RegistrationForm = Form.create()(React.createClass({ rules: [{ required: true, message: 'Please confirm your password!', }, { - validator: this.checkPassowrd, + validator: this.checkPassword, }], })( From ba9d95bba963693b6819dc242bc28824cb437786 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Tue, 20 Dec 2016 23:59:29 +0800 Subject: [PATCH 3/4] Simplify module export test --- tests/index.test.js | 52 ++------------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/tests/index.test.js b/tests/index.test.js index c7091d1fa5..5c293fe636 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -13,56 +13,8 @@ describe('antd dist files', () => { // https://github.com/ant-design/ant-design/issues/1638 // https://github.com/ant-design/ant-design/issues/1968 - it('should has modules in antd', () => { - expect('Affix' in antd).toBeTruthy(); - expect('Alert' in antd).toBeTruthy(); - expect('Anchor' in antd).toBeTruthy(); - expect('AutoComplete' in antd).toBeTruthy(); - expect('BackTop' in antd).toBeTruthy(); - expect('Badge' in antd).toBeTruthy(); - expect('Breadcrumb' in antd).toBeTruthy(); - expect('Button' in antd).toBeTruthy(); - expect('Calendar' in antd).toBeTruthy(); - expect('Card' in antd).toBeTruthy(); - expect('Carousel' in antd).toBeTruthy(); - expect('Cascader' in antd).toBeTruthy(); - expect('Checkbox' in antd).toBeTruthy(); - expect('Col' in antd).toBeTruthy(); - expect('Collapse' in antd).toBeTruthy(); - expect('DatePicker' in antd).toBeTruthy(); - expect('Dropdown' in antd).toBeTruthy(); - expect('Form' in antd).toBeTruthy(); - expect('Icon' in antd).toBeTruthy(); - expect('Input' in antd).toBeTruthy(); - expect('InputNumber' in antd).toBeTruthy(); - expect('LocaleProvider' in antd).toBeTruthy(); - expect('Menu' in antd).toBeTruthy(); - expect('message' in antd).toBeTruthy(); - expect('Modal' in antd).toBeTruthy(); - expect('Mention' in antd).toBeTruthy(); - expect('notification' in antd).toBeTruthy(); - expect('Pagination' in antd).toBeTruthy(); - expect('Popconfirm' in antd).toBeTruthy(); - expect('Popover' in antd).toBeTruthy(); - expect('Progress' in antd).toBeTruthy(); - expect('Radio' in antd).toBeTruthy(); - expect('Rate' in antd).toBeTruthy(); - expect('Row' in antd).toBeTruthy(); - expect('Select' in antd).toBeTruthy(); - expect('Slider' in antd).toBeTruthy(); - expect('Spin' in antd).toBeTruthy(); - expect('Steps' in antd).toBeTruthy(); - expect('Switch' in antd).toBeTruthy(); - expect('Table' in antd).toBeTruthy(); - expect('Tabs' in antd).toBeTruthy(); - expect('Tag' in antd).toBeTruthy(); - expect('TimePicker' in antd).toBeTruthy(); - expect('Timeline' in antd).toBeTruthy(); - expect('Tooltip' in antd).toBeTruthy(); - expect('Transfer' in antd).toBeTruthy(); - expect('Tree' in antd).toBeTruthy(); - expect('TreeSelect' in antd).toBeTruthy(); - expect('Upload' in antd).toBeTruthy(); + it('exports modules correctly', () => { + expect(Object.keys(antd)).toMatchSnapshot(); }); // https://github.com/ant-design/ant-design/issues/1970 From 3dc2ed6a64f4708d2acbbd435506c24ac15ad268 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Wed, 21 Dec 2016 00:53:35 +0800 Subject: [PATCH 4/4] Add forgotten snap back. --- tests/__snapshots__/index.test.js.snap | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/__snapshots__/index.test.js.snap diff --git a/tests/__snapshots__/index.test.js.snap b/tests/__snapshots__/index.test.js.snap new file mode 100644 index 0000000000..83e27db199 --- /dev/null +++ b/tests/__snapshots__/index.test.js.snap @@ -0,0 +1,53 @@ +exports[`antd dist files exports modules correctly 1`] = ` +Array [ + "Affix", + "Anchor", + "AutoComplete", + "Alert", + "BackTop", + "Badge", + "Breadcrumb", + "Button", + "Calendar", + "Card", + "Collapse", + "Carousel", + "Cascader", + "Checkbox", + "Col", + "DatePicker", + "Dropdown", + "Form", + "Icon", + "Input", + "InputNumber", + "LocaleProvider", + "message", + "Menu", + "Modal", + "notification", + "Pagination", + "Popconfirm", + "Popover", + "Progress", + "Radio", + "Rate", + "Row", + "Select", + "Slider", + "Spin", + "Steps", + "Switch", + "Table", + "Transfer", + "Tree", + "TreeSelect", + "Tabs", + "Tag", + "TimePicker", + "Timeline", + "Tooltip", + "Mention", + "Upload", +] +`;