Make uihooks test more strict

We now make sure we didn't accidentally modify
the DOM before firing the hook