Actually, I figured out the problem is a bit more complicated.
It seems that the "test" function is fired when you right click on the editor and choose "Past as HTML". It does not work when you right click and choose "Paste" or if you use the very common CTRL+V commands.
Can anyone please tell me how to ensure that "Paste" or CTRL+V fires the "test" function? It is strange that there is no OnPaste !