MDL-38538 question autosave: some unit tests

At the moment, the bits of these tests that simulate the auto-saving
are commented out, and the tests pass. This is good, since autosaving,
or not, should not affect overall observed behaviour.
MDL-38538 quiz auto-save. First draft JS and ajax code.

This mostly works, but of course the back-end is not yet written. Also
it fails to consider possible race conditions.
MDL-38538 quiz autosave: improve the JS

1. Admin setting to control the delay, or even turn it off.
2. Detect changes in TinyMCE editors.
3. Detect changes in hidden fields, such as those used by drag-drop
questions.
4. More care about not triggering one save until the previous one was
finished, but do save again if changes are made during the previous
save.
5. Do not trigger a save if there is only a short amount of time left in
the quiz.
MDL-38538 fix JavaScript errors.
MDL-38538 question engine: the back-end of the autosave code.