I think the selected answer (even if it is OP!) Is misleading and incorrect. I'm not sure why this would be a βbad formβ to test the effect of the javascript part on some kind of target html. Often this is the only conclusion you can use to check if the method works.
, , : , , ! , , -, , . DOM , ( ) .
(https://github.com/pivotal/jasmine/wiki/Asynchronous-specs), DOM, , Ruby Capybara (https://github.com/jnicklas/capybara/):
it('loads themes switcher link in head', function() {
$('.theme-picker').trigger('click');
waitsFor(function() {
return $('head').contains('theme_switcher');
}, 'theme switcher never loaded', 10000);
});