From 17a0a332839fb1f517a6296fd30105ea5a3cab0e Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Wed, 14 Dec 2016 14:41:39 +0800 Subject: [PATCH] Restructure tests. --- .jest.node.json | 4 +- .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__test__}/__snapshots__/demo.test.js.snap | 0 .../__snapshots__/index.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__tests__/__snapshots__/demo.test.js.snap | 199 ++++++++++++++++++ .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/Table.filter.test.js.snap | 0 .../Table.pagination.test.js.snap | 0 .../__snapshots__/Table.sorter.test.js.snap | 0 .../__snapshots__/Table.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/index.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/search.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 .../__snapshots__/demo.test.js.snap | 0 package.json | 4 +- tests/affix/demo.test.js | 3 - tests/alert/demo.test.js | 3 - tests/anchor/Anchor.test.js | 20 -- tests/anchor/demo.test.js | 3 - tests/auto-complete/demo.test.js | 3 - tests/back-top/demo.test.js | 3 - tests/badge/demo.test.js | 3 - tests/breadcrumb/demo.test.js | 12 -- tests/button/demo.test.js | 3 - tests/button/index.test.js | 20 -- tests/calendar/demo.test.js | 3 - tests/card/demo.test.js | 3 - tests/carousel/demo.test.js | 3 - tests/checkbox/demo.test.js | 3 - tests/checkbox/index.test.js | 23 -- tests/collapse/demo.test.js | 3 - tests/date-picker/demo.test.js | 14 -- tests/dropdown/demo.test.js | 3 - tests/dropdown/dropdown-button.test.js | 36 ---- tests/form/demo.test.js | 3 - tests/grid/demo.test.js | 3 - tests/icon/index.test.js | 25 --- tests/input-number/demo.test.js | 3 - tests/input/demo.test.js | 3 - tests/layout/index.test.js | 21 -- tests/locale-provider/demo.test.js | 3 - tests/mention/demo.test.js | 3 - tests/menu/demo.test.js | 3 - tests/message/demo.test.js | 3 - tests/modal/demo.test.js | 3 - tests/notification/demo.test.js | 3 - tests/pagination/demo.test.js | 3 - tests/popconfirm/demo.test.js | 3 - tests/popover/demo.test.js | 3 - tests/popover/index.test.js | 25 --- tests/progress/demo.test.js | 3 - tests/radio/demo.test.js | 3 - tests/radio/group.test.js | 26 --- tests/radio/radio.test.js | 23 -- tests/rate/demo.test.js | 3 - tests/select/demo.test.js | 3 - tests/slider/demo.test.js | 3 - tests/spin/demo.test.js | 3 - tests/steps/demo.test.js | 3 - tests/switch/demo.test.js | 3 - tests/table/SelectionBox.test.js | 87 -------- tests/table/Table.filter.test.js | 141 ------------- tests/table/Table.pagination.test.js | 78 ------- tests/table/Table.rowSelection.test.js | 166 --------------- tests/table/Table.sorter.test.js | 71 ------- tests/table/Table.test.js | 63 ------ tests/table/demo.test.js | 3 - tests/tabs/demo.test.js | 3 - tests/tag/demo.test.js | 3 - tests/time-picker/demo.test.js | 3 - tests/time-picker/index.test.js | 16 -- tests/timeline/demo.test.js | 3 - tests/tooltip/demo.test.js | 3 - tests/transfer/demo.test.js | 3 - tests/transfer/search.test.js | 16 -- tests/tree-select/demo.test.js | 3 - tests/tree/demo.test.js | 3 - tests/upload/demo.test.js | 3 - 118 files changed, 203 insertions(+), 1019 deletions(-) rename {tests/affix => components/affix/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/alert => components/alert/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/anchor => components/anchor/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/auto-complete => components/auto-complete/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/back-top => components/back-top/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/badge => components/badge/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/breadcrumb => components/breadcrumb/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/button => components/button/__test__}/__snapshots__/demo.test.js.snap (100%) rename {tests/button => components/button/__test__}/__snapshots__/index.test.js.snap (100%) rename {tests/calendar => components/calendar/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/card => components/card/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/carousel => components/carousel/__tests__}/__snapshots__/demo.test.js.snap (100%) create mode 100644 components/cascader/__tests__/__snapshots__/demo.test.js.snap rename {tests/checkbox => components/checkbox/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/collapse => components/collapse/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/date-picker => components/date-picker/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/dropdown => components/dropdown/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/form => components/form/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/grid => components/grid/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/input-number => components/input-number/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/input => components/input/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/locale-provider => components/locale-provider/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/menu => components/menu/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/message => components/message/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/modal => components/modal/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/notification => components/notification/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/pagination => components/pagination/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/popconfirm => components/popconfirm/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/popover => components/popover/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/progress => components/progress/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/radio => components/radio/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/rate => components/rate/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/select => components/select/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/slider => components/slider/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/spin => components/spin/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/steps => components/steps/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/switch => components/switch/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/table => components/table/__tests__}/__snapshots__/Table.filter.test.js.snap (100%) rename {tests/table => components/table/__tests__}/__snapshots__/Table.pagination.test.js.snap (100%) rename {tests/table => components/table/__tests__}/__snapshots__/Table.sorter.test.js.snap (100%) rename {tests/table => components/table/__tests__}/__snapshots__/Table.test.js.snap (100%) rename {tests/table => components/table/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/tabs => components/tabs/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/tag => components/tag/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/time-picker => components/time-picker/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/time-picker => components/time-picker/__tests__}/__snapshots__/index.test.js.snap (100%) rename {tests/timeline => components/timeline/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/tooltip => components/tooltip/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/transfer => components/transfer/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/transfer => components/transfer/__tests__}/__snapshots__/search.test.js.snap (100%) rename {tests/tree-select => components/tree-select/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/tree => components/tree/__tests__}/__snapshots__/demo.test.js.snap (100%) rename {tests/upload => components/upload/__tests__}/__snapshots__/demo.test.js.snap (100%) delete mode 100644 tests/affix/demo.test.js delete mode 100644 tests/alert/demo.test.js delete mode 100644 tests/anchor/Anchor.test.js delete mode 100644 tests/anchor/demo.test.js delete mode 100644 tests/auto-complete/demo.test.js delete mode 100644 tests/back-top/demo.test.js delete mode 100644 tests/badge/demo.test.js delete mode 100644 tests/breadcrumb/demo.test.js delete mode 100644 tests/button/demo.test.js delete mode 100644 tests/button/index.test.js delete mode 100644 tests/calendar/demo.test.js delete mode 100644 tests/card/demo.test.js delete mode 100644 tests/carousel/demo.test.js delete mode 100644 tests/checkbox/demo.test.js delete mode 100644 tests/checkbox/index.test.js delete mode 100644 tests/collapse/demo.test.js delete mode 100644 tests/date-picker/demo.test.js delete mode 100644 tests/dropdown/demo.test.js delete mode 100644 tests/dropdown/dropdown-button.test.js delete mode 100644 tests/form/demo.test.js delete mode 100644 tests/grid/demo.test.js delete mode 100644 tests/icon/index.test.js delete mode 100644 tests/input-number/demo.test.js delete mode 100644 tests/input/demo.test.js delete mode 100644 tests/layout/index.test.js delete mode 100644 tests/locale-provider/demo.test.js delete mode 100644 tests/mention/demo.test.js delete mode 100644 tests/menu/demo.test.js delete mode 100644 tests/message/demo.test.js delete mode 100644 tests/modal/demo.test.js delete mode 100644 tests/notification/demo.test.js delete mode 100644 tests/pagination/demo.test.js delete mode 100644 tests/popconfirm/demo.test.js delete mode 100644 tests/popover/demo.test.js delete mode 100644 tests/popover/index.test.js delete mode 100644 tests/progress/demo.test.js delete mode 100644 tests/radio/demo.test.js delete mode 100644 tests/radio/group.test.js delete mode 100644 tests/radio/radio.test.js delete mode 100644 tests/rate/demo.test.js delete mode 100644 tests/select/demo.test.js delete mode 100644 tests/slider/demo.test.js delete mode 100644 tests/spin/demo.test.js delete mode 100644 tests/steps/demo.test.js delete mode 100644 tests/switch/demo.test.js delete mode 100644 tests/table/SelectionBox.test.js delete mode 100644 tests/table/Table.filter.test.js delete mode 100644 tests/table/Table.pagination.test.js delete mode 100644 tests/table/Table.rowSelection.test.js delete mode 100644 tests/table/Table.sorter.test.js delete mode 100644 tests/table/Table.test.js delete mode 100644 tests/table/demo.test.js delete mode 100644 tests/tabs/demo.test.js delete mode 100644 tests/tag/demo.test.js delete mode 100644 tests/time-picker/demo.test.js delete mode 100644 tests/time-picker/index.test.js delete mode 100644 tests/timeline/demo.test.js delete mode 100644 tests/tooltip/demo.test.js delete mode 100644 tests/transfer/demo.test.js delete mode 100644 tests/transfer/search.test.js delete mode 100644 tests/tree-select/demo.test.js delete mode 100644 tests/tree/demo.test.js delete mode 100644 tests/upload/demo.test.js diff --git a/.jest.node.json b/.jest.node.json index 0bc458a80b..c9dcfdef0c 100644 --- a/.jest.node.json +++ b/.jest.node.json @@ -10,9 +10,9 @@ ], "transform": { "\\.tsx?$": "node_modules/typescript-babel-jest", - "tests/.*\\.js$": "node_modules/babel-jest", + "\\.js$": "node_modules/babel-jest", "\\.md$": "node_modules/antd-demo-jest" }, - "testRegex": "/tests/.*demo\\.test\\.js$", + "testRegex": "demo\\.test\\.js$", "testEnvironment": "node" } diff --git a/tests/affix/__snapshots__/demo.test.js.snap b/components/affix/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/affix/__snapshots__/demo.test.js.snap rename to components/affix/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/alert/__snapshots__/demo.test.js.snap b/components/alert/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/alert/__snapshots__/demo.test.js.snap rename to components/alert/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/anchor/__snapshots__/demo.test.js.snap b/components/anchor/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/anchor/__snapshots__/demo.test.js.snap rename to components/anchor/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/auto-complete/__snapshots__/demo.test.js.snap b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/auto-complete/__snapshots__/demo.test.js.snap rename to components/auto-complete/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/back-top/__snapshots__/demo.test.js.snap b/components/back-top/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/back-top/__snapshots__/demo.test.js.snap rename to components/back-top/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/badge/__snapshots__/demo.test.js.snap b/components/badge/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/badge/__snapshots__/demo.test.js.snap rename to components/badge/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/breadcrumb/__snapshots__/demo.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/breadcrumb/__snapshots__/demo.test.js.snap rename to components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/button/__snapshots__/demo.test.js.snap b/components/button/__test__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/button/__snapshots__/demo.test.js.snap rename to components/button/__test__/__snapshots__/demo.test.js.snap diff --git a/tests/button/__snapshots__/index.test.js.snap b/components/button/__test__/__snapshots__/index.test.js.snap similarity index 100% rename from tests/button/__snapshots__/index.test.js.snap rename to components/button/__test__/__snapshots__/index.test.js.snap diff --git a/tests/calendar/__snapshots__/demo.test.js.snap b/components/calendar/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/calendar/__snapshots__/demo.test.js.snap rename to components/calendar/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/card/__snapshots__/demo.test.js.snap b/components/card/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/card/__snapshots__/demo.test.js.snap rename to components/card/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/carousel/__snapshots__/demo.test.js.snap b/components/carousel/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/carousel/__snapshots__/demo.test.js.snap rename to components/carousel/__tests__/__snapshots__/demo.test.js.snap diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap new file mode 100644 index 0000000000..406f755137 --- /dev/null +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -0,0 +1,199 @@ +exports[`test renders ./components/cascader/demo/basic.md correctly 1`] = ` + + + + + +`; + +exports[`test renders ./components/cascader/demo/change-on-select.md correctly 1`] = ` + + + + + +`; + +exports[`test renders ./components/cascader/demo/custom-render.md correctly 1`] = ` + + + + + Zhejiang / + + + Hangzhou / + + + West Lake ( + + 752100 + + ) + + + + + +`; + +exports[`test renders ./components/cascader/demo/custom-trigger.md correctly 1`] = ` + + Unselect  + + Change city + + +`; + +exports[`test renders ./components/cascader/demo/default-value.md correctly 1`] = ` + + + + Zhejiang / Hangzhou / West Lake + + + + +`; + +exports[`test renders ./components/cascader/demo/disabled-option.md correctly 1`] = ` + + + + + +`; + +exports[`test renders ./components/cascader/demo/hover.md correctly 1`] = ` + + + + + +`; + +exports[`test renders ./components/cascader/demo/search.md correctly 1`] = ` + + + + + +`; + +exports[`test renders ./components/cascader/demo/size.md correctly 1`] = ` +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+`; diff --git a/tests/checkbox/__snapshots__/demo.test.js.snap b/components/checkbox/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/checkbox/__snapshots__/demo.test.js.snap rename to components/checkbox/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/collapse/__snapshots__/demo.test.js.snap b/components/collapse/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/collapse/__snapshots__/demo.test.js.snap rename to components/collapse/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/date-picker/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/date-picker/__snapshots__/demo.test.js.snap rename to components/date-picker/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/dropdown/__snapshots__/demo.test.js.snap b/components/dropdown/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/dropdown/__snapshots__/demo.test.js.snap rename to components/dropdown/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/form/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/form/__snapshots__/demo.test.js.snap rename to components/form/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/grid/__snapshots__/demo.test.js.snap b/components/grid/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/grid/__snapshots__/demo.test.js.snap rename to components/grid/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/input-number/__snapshots__/demo.test.js.snap b/components/input-number/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/input-number/__snapshots__/demo.test.js.snap rename to components/input-number/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/input/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/input/__snapshots__/demo.test.js.snap rename to components/input/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/locale-provider/__snapshots__/demo.test.js.snap b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/locale-provider/__snapshots__/demo.test.js.snap rename to components/locale-provider/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/menu/__snapshots__/demo.test.js.snap b/components/menu/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/menu/__snapshots__/demo.test.js.snap rename to components/menu/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/message/__snapshots__/demo.test.js.snap b/components/message/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/message/__snapshots__/demo.test.js.snap rename to components/message/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/modal/__snapshots__/demo.test.js.snap b/components/modal/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/modal/__snapshots__/demo.test.js.snap rename to components/modal/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/notification/__snapshots__/demo.test.js.snap b/components/notification/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/notification/__snapshots__/demo.test.js.snap rename to components/notification/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/pagination/__snapshots__/demo.test.js.snap b/components/pagination/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/pagination/__snapshots__/demo.test.js.snap rename to components/pagination/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/popconfirm/__snapshots__/demo.test.js.snap b/components/popconfirm/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/popconfirm/__snapshots__/demo.test.js.snap rename to components/popconfirm/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/popover/__snapshots__/demo.test.js.snap b/components/popover/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/popover/__snapshots__/demo.test.js.snap rename to components/popover/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/progress/__snapshots__/demo.test.js.snap b/components/progress/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/progress/__snapshots__/demo.test.js.snap rename to components/progress/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/radio/__snapshots__/demo.test.js.snap b/components/radio/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/radio/__snapshots__/demo.test.js.snap rename to components/radio/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/rate/__snapshots__/demo.test.js.snap b/components/rate/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/rate/__snapshots__/demo.test.js.snap rename to components/rate/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/select/__snapshots__/demo.test.js.snap b/components/select/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/select/__snapshots__/demo.test.js.snap rename to components/select/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/slider/__snapshots__/demo.test.js.snap b/components/slider/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/slider/__snapshots__/demo.test.js.snap rename to components/slider/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/spin/__snapshots__/demo.test.js.snap b/components/spin/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/spin/__snapshots__/demo.test.js.snap rename to components/spin/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/steps/__snapshots__/demo.test.js.snap b/components/steps/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/steps/__snapshots__/demo.test.js.snap rename to components/steps/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/switch/__snapshots__/demo.test.js.snap b/components/switch/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/switch/__snapshots__/demo.test.js.snap rename to components/switch/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/table/__snapshots__/Table.filter.test.js.snap b/components/table/__tests__/__snapshots__/Table.filter.test.js.snap similarity index 100% rename from tests/table/__snapshots__/Table.filter.test.js.snap rename to components/table/__tests__/__snapshots__/Table.filter.test.js.snap diff --git a/tests/table/__snapshots__/Table.pagination.test.js.snap b/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap similarity index 100% rename from tests/table/__snapshots__/Table.pagination.test.js.snap rename to components/table/__tests__/__snapshots__/Table.pagination.test.js.snap diff --git a/tests/table/__snapshots__/Table.sorter.test.js.snap b/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap similarity index 100% rename from tests/table/__snapshots__/Table.sorter.test.js.snap rename to components/table/__tests__/__snapshots__/Table.sorter.test.js.snap diff --git a/tests/table/__snapshots__/Table.test.js.snap b/components/table/__tests__/__snapshots__/Table.test.js.snap similarity index 100% rename from tests/table/__snapshots__/Table.test.js.snap rename to components/table/__tests__/__snapshots__/Table.test.js.snap diff --git a/tests/table/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/table/__snapshots__/demo.test.js.snap rename to components/table/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/tabs/__snapshots__/demo.test.js.snap b/components/tabs/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/tabs/__snapshots__/demo.test.js.snap rename to components/tabs/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/tag/__snapshots__/demo.test.js.snap b/components/tag/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/tag/__snapshots__/demo.test.js.snap rename to components/tag/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/time-picker/__snapshots__/demo.test.js.snap b/components/time-picker/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/time-picker/__snapshots__/demo.test.js.snap rename to components/time-picker/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/time-picker/__snapshots__/index.test.js.snap b/components/time-picker/__tests__/__snapshots__/index.test.js.snap similarity index 100% rename from tests/time-picker/__snapshots__/index.test.js.snap rename to components/time-picker/__tests__/__snapshots__/index.test.js.snap diff --git a/tests/timeline/__snapshots__/demo.test.js.snap b/components/timeline/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/timeline/__snapshots__/demo.test.js.snap rename to components/timeline/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/tooltip/__snapshots__/demo.test.js.snap b/components/tooltip/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/tooltip/__snapshots__/demo.test.js.snap rename to components/tooltip/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/transfer/__snapshots__/demo.test.js.snap b/components/transfer/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/transfer/__snapshots__/demo.test.js.snap rename to components/transfer/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/transfer/__snapshots__/search.test.js.snap b/components/transfer/__tests__/__snapshots__/search.test.js.snap similarity index 100% rename from tests/transfer/__snapshots__/search.test.js.snap rename to components/transfer/__tests__/__snapshots__/search.test.js.snap diff --git a/tests/tree-select/__snapshots__/demo.test.js.snap b/components/tree-select/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/tree-select/__snapshots__/demo.test.js.snap rename to components/tree-select/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/tree/__snapshots__/demo.test.js.snap b/components/tree/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/tree/__snapshots__/demo.test.js.snap rename to components/tree/__tests__/__snapshots__/demo.test.js.snap diff --git a/tests/upload/__snapshots__/demo.test.js.snap b/components/upload/__tests__/__snapshots__/demo.test.js.snap similarity index 100% rename from tests/upload/__snapshots__/demo.test.js.snap rename to components/upload/__tests__/__snapshots__/demo.test.js.snap diff --git a/package.json b/package.json index 00f663117b..5d5bbd2b37 100644 --- a/package.json +++ b/package.json @@ -186,10 +186,10 @@ ], "transform": { "\\.tsx?$": "node_modules/typescript-babel-jest", - "tests/.*\\.js$": "node_modules/babel-jest", + "\\.js$": "node_modules/babel-jest", "\\.md$": "node_modules/antd-demo-jest" }, - "testRegex": "/tests/.*\\.test\\.js$", + "testRegex": ".*\\.test\\.js$", "collectCoverageFrom": [ "components/**/*.{ts,tsx}", "!components/*/style/index.tsx" diff --git a/tests/affix/demo.test.js b/tests/affix/demo.test.js deleted file mode 100644 index 581b91466f..0000000000 --- a/tests/affix/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('affix'); diff --git a/tests/alert/demo.test.js b/tests/alert/demo.test.js deleted file mode 100644 index 60ec055e1e..0000000000 --- a/tests/alert/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('alert'); diff --git a/tests/anchor/Anchor.test.js b/tests/anchor/Anchor.test.js deleted file mode 100644 index 7242c275be..0000000000 --- a/tests/anchor/Anchor.test.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import Anchor from '../../components/anchor'; - -const { Link } = Anchor; - -describe('Anchor Render', () => { - it('Anchor render perfectly', () => { - const wrapper = mount( - - - - ); - - wrapper.find('a[href="#API"]').simulate('click'); - - wrapper.node.handleScroll(); - expect(wrapper.node.state).not.toBe(null); - }); -}); diff --git a/tests/anchor/demo.test.js b/tests/anchor/demo.test.js deleted file mode 100644 index eacddd3d06..0000000000 --- a/tests/anchor/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('anchor'); diff --git a/tests/auto-complete/demo.test.js b/tests/auto-complete/demo.test.js deleted file mode 100644 index 14c4743fd8..0000000000 --- a/tests/auto-complete/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('auto-complete'); diff --git a/tests/back-top/demo.test.js b/tests/back-top/demo.test.js deleted file mode 100644 index 4415e98eeb..0000000000 --- a/tests/back-top/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('back-top'); diff --git a/tests/badge/demo.test.js b/tests/badge/demo.test.js deleted file mode 100644 index 6c55fba0b5..0000000000 --- a/tests/badge/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('badge'); diff --git a/tests/breadcrumb/demo.test.js b/tests/breadcrumb/demo.test.js deleted file mode 100644 index d9962c88cf..0000000000 --- a/tests/breadcrumb/demo.test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { render } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import demoTest from '../shared/demoTest'; -import routerDemo from '../../components/breadcrumb/demo/router.md'; - -demoTest('breadcrumb', { skip: ['router.md'] }); - -const testMethod = typeof window !== 'undefined' ? test : test.skip; -testMethod('renders ./components/breadcrumb/demo/router.md correctly', () => { - const wrapper = render(routerDemo); - expect(renderToJson(wrapper)).toMatchSnapshot(); -}); diff --git a/tests/button/demo.test.js b/tests/button/demo.test.js deleted file mode 100644 index d68c668d7b..0000000000 --- a/tests/button/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('button'); diff --git a/tests/button/index.test.js b/tests/button/index.test.js deleted file mode 100644 index c966d86fa1..0000000000 --- a/tests/button/index.test.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { render } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import Button from '../../components/button'; - -describe('Button', () => { - it('renders correctly', () => { - const wrapper = render( - - ); - expect(renderToJson(wrapper)).toMatchSnapshot(); - }); - - it('renders Chinese characters correctly', () => { - const wrapper = render( - - ); - expect(renderToJson(wrapper)).toMatchSnapshot(); - }); -}); diff --git a/tests/calendar/demo.test.js b/tests/calendar/demo.test.js deleted file mode 100644 index e78ba2a2c2..0000000000 --- a/tests/calendar/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('calendar'); diff --git a/tests/card/demo.test.js b/tests/card/demo.test.js deleted file mode 100644 index 1dcff50924..0000000000 --- a/tests/card/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('card'); diff --git a/tests/carousel/demo.test.js b/tests/carousel/demo.test.js deleted file mode 100644 index 61e9356b4e..0000000000 --- a/tests/carousel/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('carousel'); diff --git a/tests/checkbox/demo.test.js b/tests/checkbox/demo.test.js deleted file mode 100644 index e08e5f8c65..0000000000 --- a/tests/checkbox/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('checkbox'); diff --git a/tests/checkbox/index.test.js b/tests/checkbox/index.test.js deleted file mode 100644 index 665cafb35d..0000000000 --- a/tests/checkbox/index.test.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import Checkbox from '../../components/checkbox'; - -describe('Checkbox', () => { - it('responses hover events', () => { - const onMouseEnter = jest.fn(); - const onMouseLeave = jest.fn(); - - const wrapper = shallow( - - ); - - wrapper.simulate('mouseenter'); - expect(onMouseEnter).toHaveBeenCalled(); - - wrapper.simulate('mouseleave'); - expect(onMouseLeave).toHaveBeenCalled(); - }); -}); diff --git a/tests/collapse/demo.test.js b/tests/collapse/demo.test.js deleted file mode 100644 index 36b509eaa2..0000000000 --- a/tests/collapse/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('collapse'); diff --git a/tests/date-picker/demo.test.js b/tests/date-picker/demo.test.js deleted file mode 100644 index eaf9799d06..0000000000 --- a/tests/date-picker/demo.test.js +++ /dev/null @@ -1,14 +0,0 @@ -import { render } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import MockDate from 'mockdate'; -import demoTest from '../shared/demoTest'; - -demoTest('date-picker', { skip: ['locale.md'] }); - -test('renders ./components/date-picker/demo/locale.md correctly', () => { - MockDate.set(new Date('2016-11-22').getTime()); - const LocaleDemo = require('../../components/date-picker/demo/locale'); // eslint-disable-line global-require - const wrapper = render(LocaleDemo); - expect(renderToJson(wrapper)).toMatchSnapshot(); - MockDate.reset(); -}); diff --git a/tests/dropdown/demo.test.js b/tests/dropdown/demo.test.js deleted file mode 100644 index 20ccb8c698..0000000000 --- a/tests/dropdown/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('dropdown'); diff --git a/tests/dropdown/dropdown-button.test.js b/tests/dropdown/dropdown-button.test.js deleted file mode 100644 index 8549e1c40a..0000000000 --- a/tests/dropdown/dropdown-button.test.js +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import Dropdown from '../../components/dropdown'; -import Menu from '../../components/menu'; - -describe('DropdownButton', () => { - it('pass appropriate props to Dropdown', () => { - const props = { - align: { - offset: [10, 20], - }, - overlay: ( - - foo - - ), - trigger: ['hover'], - visible: true, - onVisibleChange: () => {}, - }; - - const wrapper = shallow(); - const dropdownProps = wrapper.find(Dropdown).props(); - - Object.keys(props).forEach((key) => { - expect(dropdownProps[key]).toBe(props[key]); - }); - }); - - it('don\'t pass visible to Dropdown if it\'s not exits', () => { - const wrapper = shallow(); - const dropdownProps = wrapper.find(Dropdown).props(); - - expect('visible' in dropdownProps).toBe(false); - }); -}); diff --git a/tests/form/demo.test.js b/tests/form/demo.test.js deleted file mode 100644 index 5602c6ec53..0000000000 --- a/tests/form/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('form'); diff --git a/tests/grid/demo.test.js b/tests/grid/demo.test.js deleted file mode 100644 index 1ec1b50a00..0000000000 --- a/tests/grid/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('grid'); diff --git a/tests/icon/index.test.js b/tests/icon/index.test.js deleted file mode 100644 index 47f0a7a25d..0000000000 --- a/tests/icon/index.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import TestUtils from 'react-addons-test-utils'; -import { wrap } from 'react-stateless-wrapper'; -import AntIcon from '../../components/icon/index'; - -const Icon = wrap(AntIcon); - -describe('Icon', () => { - let icon; - let iconNode; - - beforeEach(() => { - icon = TestUtils.renderIntoDocument( - - ); - iconNode = TestUtils.findRenderedDOMComponentWithTag(icon, 'I'); - }); - - it('should render to a ', () => { - expect(iconNode.tagName).toBe('I'); - expect(iconNode.className).toContain('my-icon-classname'); - expect(iconNode.className).toContain('anticon'); - expect(iconNode.className).toContain('anticon-appstore'); - }); -}); diff --git a/tests/input-number/demo.test.js b/tests/input-number/demo.test.js deleted file mode 100644 index 5988e3c819..0000000000 --- a/tests/input-number/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('input-number'); diff --git a/tests/input/demo.test.js b/tests/input/demo.test.js deleted file mode 100644 index 889e45b68c..0000000000 --- a/tests/input/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('input'); diff --git a/tests/layout/index.test.js b/tests/layout/index.test.js deleted file mode 100644 index d87fdf1c8f..0000000000 --- a/tests/layout/index.test.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import TestUtils from 'react-addons-test-utils'; - -const { Col, Row } = require('../../components/grid/index'); - -describe('Grid', () => { - it('should render Col', () => { - const col = TestUtils.renderIntoDocument( - - ); - const colNode = TestUtils.findRenderedDOMComponentWithTag(col, 'DIV'); - expect(colNode.className).toBe('ant-col-2'); - }); - it('should render Row', () => { - const row = TestUtils.renderIntoDocument( - - ); - const rowNode = TestUtils.findRenderedDOMComponentWithTag(row, 'DIV'); - expect(rowNode.className).toBe('ant-row'); - }); -}); diff --git a/tests/locale-provider/demo.test.js b/tests/locale-provider/demo.test.js deleted file mode 100644 index ad1c96858f..0000000000 --- a/tests/locale-provider/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('locale-provider'); diff --git a/tests/mention/demo.test.js b/tests/mention/demo.test.js deleted file mode 100644 index 5d6c37652b..0000000000 --- a/tests/mention/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('mention', { skip: true }); diff --git a/tests/menu/demo.test.js b/tests/menu/demo.test.js deleted file mode 100644 index b4b801ddd3..0000000000 --- a/tests/menu/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('menu'); diff --git a/tests/message/demo.test.js b/tests/message/demo.test.js deleted file mode 100644 index f306fc93d5..0000000000 --- a/tests/message/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('message'); diff --git a/tests/modal/demo.test.js b/tests/modal/demo.test.js deleted file mode 100644 index aaa1f5469e..0000000000 --- a/tests/modal/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('modal'); diff --git a/tests/notification/demo.test.js b/tests/notification/demo.test.js deleted file mode 100644 index e43068d343..0000000000 --- a/tests/notification/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('notification'); diff --git a/tests/pagination/demo.test.js b/tests/pagination/demo.test.js deleted file mode 100644 index c84a2ae6fd..0000000000 --- a/tests/pagination/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('pagination'); diff --git a/tests/popconfirm/demo.test.js b/tests/popconfirm/demo.test.js deleted file mode 100644 index c9a8aea0f5..0000000000 --- a/tests/popconfirm/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('popconfirm'); diff --git a/tests/popover/demo.test.js b/tests/popover/demo.test.js deleted file mode 100644 index 91724fd313..0000000000 --- a/tests/popover/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('popover'); diff --git a/tests/popover/index.test.js b/tests/popover/index.test.js deleted file mode 100644 index bac7557e1f..0000000000 --- a/tests/popover/index.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import TestUtils from 'react-addons-test-utils'; -import Popover from '../../components/popover/index'; - -describe('Popover', () => { - it('should show overlay when trigger is clicked', () => { - const popover = TestUtils.renderIntoDocument( - - show me your code - - ); - - expect(popover.getPopupDomNode()).toBe(null); - - TestUtils.Simulate.click( - TestUtils.findRenderedDOMComponentWithTag(popover, 'span') - ); - - const popup = popover.getPopupDomNode(); - expect(popup).not.toBe(null); - expect(popup.className).toContain('ant-popover-placement-top'); - expect(popup.innerHTML).toMatch(/
code<\/div>/); - expect(popup.innerHTML).toMatch(/
console\.log\('hello world'\)<\/div>/); - }); -}); diff --git a/tests/progress/demo.test.js b/tests/progress/demo.test.js deleted file mode 100644 index fbc616ffc7..0000000000 --- a/tests/progress/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('progress'); diff --git a/tests/radio/demo.test.js b/tests/radio/demo.test.js deleted file mode 100644 index a663362e32..0000000000 --- a/tests/radio/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('radio'); diff --git a/tests/radio/group.test.js b/tests/radio/group.test.js deleted file mode 100644 index 4a7730dc61..0000000000 --- a/tests/radio/group.test.js +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import Radio from '../../components/radio'; -import RadioGroup from '../../components/radio/group'; - -describe('Radio', () => { - it('responses hover events', () => { - const onMouseEnter = jest.fn(); - const onMouseLeave = jest.fn(); - - const wrapper = shallow( - - - - ); - - wrapper.simulate('mouseenter'); - expect(onMouseEnter).toHaveBeenCalled(); - - wrapper.simulate('mouseleave'); - expect(onMouseLeave).toHaveBeenCalled(); - }); -}); diff --git a/tests/radio/radio.test.js b/tests/radio/radio.test.js deleted file mode 100644 index 4cf93f3f30..0000000000 --- a/tests/radio/radio.test.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; -import Radio from '../../components/radio'; - -describe('Radio', () => { - it('responses hover events', () => { - const onMouseEnter = jest.fn(); - const onMouseLeave = jest.fn(); - - const wrapper = shallow( - - ); - - wrapper.simulate('mouseenter'); - expect(onMouseEnter).toHaveBeenCalled(); - - wrapper.simulate('mouseleave'); - expect(onMouseLeave).toHaveBeenCalled(); - }); -}); diff --git a/tests/rate/demo.test.js b/tests/rate/demo.test.js deleted file mode 100644 index 4e4b67d61e..0000000000 --- a/tests/rate/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('rate'); diff --git a/tests/select/demo.test.js b/tests/select/demo.test.js deleted file mode 100644 index 5a5353703b..0000000000 --- a/tests/select/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('select'); diff --git a/tests/slider/demo.test.js b/tests/slider/demo.test.js deleted file mode 100644 index 2f14516574..0000000000 --- a/tests/slider/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('slider'); diff --git a/tests/spin/demo.test.js b/tests/spin/demo.test.js deleted file mode 100644 index 595ee83522..0000000000 --- a/tests/spin/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('spin'); diff --git a/tests/steps/demo.test.js b/tests/steps/demo.test.js deleted file mode 100644 index 964edffe5b..0000000000 --- a/tests/steps/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('steps'); diff --git a/tests/switch/demo.test.js b/tests/switch/demo.test.js deleted file mode 100644 index 8646786f73..0000000000 --- a/tests/switch/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('switch'); diff --git a/tests/table/SelectionBox.test.js b/tests/table/SelectionBox.test.js deleted file mode 100644 index 9105b0225c..0000000000 --- a/tests/table/SelectionBox.test.js +++ /dev/null @@ -1,87 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import createStore from '../../components/table/createStore'; -import SelectionBox from '../../components/table/SelectionBox'; - -describe('SelectionBox', () => { - it('unchecked by selectedRowKeys ', () => { - const store = createStore({ - selectedRowKeys: [], - selectionDirty: false, - }); - - const wrapper = mount( - {}} - defaultSelection={[]} - /> - ); - - expect(wrapper.state()).toEqual({ checked: false }); - }); - - it('checked by selectedRowKeys ', () => { - const store = createStore({ - selectedRowKeys: ['1'], - selectionDirty: false, - }); - - const wrapper = mount( - {}} - defaultSelection={[]} - /> - ); - - expect(wrapper.state()).toEqual({ checked: true }); - }); - - it('checked by defaultSelection', () => { - const store = createStore({ - selectedRowKeys: [], - selectionDirty: false, - }); - - const wrapper = mount( - {}} - defaultSelection={['1']} - /> - ); - - expect(wrapper.state()).toEqual({ checked: true }); - }); - - it('checked when store change', () => { - const store = createStore({ - selectedRowKeys: [], - selectionDirty: false, - }); - - const wrapper = mount( - {}} - defaultSelection={[]} - /> - ); - - store.setState({ - selectedRowKeys: ['1'], - selectionDirty: true, - }); - - expect(wrapper.state()).toEqual({ checked: true }); - }); -}); diff --git a/tests/table/Table.filter.test.js b/tests/table/Table.filter.test.js deleted file mode 100644 index cd3a10fb28..0000000000 --- a/tests/table/Table.filter.test.js +++ /dev/null @@ -1,141 +0,0 @@ -import React from 'react'; -import { render, mount } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import Table from '../../components/table'; - -describe('Table.filter', () => { - const filterFn = (value, record) => record.name === 'Lucy'; - const column = { - title: 'Name', - dataIndex: 'name', - filters: [ - { text: 'Boy', value: 'boy' }, - { text: 'Girl', value: 'girl' }, - { - text: 'Title', - value: 'title', - children: [ - { text: 'Designer', value: 'designer' }, - { text: 'Coder', value: 'coder' }, - ], - }, - ], - onFilter: filterFn, - }; - - const data = [ - { key: 0, name: 'Jack' }, - { key: 1, name: 'Lucy' }, - { key: 2, name: 'Tom' }, - { key: 3, name: 'Jerry' }, - ]; - - function createTable(props) { - return ( - - ); - } - - it('renders filter correctly', () => { - const wrapper = render(createTable()); - - expect(renderToJson(wrapper)).toMatchSnapshot(); - }); - - it('renders menu correctly', () => { - const wrapper = mount(createTable()); - const dropdownWrapper = render(wrapper.find('Trigger').node.getComponent()); - expect(renderToJson(dropdownWrapper)).toMatchSnapshot(); - }); - - it('renders radio filter correctly', () => { - const wrapper = mount(createTable({ - columns: [{ - ...column, - filterMultiple: false, - }], - })); - const dropdownWrapper = render(wrapper.find('Trigger').node.getComponent()); - expect(renderToJson(dropdownWrapper)).toMatchSnapshot(); - }); - - it('renders custom content correctly', () => { - const filter = ( -
- custom filter -
- ); - const wrapper = mount(createTable({ - columns: [{ - ...column, - filterDropdown: filter, - }], - })); - - const dropdownWrapper = render(wrapper.find('Trigger').node.getComponent()); - expect(renderToJson(dropdownWrapper)).toMatchSnapshot(); - }); - - it('can be controlled by filterDropdownVisible', () => { - const wrapper = mount(createTable({ - columns: [{ - ...column, - filterDropdownVisible: true, - }], - })); - const dropdown = wrapper.find('Dropdown').first(); - - expect(dropdown.props().visible).toBe(true); - wrapper.setProps({ columns: [{ - ...column, - filterDropdownVisible: false, - }] }); - expect(dropdown.props().visible).toBe(false); - }); - - it('fires change event when visible change', () => { - const handleChange = jest.fn(); - const wrapper = mount(createTable({ - columns: [{ - ...column, - onFilterDropdownVisibleChange: handleChange, - }], - })); - - wrapper.find('Dropdown').first().simulate('click'); - - expect(handleChange).toBeCalledWith(true); - }); - - it('can be controlled by filteredValue', () => { - const wrapper = mount(createTable({ - columns: [{ - ...column, - filteredValue: ['girl'], - }], - })); - - expect(wrapper.find('tbody tr').length).toBe(1); - wrapper.setProps({ columns: [{ - ...column, - filteredValue: [], - }] }); - expect(wrapper.find('tbody tr').length).toBe(4); - }); - - it('fires change event', () => { - const handleChange = jest.fn(); - const wrapper = mount(createTable({ onChange: handleChange })); - const dropdownWrapper = mount(wrapper.find('Trigger').node.getComponent()); - - dropdownWrapper.find('MenuItem').first().simulate('click'); - dropdownWrapper.find('.confirm').simulate('click'); - - expect(handleChange).toBeCalledWith({}, { name: ['boy'] }, {}); - }); -}); diff --git a/tests/table/Table.pagination.test.js b/tests/table/Table.pagination.test.js deleted file mode 100644 index 4b9a1b2a57..0000000000 --- a/tests/table/Table.pagination.test.js +++ /dev/null @@ -1,78 +0,0 @@ -import React from 'react'; -import { render, mount } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import Table from '../../components/table'; - -describe('Table.pagination', () => { - const columns = [{ - title: 'Name', - dataIndex: 'name', - }]; - - const data = [ - { key: 0, name: 'Jack' }, - { key: 1, name: 'Lucy' }, - { key: 2, name: 'Tom' }, - { key: 3, name: 'Jerry' }, - ]; - - const pagination = { pageSize: 2 }; - - function createTable(props) { - return ( -
- ); - } - - function renderedNames(wrapper) { - return wrapper.find('TableRow').map(row => row.props().record.name); - } - - it('renders pagination correctly', () => { - const wrapper = render(createTable()); - expect(renderToJson(wrapper)).toMatchSnapshot(); - }); - - it('paginate data', () => { - const wrapper = mount(createTable()); - - expect(renderedNames(wrapper)).toEqual(['Jack', 'Lucy']); - wrapper.find('Pager').last().simulate('click'); - expect(renderedNames(wrapper)).toEqual(['Tom', 'Jerry']); - }); - - - it('repaginates when pageSize change', () => { - const wrapper = mount(createTable()); - - wrapper.setProps({ pagination: { pageSize: 1 } }); - expect(renderedNames(wrapper)).toEqual(['Jack']); - }); - - it('fires change event', () => { - const handleChange = jest.fn(); - const noop = () => {}; - const wrapper = mount(createTable({ - pagination: { ...pagination, onChange: noop, onShowSizeChange: noop }, - onChange: handleChange, - })); - - wrapper.find('Pager').last().simulate('click'); - - expect(handleChange).toBeCalledWith( - { - current: 2, - onChange: noop, - onShowSizeChange: noop, - pageSize: 2, - }, - {}, - {} - ); - }); -}); diff --git a/tests/table/Table.rowSelection.test.js b/tests/table/Table.rowSelection.test.js deleted file mode 100644 index e3990d1e99..0000000000 --- a/tests/table/Table.rowSelection.test.js +++ /dev/null @@ -1,166 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import Table from '../../components/table'; - -describe('Table.rowSelection', () => { - const columns = [{ - title: 'Name', - dataIndex: 'name', - }]; - - const data = [ - { key: 0, name: 'Jack' }, - { key: 1, name: 'Lucy' }, - { key: 2, name: 'Tom' }, - { key: 3, name: 'Jerry' }, - ]; - - function createTable(props = {}) { - return ( -
- ); - } - - it('select by checkbox', () => { - const wrapper = mount(createTable()); - const checkboxes = wrapper.find('input'); - const checkboxAll = checkboxes.first(); - - checkboxAll.simulate('change', { target: { checked: true } }); - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [0, 1, 2, 3], - selectionDirty: true, - }); - - checkboxes.at(1).simulate('change', { target: { checked: false } }); - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [1, 2, 3], - selectionDirty: true, - }); - - checkboxes.at(1).simulate('change', { target: { checked: true } }); - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [1, 2, 3, 0], - selectionDirty: true, - }); - }); - - it('select by radio', () => { - const wrapper = mount(createTable({ rowSelection: { type: 'radio' } })); - const radios = wrapper.find('input'); - - expect(radios.length).toBe(4); - - radios.first().simulate('change', { target: { checked: true } }); - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [0], - selectionDirty: true, - }); - - radios.last().simulate('change', { target: { checked: true } }); - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [3], - selectionDirty: true, - }); - }); - - it('pass getCheckboxProps to checkbox', () => { - const rowSelection = { - getCheckboxProps: record => ({ - disabled: record.name === 'Lucy', - }), - }; - - const wrapper = mount(createTable({ rowSelection })); - const checkboxes = wrapper.find('input'); - - expect(checkboxes.at(1).props().disabled).toBe(false); - expect(checkboxes.at(2).props().disabled).toBe(true); - }); - - it('works with pagination', () => { - const wrapper = mount(createTable({ pagination: { pageSize: 2 } })); - - const checkboxAll = wrapper.find('SelectionCheckboxAll'); - const pagers = wrapper.find('Pager'); - - checkboxAll.find('input').simulate('change', { target: { checked: true } }); - expect(checkboxAll.node.state).toEqual({ checked: true, indeterminate: false }); - - pagers.at(1).simulate('click'); - expect(checkboxAll.node.state).toEqual({ checked: false, indeterminate: false }); - - pagers.at(0).simulate('click'); - expect(checkboxAll.node.state).toEqual({ checked: true, indeterminate: false }); - }); - - // https://github.com/ant-design/ant-design/issues/4020 - it('handles defaultChecked', () => { - const rowSelection = { - getCheckboxProps: record => ({ - defaultChecked: record.key === 0, - }), - }; - - const wrapper = mount(createTable({ rowSelection })); - - const checkboxs = wrapper.find('input'); - expect(checkboxs.at(1).props().checked).toBe(true); - expect(checkboxs.at(2).props().checked).toBe(false); - - checkboxs.at(2).simulate('change', { target: { checked: true } }); - expect(checkboxs.at(1).props().checked).toBe(true); - expect(checkboxs.at(2).props().checked).toBe(true); - }); - - it('can be controlled', () => { - const wrapper = mount(createTable({ rowSelection: { selectedRowKeys: [0] } })); - - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [0], - selectionDirty: false, - }); - - wrapper.setProps({ rowSelection: { selectedRowKeys: [1] } }); - - expect(wrapper.instance().store.getState()).toEqual({ - selectedRowKeys: [1], - selectionDirty: false, - }); - }); - - it('fires change & select events', () => { - const handleChange = jest.fn(); - const handleSelect = jest.fn(); - const rowSelection = { - onChange: handleChange, - onSelect: handleSelect, - }; - const wrapper = mount(createTable({ rowSelection })); - - wrapper.find('input').last().simulate('change', { target: { checked: true } }); - - expect(handleChange).toBeCalledWith([3], [{ key: 3, name: 'Jerry' }]); - expect(handleSelect).toBeCalledWith( - { key: 3, name: 'Jerry' }, - true, - [{ key: 3, name: 'Jerry' }] - ); - }); - - it('fires selectAll event', () => { - const handleSelectAll = jest.fn(); - const rowSelection = { - onSelectAll: handleSelectAll, - }; - const wrapper = mount(createTable({ rowSelection })); - - wrapper.find('input').first().simulate('change', { target: { checked: true } }); - expect(handleSelectAll).toBeCalledWith(true, data, data); - }); -}); diff --git a/tests/table/Table.sorter.test.js b/tests/table/Table.sorter.test.js deleted file mode 100644 index 1fc0dad358..0000000000 --- a/tests/table/Table.sorter.test.js +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import { render, mount } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import Table from '../../components/table'; - -describe('Table.sorter', () => { - const sorterFn = (a, b) => a.name[0].charCodeAt() - b.name[0].charCodeAt(); - - const column = { - title: 'Name', - dataIndex: 'name', - sorter: sorterFn, - }; - - const data = [ - { key: 0, name: 'Jack' }, - { key: 1, name: 'Lucy' }, - { key: 2, name: 'Tom' }, - { key: 3, name: 'Jerry' }, - ]; - - function createTable(props) { - return ( -
- ); - } - - function renderedNames(wrapper) { - return wrapper.find('TableRow').map(row => row.props().record.name); - } - - it('renders sorter icon correctly', () => { - const wrapper = render(createTable()); - expect(renderToJson(wrapper.find('thead'))).toMatchSnapshot(); - }); - - it('sort records', () => { - const wrapper = mount(createTable()); - - wrapper.find('.ant-table-column-sorter-up').simulate('click'); - expect(renderedNames(wrapper)).toEqual(['Jack', 'Jerry', 'Lucy', 'Tom']); - - wrapper.find('.ant-table-column-sorter-down').simulate('click'); - expect(renderedNames(wrapper)).toEqual(['Tom', 'Lucy', 'Jack', 'Jerry']); - }); - - it('can be controlled by sortOrder', () => { - const wrapper = mount(createTable({ - columns: [{ ...column, sortOrder: 'ascend' }], - })); - expect(renderedNames(wrapper)).toEqual(['Jack', 'Jerry', 'Lucy', 'Tom']); - }); - - it('fires change event', () => { - const handleChange = jest.fn(); - const wrapper = mount(createTable({ onChange: handleChange })); - - wrapper.find('.ant-table-column-sorter-up').simulate('click'); - - const sorter = handleChange.mock.calls[0][2]; - expect(sorter.column.dataIndex).toBe('name'); - expect(sorter.order).toBe('ascend'); - expect(sorter.field).toBe('name'); - expect(sorter.columnKey).toBe('name'); - }); -}); diff --git a/tests/table/Table.test.js b/tests/table/Table.test.js deleted file mode 100644 index 5366735c5c..0000000000 --- a/tests/table/Table.test.js +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react'; -import { render, shallow } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import Table from '../../components/table'; - -const { Column, ColumnGroup } = Table; - -describe('Table', () => { - it('renders JSX correctly', () => { - const data = [{ - key: '1', - firstName: 'John', - lastName: 'Brown', - age: 32, - }, { - key: '2', - firstName: 'Jim', - lastName: 'Green', - age: 42, - }]; - - const wrapper = render( -
- - - - - -
- ); - - expect(renderToJson(wrapper)).toMatchSnapshot(); - }); - - it('updates columns when receiving props', () => { - const columns = [{ - title: 'Name', - key: 'name', - dataIndex: 'name', - }]; - const wrapper = shallow(); - const newColumns = [{ - title: 'Title', - key: 'title', - dataIndex: 'title', - }]; - wrapper.setProps({ columns: newColumns }); - - expect(wrapper.instance().columns).toBe(newColumns); - }); -}); diff --git a/tests/table/demo.test.js b/tests/table/demo.test.js deleted file mode 100644 index 78f2d9ff47..0000000000 --- a/tests/table/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('table'); diff --git a/tests/tabs/demo.test.js b/tests/tabs/demo.test.js deleted file mode 100644 index 3538aa6237..0000000000 --- a/tests/tabs/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('tabs'); diff --git a/tests/tag/demo.test.js b/tests/tag/demo.test.js deleted file mode 100644 index 5785e200c2..0000000000 --- a/tests/tag/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('tag'); diff --git a/tests/time-picker/demo.test.js b/tests/time-picker/demo.test.js deleted file mode 100644 index fb38b7f321..0000000000 --- a/tests/time-picker/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('time-picker'); diff --git a/tests/time-picker/index.test.js b/tests/time-picker/index.test.js deleted file mode 100644 index 99b95aab80..0000000000 --- a/tests/time-picker/index.test.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { mount, render } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; -import RcTimePicker from 'rc-time-picker/lib/TimePicker'; -import TimePicker from '../../components/time-picker'; - -describe('TimePicker', () => { - it('renders addon correctly', () => { - const addon = () => (); - const wrapper = mount(); - const rcTimePicker = wrapper.find(RcTimePicker); - const addonWrapper = render(rcTimePicker.props().addon()); - - expect(renderToJson(addonWrapper)).toMatchSnapshot(); - }); -}); diff --git a/tests/timeline/demo.test.js b/tests/timeline/demo.test.js deleted file mode 100644 index bf13d7ec8b..0000000000 --- a/tests/timeline/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('timeline'); diff --git a/tests/tooltip/demo.test.js b/tests/tooltip/demo.test.js deleted file mode 100644 index 1a6442a18a..0000000000 --- a/tests/tooltip/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('tooltip'); diff --git a/tests/transfer/demo.test.js b/tests/transfer/demo.test.js deleted file mode 100644 index 74fc0ccdea..0000000000 --- a/tests/transfer/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('transfer'); diff --git a/tests/transfer/search.test.js b/tests/transfer/search.test.js deleted file mode 100644 index d565aec069..0000000000 --- a/tests/transfer/search.test.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import { mountToJson } from 'enzyme-to-json'; -import Search from '../../components/transfer/search'; - -describe('Search', () => { - it('should show cross icon when input value exists', () => { - const wrapper = mount(); - - expect(mountToJson(wrapper)).toMatchSnapshot(); - - wrapper.setProps({ value: 'a' }); - - expect(mountToJson(wrapper)).toMatchSnapshot(); - }); -}); diff --git a/tests/tree-select/demo.test.js b/tests/tree-select/demo.test.js deleted file mode 100644 index a4ae76676f..0000000000 --- a/tests/tree-select/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('tree-select'); diff --git a/tests/tree/demo.test.js b/tests/tree/demo.test.js deleted file mode 100644 index a0eecf4bce..0000000000 --- a/tests/tree/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('tree'); diff --git a/tests/upload/demo.test.js b/tests/upload/demo.test.js deleted file mode 100644 index 0bb0c95a99..0000000000 --- a/tests/upload/demo.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import demoTest from '../shared/demoTest'; - -demoTest('upload');