add tests and doc for toggle