diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-08-31 23:19:08 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-08-31 23:19:08 +0300 |
commit | 35bcf73413c7a1b77b3797c7fecaf1e931db98b3 (patch) | |
tree | 2aa2ce00704d3d91f9e9d25ab8b28ca2f0b3320f | |
parent | b5a1c9ffa017ca800d156f5fbe0387eb80199ddd (diff) | |
parent | bfd14f876388f6c9a4006ae270b8a98912415226 (diff) |
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
-rw-r--r-- | spec/javascripts/application_spec.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/javascripts/application_spec.js b/spec/javascripts/application_spec.js index b48026c3b77..56b98856614 100644 --- a/spec/javascripts/application_spec.js +++ b/spec/javascripts/application_spec.js @@ -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); }); }); |