Skip to content

Commit e361f17

Browse files
authored
fix: include disabled item for searching tag item in options (#309)
1 parent 17f1097 commit e361f17

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Select.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,8 @@ class Select extends React.Component {
10481048
sel.push(menuItem);
10491049
menuItems.push(menuItem);
10501050
}
1051-
if (tags && !child.props.disabled) {
1051+
1052+
if (tags) {
10521053
childrenKeys.push(childValue);
10531054
}
10541055
});

tests/Select.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,16 @@ describe('Select', () => {
703703
expect(wrapper.find('li').text()).toEqual('1');
704704
});
705705

706+
it('should include disabled item in options', () => {
707+
const wrapper = mount(
708+
<Select tags open value={['name1']}>
709+
<Option key="name1" disabled>name1</Option>
710+
<Option key="name2">name2</Option>
711+
</Select>
712+
);
713+
expect(wrapper.find('li.rc-select-dropdown-menu-item')).toHaveLength(2);
714+
});
715+
706716
it('renders not found when search result is empty', () => {
707717
const wrapper = mount(
708718
<Select open>

0 commit comments

Comments
 (0)