add `Document.replace` with test