unit tests for toggle directive
improved toggle directive and added unit tests for it.