Added isMouseEvent() utility function.

This cuts down on some repeated code and makes the checks a bit more
readable.
Added isMouseEvent() utility function tests.

Tests for function added in commit
fa996030a1ba53e7572f3ee5889251c7b00200bf.