diff --git a/src/components/select/__tests__/Select.test.js b/src/components/select/__tests__/Select.test.js
index f709f655de..f06e48405a 100644
--- a/src/components/select/__tests__/Select.test.js
+++ b/src/components/select/__tests__/Select.test.js
@@ -31,6 +31,13 @@ const optionsWithOutGroup = values.map((value, index) => ({
label: labels[index],
}));
+const expecialGroupOptions = values.map((value, index) => ({
+ value,
+ label: labels[index],
+ groupValue: undefined,
+ groupLabel: undefined,
+}));
+
describe(' Single Multiple options or groupOptions ', () => {
it('renders components', () => {
const tree = renderer.create().toJSON();
@@ -47,7 +54,6 @@ describe(' Single Multiple options or groupOptions ', () => {
.toJSON();
expect(tree).toMatchSnapshot();
});
-
it('renders components', () => {
const tree = renderer
.create(
@@ -132,6 +138,13 @@ describe(' Single Multiple options or groupOptions ', () => {
expect(document.querySelector('.gio-select-dropdown').querySelectorAll('.gio-select-list-option')).toHaveLength(1);
tree.unmount();
});
+ it('renders expecialGroup components', () => {
+ const tree = mount();
+ tree.simulate('click');
+ expect(document.querySelector('.gio-select-dropdown')).not.toBeNull();
+ expect(document.querySelector('.gio-select-list-group')).not.toBeNull();
+ tree.unmount();
+ });
});
describe(' allowClear onClear onAllowClear', () => {
@@ -310,6 +323,21 @@ describe(' keyDown', () => {
tree.unmount();
});
});
+ it('keyDown mouseEnter', () => {
+ const tree = mount();
+ act(() => {
+ tree.simulate('click');
+ });
+ act(() => {
+ tree.find('input').simulate('change', { target: { value: '全部' } });
+ });
+ tree.mount().find('.gio-select-list-option').simulate('mouseenter');
+ tree.mount().find('.gio-select-list').simulate('keyDown', { keyCode: 13, key: 'Enter' });
+ expect(tree.render().find('.gio-select-values-wrapper').children('.gio-tag')).toHaveLength(1);
+ act(() => {
+ tree.unmount();
+ });
+ });
it('keyDown', async () => {
const tree = mount();
act(() => {
@@ -420,8 +448,6 @@ describe(' keyDown', () => {
tree.mount().find('.gio-select-list').simulate('keyDown', { keyCode: 38, key: 'ArrowUp' });
tree.mount().find('.gio-select-list').simulate('keyDown', { keyCode: 38, key: 'ArrowUp' });
tree.mount().find('.gio-select-list').simulate('keyDown', { keyCode: 13, key: 'Enter' });
- // tree.mount().find('.gio-select-list').simulate('mouseLeave');
- // tree.mount().find('.gio-select-list-option-container').simulate('mouseEnter');
expect(tree.render().find('.gio-select-values-wrapper').children('.gio-tag')).toHaveLength(1);
tree.unmount();
});