2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
/*= 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-09-29 09:46:39 +05:30
|
|
|
expect($button).toExist();
|
2016-09-13 17:45:13 +05:30
|
|
|
$button.click(function() {
|
|
|
|
return isClicked = true;
|
|
|
|
});
|
|
|
|
$button.trigger('click');
|
|
|
|
return expect(isClicked).toBe(false);
|
|
|
|
});
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
it('should be on the same page if a disabled link clicked', function() {
|
|
|
|
var locationBeforeLinkClick, $link;
|
2016-09-13 17:45:13 +05:30
|
|
|
locationBeforeLinkClick = window.location.href;
|
|
|
|
gl.utils.preventDisabledButtons();
|
2016-09-29 09:46:39 +05:30
|
|
|
$link = $('#test-link');
|
|
|
|
expect($link).toExist();
|
|
|
|
$link.click();
|
2016-09-13 17:45:13 +05:30
|
|
|
return expect(window.location.href).toBe(locationBeforeLinkClick);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}).call(this);
|