No ticket: improve replaceWith testing
(cherry picked from commit 13468abaeb5488d547bc75d99bc3425ee891859e)