Added unit test for UndoManager. Updated UndoManager to support #dispose().