add jest.runAllTimers

This commit is contained in:
afc163 2018-05-22 21:08:00 +08:00 committed by 偏右
parent 3c381c6dd1
commit 7e96ae1a6a

View File

@ -49,9 +49,11 @@ describe('Mention', () => {
wrapper.find('DraftEditorContents').simulate('focus');
const ed = wrapper.find('.public-DraftEditor-content');
ed.simulate('beforeInput', { data: '@' });
jest.runAllTimers();
expect(wrapper.find('Nav').length).toBe(2);
expect(wrapper.find('Nav').first().text()).toBe('afc163');
wrapper.setState({ suggestions: ['yesmeck', 'yiminghe', 'lucy'] });
jest.runAllTimers();
expect(wrapper.find('Nav').length).toBe(3);
expect(wrapper.find('Nav').first().text()).toBe('yesmeck');
});