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(' components', () => { const tree = renderer.create( Single Multiple options or groupOptions ', () => { .toJSON(); expect(tree).toMatchSnapshot(); }); - it('renders components', () => { const tree = renderer .create( @@ -132,6 +138,13 @@ describe(' expecialGroup components', () => { + const tree = mount( allowClear onClear onAllowClear', () => { @@ -310,6 +323,21 @@ describe('); + 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( 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(); });