button: refactoring, add tests for toggle mod