Check for existence of elements under test in application_spec.js (!6051)

This commit is contained in:
winniehell 2016-08-26 10:54:17 +02:00
parent 9704fa22c5
commit bfd14f8763
1 changed files with 7 additions and 3 deletions

View File

@ -13,17 +13,21 @@
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);
});
return it('should be on the same page if a disabled link clicked', function() {
var locationBeforeLinkClick;
it('should be on the same page if a disabled link clicked', function() {
var locationBeforeLinkClick, $link;
locationBeforeLinkClick = window.location.href;
gl.utils.preventDisabledButtons();
$('#test-link').click();
$link = $('#test-link');
expect($link).toExist();
$link.click();
return expect(window.location.href).toBe(locationBeforeLinkClick);
});
});