iron-test-helpers icon indicating copy to clipboard operation
iron-test-helpers copied to clipboard

Expose click() in MockInteractions

Open NovapaX opened this issue 7 years ago • 1 comments

How else are we supposed to test a click on a certain xy-location...

NovapaX avatar Feb 22 '18 15:02 NovapaX

Hi, a click event would need to generate also up and down event before getting fired. This is done by tap - see implementation.

If you want to set a different xy instead of the middle of the node, we could just handle a new property in the options object passed to tap, e.g.

MockInteractions.tap(node, {
  xy: MockInteractions.topLeftOfNode(node)
});

const bounds = node.getBoundingClientRect();
MockInteractions.tap(node, {
  xy: { x: bounds.left + 5, y: bounds.top + 10 }
});

Mind opening an issue for this?

valdrinkoshi avatar Feb 22 '18 23:02 valdrinkoshi