Skip to content

Commit 223a545

Browse files
authored
fix: No React warning for pass invalidate dom props (#757)
* test: Test driven * fix: pick only needed data * test: more coverage
1 parent 70590a5 commit 223a545

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/OptionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, OptionListP
333333

334334
return (
335335
<div
336-
{...passedProps}
336+
{...pickAttrs(passedProps)}
337337
aria-selected={selected}
338338
className={optionClassName}
339339
title={optionTitle}

tests/Select.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,4 +1838,18 @@ describe('Select.Basic', () => {
18381838
.visibility,
18391839
).toBe('hidden');
18401840
});
1841+
1842+
it('no warning for non-dom attr', () => {
1843+
const wrapper = mount(
1844+
<Select open>
1845+
<Select.Option light="little" data-test="good" aria-label="well">
1846+
Bamboo
1847+
</Select.Option>
1848+
</Select>,
1849+
);
1850+
1851+
expect(wrapper.find('div.rc-select-item').prop('light')).toBeFalsy();
1852+
expect(wrapper.find('div.rc-select-item').prop('data-test')).toEqual('good');
1853+
expect(wrapper.find('div.rc-select-item').prop('aria-label')).toEqual('well');
1854+
});
18411855
});

0 commit comments

Comments
 (0)