summaryrefslogtreecommitdiff
path: root/spec/javascripts/application_spec.js
blob: 16e908f3a8150c113dfc561a3a24b247e5213adf (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
33
34
35
36
37
/* eslint-disable */

/*= 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');
        expect($button).toExist();
        $button.click(function() {
          return isClicked = true;
        });
        $button.trigger('click');
        return expect(isClicked).toBe(false);
      });

      it('should be on the same page if a disabled link clicked', function() {
        var locationBeforeLinkClick, $link;
        locationBeforeLinkClick = window.location.href;
        gl.utils.preventDisabledButtons();
        $link = $('#test-link');
        expect($link).toExist();
        $link.click();
        return expect(window.location.href).toBe(locationBeforeLinkClick);
      });
    });
  });

}).call(this);