Added tests for #6828, and updated doc