Commit bfd14f87 authored by winniehell's avatar winniehell

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

parent 9704fa22
...@@ -13,17 +13,21 @@ ...@@ -13,17 +13,21 @@
gl.utils.preventDisabledButtons(); gl.utils.preventDisabledButtons();
isClicked = false; isClicked = false;
$button = $('#test-button'); $button = $('#test-button');
expect($button).toExist();
$button.click(function() { $button.click(function() {
return isClicked = true; return isClicked = true;
}); });
$button.trigger('click'); $button.trigger('click');
return expect(isClicked).toBe(false); 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; locationBeforeLinkClick = window.location.href;
gl.utils.preventDisabledButtons(); gl.utils.preventDisabledButtons();
$('#test-link').click(); $link = $('#test-link');
expect($link).toExist();
$link.click();
return expect(window.location.href).toBe(locationBeforeLinkClick); return expect(window.location.href).toBe(locationBeforeLinkClick);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment