From c0e60f8097c8946b1f55800286aa715d9aa9ee7c Mon Sep 17 00:00:00 2001 From: Dmitry Manannikov Date: Tue, 17 Apr 2018 18:15:22 +0200 Subject: [PATCH] Fix wrong List property (#10123) (#10128) This diff excludes `locale` from `rest` variable to avoid passing to div. Close #10123 --- components/list/__tests__/index.test.js | 18 ++++++++++++++++++ components/list/index.tsx | 1 + 2 files changed, 19 insertions(+) create mode 100644 components/list/__tests__/index.test.js diff --git a/components/list/__tests__/index.test.js b/components/list/__tests__/index.test.js new file mode 100644 index 0000000000..8947299973 --- /dev/null +++ b/components/list/__tests__/index.test.js @@ -0,0 +1,18 @@ +import React from 'react'; +import { mount } from 'enzyme'; +import List from '..'; + +const ListItem = List.Item; + +describe('List', () => { + it('locale not passed to internal div', async () => { + const locale = { emptyText: 'Custom text' }; + const renderItem = item => {item}; + const dataSource = []; + + const wrapper = mount( + + ); + expect(wrapper.find('div').first().props().locale).toBe(undefined); + }); +}); diff --git a/components/list/index.tsx b/components/list/index.tsx index 863e7d18ae..7a6f4f6cb4 100644 --- a/components/list/index.tsx +++ b/components/list/index.tsx @@ -129,6 +129,7 @@ export default class List extends React.Component { header, footer, loading, + locale, ...rest, } = this.props;