سؤال

Does anyone know how I can go about testing this in Jasmine?

function gameWon() {
  $('#final_message_cpu').html('You WON!!!')
  $('.computer_selection').css('display', 'block');
  $('#show_after_starting').remove();
  $('#hide_after_starting').css('display', 'inline')
  $('#hide_after_starting').click(function() {
    location.reload();
 })
}

Is there a way I can just test to see if $('#show_after_starting') has been removed?

هل كانت مفيدة؟

المحلول

Yes:

expect($('#show_after_starting').length).toBe(0);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top