It seems be able to verify the actually result before/after applying the patch, but it still pass the test with original logic... It's because the document.activeElement would be always set to html body instead of message input element in the test environment, and that make the wrong result unreproducible (and we can't stub/replace the activeElement because it's a getter ... :-/) Any better idea?