-
-
Notifications
You must be signed in to change notification settings - Fork 478
fix Select[multipie] with OptGroup will cause error. #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
</Select> | ||
); | ||
expect(renderToJson(wrapper)).toMatchSnapshot(); | ||
expect(errorSpy).not.toHaveBeenCalled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个测试写 Select.multipe.spec.js
里就可以了吧,测试是否报错可以用 not.toThrow
,没必要 mock console.error
和 snapshot
。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
然后这个错误应该是在选择的时候会出现,所以这里要模拟一下选择。tags
模式下也会报错,可以照这样写 https://github.com/react-component/select/blob/master/tests/Select.multiple.spec.js#L12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
错误是初始化时就报的,跟选择行为没啥关系。。。测试写法已更新~
tests/Select.multiple.spec.js
Outdated
</OptGroup> | ||
</Select>, | ||
); | ||
}).not.toThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个用例本来就是 ok 的吧?
单独写个用例吧。
Select[multipie || tags]
withOptGroup
can reproducerelervant: ant-design/ant-design#5567