From ef7e7a80d2be7c90259deb76f0492e4b29a455d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Wed, 27 May 2020 22:16:35 +0800 Subject: [PATCH] test: increase test case cov of List (#24510) --- components/list/__tests__/Item.test.js | 50 ++++++ .../__tests__/__snapshots__/Item.test.js.snap | 148 ++++++++++++++++++ 2 files changed, 198 insertions(+) diff --git a/components/list/__tests__/Item.test.js b/components/list/__tests__/Item.test.js index de0c063db0..fb9088b697 100644 --- a/components/list/__tests__/Item.test.js +++ b/components/list/__tests__/Item.test.js @@ -128,4 +128,54 @@ describe('List Item Layout', () => { ); expect(render(wrapper)).toMatchSnapshot(); }); + + it('rowKey could be string', () => { + const dataWithId = [ + { + id: 1, + title: `ant design`, + }, + { + id: 2, + title: `ant design`, + }, + { + id: 3, + title: `ant design`, + }, + ]; + const wrapper = mount( + {item.title}} + />, + ); + expect(wrapper).toMatchSnapshot(); + }); + + it('rowKey could be function', () => { + const dataWithId = [ + { + id: 1, + title: `ant design`, + }, + { + id: 2, + title: `ant design`, + }, + { + id: 3, + title: `ant design`, + }, + ]; + const wrapper = mount( + item.id} + renderItem={item => {item.title}} + />, + ); + expect(wrapper).toMatchSnapshot(); + }); }); diff --git a/components/list/__tests__/__snapshots__/Item.test.js.snap b/components/list/__tests__/__snapshots__/Item.test.js.snap index c0846e358a..52159b43d5 100644 --- a/components/list/__tests__/__snapshots__/Item.test.js.snap +++ b/components/list/__tests__/__snapshots__/Item.test.js.snap @@ -57,6 +57,154 @@ exports[`List Item Layout horizontal itemLayout List should accept extra node 1` `; +exports[`List Item Layout rowKey could be function 1`] = ` + +
+ +
+
+
    + +
  • + ant design +
  • +
    + +
  • + ant design +
  • +
    + +
  • + ant design +
  • +
    +
+
+
+
+
+
+`; + +exports[`List Item Layout rowKey could be string 1`] = ` + +
+ +
+
+
    + +
  • + ant design +
  • +
    + +
  • + ant design +
  • +
    + +
  • + ant design +
  • +
    +
+
+
+
+
+
+`; + exports[`List Item Layout should render in RTL direction 1`] = `