Page: Attach unit test delegated handler to document instead

Fixes gh-7234