Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Apr 2, 2017
1 parent 30a22ee commit 224180d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/FilterMixin.js
Expand Up @@ -18,6 +18,7 @@ export default {
}
return true;
},

renderFilterOptions(inputValue) {
return this.renderFilterOptionsFromChildren(this.props.children, true, inputValue);
},
Expand Down
11 changes: 11 additions & 0 deletions tests/FilterMixin.spec.js
Expand Up @@ -106,6 +106,17 @@ describe('FilterMixin', () => {
);
});

it('filterOption could be true as described in default value', () => {
const wrapper = render(
<Select inputValue="3" filterOption>
<Option value="1">1</Option>
<Option value="2">2</Option>
</Select>
);

expect(renderToJson(wrapper)).toMatchSnapshot();
});

describe('tag mode', () => {
it('renders unlisted item in value', () => {
const wrapper = render(
Expand Down
28 changes: 28 additions & 0 deletions tests/__snapshots__/FilterMixin.spec.js.snap
@@ -1,5 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FilterMixin renderFilterOptionsFromChildren filterOption could be true as described in default value 1`] = `
<ul
aria-activedescendant=""
class="rc-menu rc-menu-vertical rc-menu-root"
role="menu"
tabindex="0"
>
<li
aria-selected="false"
class="rc-menu-item"
role="menuitem"
style="user-select:none;-webkit-user-select:none;"
unselectable="unselectable"
>
1
</li>
<li
aria-selected="false"
class="rc-menu-item"
role="menuitem"
style="user-select:none;-webkit-user-select:none;"
unselectable="unselectable"
>
2
</li>
</ul>
`;

exports[`FilterMixin renderFilterOptionsFromChildren filters children by inputValue 1`] = `
<ul
aria-activedescendant=""
Expand Down

0 comments on commit 224180d

Please sign in to comment.