mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
test: update cases for Mention
This commit is contained in:
parent
8eec4a801a
commit
64b6197441
@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Mention from '..';
|
||||
import { Nav } from 'rc-editor-mention';
|
||||
|
||||
const { toContentState } = Mention;
|
||||
|
||||
@ -113,4 +114,25 @@ describe('Mention', () => {
|
||||
expect(items.length).toBe(1);
|
||||
expect(items.at(0).props().children).toBe('bamboo');
|
||||
});
|
||||
|
||||
it('onBlur', () => {
|
||||
const e = { test: 1 };
|
||||
const onBlur = event => {
|
||||
expect(event).toEqual(e);
|
||||
};
|
||||
const wrapper = mount(<Mention onBlur={onBlur} />).instance();
|
||||
wrapper.onBlur(e);
|
||||
expect(wrapper.state.focus).toBe(false);
|
||||
});
|
||||
|
||||
it('check filteredSuggestions', () => {
|
||||
let wrapper = mount(<Mention defaultSuggestions={[<Nav value="light" />]} />).instance();
|
||||
wrapper.defaultSearchChange('test');
|
||||
expect(wrapper.state.filteredSuggestions).toEqual([]);
|
||||
wrapper.defaultSearchChange('light');
|
||||
expect(wrapper.state.filteredSuggestions).toEqual([<Nav value="light" />]);
|
||||
wrapper = mount(<Mention defaultSuggestions={[<Nav />]} />).instance();
|
||||
wrapper.defaultSearchChange('test');
|
||||
expect(wrapper.state.filteredSuggestions).toEqual([<Nav />]);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user