Add test for document.output.

Test for ref: 00f21ee93ca28913ef027caef893488d2f93ff75
Closes #2232.