diff options
author | winniehell <git@winniehell.de> | 2017-02-09 12:47:55 +0100 |
---|---|---|
committer | winniehell <git@winniehell.de> | 2017-02-11 17:49:12 +0100 |
commit | 128d8b61180845e0465a3fe4e5f64d417f4f819a (patch) | |
tree | 7a61c3ec67cb6d81aea980affeb82624b9a7e58d | |
parent | d4317e4d22b33d0bfe07b231ddeb4dd774aa0bb7 (diff) | |
download | gitlab-ce-128d8b61180845e0465a3fe4e5f64d417f4f819a.tar.gz |
Replace static fixture for behaviors/quick_submit_spec.js (!9086)
-rw-r--r-- | changelogs/unreleased/quick-submit-fixture.yml | 4 | ||||
-rw-r--r-- | spec/javascripts/behaviors/quick_submit_spec.js | 18 | ||||
-rw-r--r-- | spec/javascripts/fixtures/behaviors/quick_submit.html.haml | 5 |
3 files changed, 17 insertions, 10 deletions
diff --git a/changelogs/unreleased/quick-submit-fixture.yml b/changelogs/unreleased/quick-submit-fixture.yml new file mode 100644 index 00000000000..a2cf05dabec --- /dev/null +++ b/changelogs/unreleased/quick-submit-fixture.yml @@ -0,0 +1,4 @@ +--- +title: Replace static fixture for behaviors/quick_submit_spec.js +merge_request: 9086 +author: winniehell diff --git a/spec/javascripts/behaviors/quick_submit_spec.js b/spec/javascripts/behaviors/quick_submit_spec.js index 8113b16b74a..0e4c2c560cc 100644 --- a/spec/javascripts/behaviors/quick_submit_spec.js +++ b/spec/javascripts/behaviors/quick_submit_spec.js @@ -5,9 +5,9 @@ require('~/behaviors/quick_submit'); (function() { describe('Quick Submit behavior', function() { var keydownEvent; - preloadFixtures('static/behaviors/quick_submit.html.raw'); + preloadFixtures('issues/open-issue.html.raw'); beforeEach(function() { - loadFixtures('static/behaviors/quick_submit.html.raw'); + loadFixtures('issues/open-issue.html.raw'); $('form').submit(function(e) { // Prevent a form submit from moving us off the testing page return e.preventDefault(); @@ -37,10 +37,18 @@ require('~/behaviors/quick_submit'); })); return expect(this.spies.submit).not.toHaveBeenTriggered(); }); - it('disables submit buttons', function() { + it('disables input of type submit', function() { + const submitButton = $('.js-quick-submit input[type=submit]'); this.textarea.trigger(keydownEvent()); - expect($('input[type=submit]')).toBeDisabled(); - return expect($('button[type=submit]')).toBeDisabled(); + expect(submitButton).toBeDisabled(); + }); + it('disables button of type submit', function() { + // button doesn't exist in fixture, add it manually + const submitButton = $('<button type="submit">Submit it</button>'); + submitButton.insertAfter(this.textarea); + + this.textarea.trigger(keydownEvent()); + expect(submitButton).toBeDisabled(); }); // We cannot stub `navigator.userAgent` for CI's `rake karma` task, so we'll // only run the tests that apply to the current platform diff --git a/spec/javascripts/fixtures/behaviors/quick_submit.html.haml b/spec/javascripts/fixtures/behaviors/quick_submit.html.haml deleted file mode 100644 index 6dd53931a42..00000000000 --- a/spec/javascripts/fixtures/behaviors/quick_submit.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%form.js-quick-submit{ action: '/foo' } - %textarea - - %input{ type: 'submit'} Submit - %button.btn{ type: 'submit' } Submit |