summaryrefslogtreecommitdiff
path: root/spec/javascripts/application_spec.js
blob: 75b891c3ef0a35e8cb699f3362076afc5c6ba564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

/*= require lib/utils/common_utils */
describe('Application', function() {
  return describe('disable buttons', function() {
    fixture.preload('application.html');
    beforeEach(function() {
      return fixture.load('application.html');
    });
    it('should prevent default action for disabled buttons', function() {
      var $button, isClicked;
      gl.utils.preventDisabledButtons();
      isClicked = false;
      $button = $('#test-button');
      $button.click(function() {
        return isClicked = true;
      });
      $button.trigger('click');
      return expect(isClicked).toBe(false);
    });
    return it('should be on the same page if a disabled link clicked', function() {
      var locationBeforeLinkClick;
      locationBeforeLinkClick = window.location.href;
      gl.utils.preventDisabledButtons();
      $('#test-link').click();
      return expect(window.location.href).toBe(locationBeforeLinkClick);
    });
  });
});