Adds deferred.resolve() after setTimeout()

Improves tests by giving browsers time to render the newly created
DOM structures, thus making these tests closer to reality