gamedev-patterns-ts icon indicating copy to clipboard operation
gamedev-patterns-ts copied to clipboard

input.spec.ts does not recognize MouseEvent('click')

Open WiiTee opened this issue 2 years ago • 0 comments

image

I suspect that changes have been made since the guide was initially put up, I've checked (and double checked), but this unit test no longer succeeds (indeed, it didn't succeed at all for me be that before or after fixing false positives/negatives fixes).

Making the changes below: image

Fixes the problem as now the simulated mouse click is done on the document as a whole and not body. I suspect that changes in how MouseEvents are handled (calling preventDefault unless specifically told not to on elements) to be the main issue. It was of course a necessary change to support many click functionalities of todays browsers. Now I could of course have made an EventHandler which disables preventDefault, but this was the quick and dirty solution.

WiiTee avatar Jun 17 '23 13:06 WiiTee