Fix a bug in the test for document.dir.

As pointed out by smontagu.