test for mode change

Added test for mode changes.

This current fails because of changes in termWriter broke the mode code.
So we need to fix it.