Fix wrong List property (#10123) (#10128)

This diff excludes `locale` from `rest` variable to
avoid passing to div.

Close #10123
This commit is contained in:
Dmitry Manannikov 2018-04-17 18:15:22 +02:00 committed by 偏右
parent 05a522c343
commit c0e60f8097
2 changed files with 19 additions and 0 deletions

View File

@ -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 => <ListItem>{item}</ListItem>;
const dataSource = [];
const wrapper = mount(
<List renderItem={renderItem} dataSource={dataSource} locale={locale} />
);
expect(wrapper.find('div').first().props().locale).toBe(undefined);
});
});

View File

@ -129,6 +129,7 @@ export default class List extends React.Component<ListProps> {
header, header,
footer, footer,
loading, loading,
locale,
...rest, ...rest,
} = this.props; } = this.props;