2016-11-15 14:08:06 +00:00
|
|
|
/* eslint-disable space-before-function-paren, one-var, no-var, one-var-declaration-per-line, no-return-assign, padded-blocks, max-len */
|
2016-07-24 20:45:11 +00:00
|
|
|
|
|
|
|
/*= 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');
|
2016-08-26 08:54:17 +00:00
|
|
|
expect($button).toExist();
|
2016-07-24 20:45:11 +00:00
|
|
|
$button.click(function() {
|
|
|
|
return isClicked = true;
|
|
|
|
});
|
|
|
|
$button.trigger('click');
|
|
|
|
return expect(isClicked).toBe(false);
|
|
|
|
});
|
2016-08-26 08:54:17 +00:00
|
|
|
|
|
|
|
it('should be on the same page if a disabled link clicked', function() {
|
|
|
|
var locationBeforeLinkClick, $link;
|
2016-07-24 20:45:11 +00:00
|
|
|
locationBeforeLinkClick = window.location.href;
|
|
|
|
gl.utils.preventDisabledButtons();
|
2016-08-26 08:54:17 +00:00
|
|
|
$link = $('#test-link');
|
|
|
|
expect($link).toExist();
|
|
|
|
$link.click();
|
2016-07-24 20:45:11 +00:00
|
|
|
return expect(window.location.href).toBe(locationBeforeLinkClick);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}).call(this);
|