title: Qunit click trigger test causes infinite refresh loop
body: <p>I'm trying to write some <code>qunit</code> tests for a simple <code>jQuery</code> function. The function I'm testing selects an element <code>input</code>, and adds a listener to it (on click and on keypress). The listener hides another element, <code>.has-error</code>:</p>
  
  <pre><code>$('input').on('keypress click', function () {
      $('.has-error').hide();
  });
  </code></pre>
  
  <p>I started with two tests: one that checks that <code>.has-error</code> is invisible after a keypress, and another on that checks that <code>.has-error</code> is visible if nothing happens:</p>
  
  <pre><code>test("errors should be hidden on keypress", function () {
      $('input').trigger('keypress');
      equal($('.has-error').is(':visible'), false);
  });
  
  test("errors not be hidden unless there is a keypress or a click",
       function() {
      equal($('.has-error').is(':visible'), true);
  });
  </code></pre>
  
  <p>That works fine, and my tests pass. The problem starts when I try adding a third test, to check that <code>.has-error</code> is hidden after a click on the <code>input</code> element:</p>
  
  <pre><code>test("errors should be hidden on click", function () {
      $('input').trigger('click');
      equal($('.has-error').is(':visible'), false);
  });
  </code></pre>
  
  <p>Then my testing page enters an infinite loop. It seems that both the first and last test are failing. However, removing the first test does not appear to solve the issue.</p>
  
  <p>I guess there's something wrong with my third test, but can't figure out what it is.</p>