fix tests and fixes #2867 (redirect preview only in edit mode)

fixes #2867