summaryrefslogtreecommitdiff
path: root/spec/javascripts/application_spec.js
blob: b48026c3b773950e5e58e6816a8909e4719234d1 (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
29
30
31
32

/*= require lib/utils/common_utils */

(function() {
  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);
      });
    });
  });

}).call(this);