Fixes sporadic timing-related test failures.

# Changes
 - Adds `thenWhenReady` and `thenOpenWhenReady` classes, which wait for `js-ready` class to be added to the `<html`> element. This fixes sporadic test failures if JavaScript (in particular modal initialization) did not finish in time for tests.
 - Updates tests to use these new helpers


![screen shot 2014-09-29 at 4 06 31 pm](https://cloud.githubusercontent.com/assets/583202/4449839/34202322-481f-11e4-9ae7-6fd7a0eece94.png)

To further clarify: the issue that @aa6046f was intending to fix (and @0f5dc67) was an inline script error that occurred in the `_cleanup` method that runs after closing modals. It was not actually causing tests to fail (which is what the `thenWhenReady` and `thenOpenWhenReady` helpers in @5733f14 fixed).