util test

This commit is contained in:
ycjcl868 2018-12-02 15:31:40 +08:00
parent e7027311bb
commit 9300cd88ba

View File

@ -2,6 +2,7 @@ import raf from 'raf';
import delayRaf from '../raf';
import throttleByAnimationFrame from '../throttleByAnimationFrame';
import getDataOrAriaProps from '../getDataOrAriaProps';
import triggerEvent from '../triggerEvent';
describe('Test utils function', () => {
beforeAll(() => {
@ -114,4 +115,13 @@ describe('Test utils function', () => {
});
});
});
it('triggerEvent', () => {
const button = document.createElement('button');
button.addEventListener('click', () => {
button.style.width = '100px';
}, true);
triggerEvent(button, 'click');
expect(button.style.width).toBe('100px');
});
});