BigW Consortium Gitlab

application_spec.js 1.1 KB
Newer Older
Fatih Acet committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

/*= 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');
16
        expect($button).toExist();
Fatih Acet committed
17 18 19 20 21 22
        $button.click(function() {
          return isClicked = true;
        });
        $button.trigger('click');
        return expect(isClicked).toBe(false);
      });
23 24 25

      it('should be on the same page if a disabled link clicked', function() {
        var locationBeforeLinkClick, $link;
Fatih Acet committed
26 27
        locationBeforeLinkClick = window.location.href;
        gl.utils.preventDisabledButtons();
28 29 30
        $link = $('#test-link');
        expect($link).toExist();
        $link.click();
Fatih Acet committed
31 32 33 34 35 36
        return expect(window.location.href).toBe(locationBeforeLinkClick);
      });
    });
  });

}).call(this);