fix issue - TransUnitUpdated event will cause editor in unsaved style

The order is important.
CodeMirror onchange event will fire up and mark editor as unsaved (when TransUnitUpdated event received from server and editor gets udpated). 
So setting state to saved must happen after setting code mirror value.
The test will ensure this.

To test this:
1. Search and replace some text or perform a TM merge.
2. Verify editor is NOT in unsaved style.