Commit 35bcf734 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'improve-application_spec' into 'master'

Check for existance of elements under test in application_spec.js

## What does this MR do?

Checks that the elements under test in `application_spec.js` actually exist.

## Why was this MR needed?

```
$ echo 'just garbage' > spec/javascripts/fixtures/application.html.haml 
$ bundle exec teaspoon spec/javascripts/application_spec.js 
2 examples, 0 failures
```

See merge request !6051
parents b5a1c9ff bfd14f87
...@@ -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