[new feature] Button: add touchstart event (#3039)

This commit is contained in:
neverland
2019-03-22 14:41:01 +08:00
committed by GitHub
parent 2a4c2d86e9
commit 5a44d204bd
7 changed files with 46 additions and 23 deletions
+14
View File
@@ -58,3 +58,17 @@ test('not trigger click event when loading', () => {
wrapper.trigger('click');
expect(onClick).toHaveBeenCalledTimes(0);
});
test('touchstart event', () => {
const onTouchstart = jest.fn();
const wrapper = mount(Button, {
context: {
on: {
touchstart: onTouchstart
}
}
});
wrapper.trigger('touchstart');
expect(onTouchstart).toHaveBeenCalled();
});