Fix and add tests for clickevent/hoverevent type serializing