Add test for document permalink
Solidify document permalink tests
Modify tests a bit
Don't use old `@url` variable

Fix for #2557
Merge pull request #2575 from alfredxing/test-document-permalink