diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2017-02-14 18:39:01 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-02-14 18:39:01 +0000 |
commit | ad5e772bddd7b417fa7a36629db02c69b1b9864d (patch) | |
tree | 8bdc94e6ba448d128dd3a79fbf5b32e800989b0e | |
parent | 0b25368907fb1491b840d93ebb780b9ef2b130dd (diff) | |
parent | 409a3250438981331a6f97422d53bc1095ff13d4 (diff) | |
download | gitlab-ce-ad5e772bddd7b417fa7a36629db02c69b1b9864d.tar.gz |
Merge branch 'requires-input-fixture' into 'master'
Replace static fixture for behaviors/requires_input_spec.js
See merge request !9162
-rw-r--r-- | changelogs/unreleased/requires-input-fixture.yml | 4 | ||||
-rw-r--r-- | spec/javascripts/behaviors/requires_input_spec.js | 13 | ||||
-rw-r--r-- | spec/javascripts/fixtures/behaviors/requires_input.html.haml | 18 |
3 files changed, 11 insertions, 24 deletions
diff --git a/changelogs/unreleased/requires-input-fixture.yml b/changelogs/unreleased/requires-input-fixture.yml new file mode 100644 index 00000000000..be674499429 --- /dev/null +++ b/changelogs/unreleased/requires-input-fixture.yml @@ -0,0 +1,4 @@ +--- +title: Replace static fixture for behaviors/requires_input_spec.js +merge_request: 9162 +author: winniehell diff --git a/spec/javascripts/behaviors/requires_input_spec.js b/spec/javascripts/behaviors/requires_input_spec.js index a958ac76e66..631fca06514 100644 --- a/spec/javascripts/behaviors/requires_input_spec.js +++ b/spec/javascripts/behaviors/requires_input_spec.js @@ -4,18 +4,19 @@ require('~/behaviors/requires_input'); (function() { describe('requiresInput', function() { - preloadFixtures('static/behaviors/requires_input.html.raw'); + preloadFixtures('branches/new_branch.html.raw'); beforeEach(function() { - return loadFixtures('static/behaviors/requires_input.html.raw'); + loadFixtures('branches/new_branch.html.raw'); + this.submitButton = $('button[type="submit"]'); }); it('disables submit when any field is required', function() { $('.js-requires-input').requiresInput(); - return expect($('.submit')).toBeDisabled(); + return expect(this.submitButton).toBeDisabled(); }); it('enables submit when no field is required', function() { $('*[required=required]').removeAttr('required'); $('.js-requires-input').requiresInput(); - return expect($('.submit')).not.toBeDisabled(); + return expect(this.submitButton).not.toBeDisabled(); }); it('enables submit when all required fields are pre-filled', function() { $('*[required=required]').remove(); @@ -25,9 +26,9 @@ require('~/behaviors/requires_input'); it('enables submit when all required fields receive input', function() { $('.js-requires-input').requiresInput(); $('#required1').val('input1').change(); - expect($('.submit')).toBeDisabled(); + expect(this.submitButton).toBeDisabled(); $('#optional1').val('input1').change(); - expect($('.submit')).toBeDisabled(); + expect(this.submitButton).toBeDisabled(); $('#required2').val('input2').change(); $('#required3').val('input3').change(); $('#required4').val('input4').change(); diff --git a/spec/javascripts/fixtures/behaviors/requires_input.html.haml b/spec/javascripts/fixtures/behaviors/requires_input.html.haml deleted file mode 100644 index c3f905e912e..00000000000 --- a/spec/javascripts/fixtures/behaviors/requires_input.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -%form.js-requires-input - %input{type: 'text', id: 'required1', required: 'required'} - %input{type: 'text', id: 'required2', required: 'required'} - %input{type: 'text', id: 'required3', required: 'required', value: 'Pre-filled'} - %input{type: 'text', id: 'optional1'} - - %textarea{id: 'required4', required: 'required'} - %textarea{id: 'optional2'} - - %select{id: 'required5', required: 'required'} - %option Zero - %option{value: '1'} One - %select{id: 'optional3', required: 'required'} - %option Zero - %option{value: '1'} One - - %button.submit{type: 'submit', value: 'Submit'} - %input.submit{type: 'submit', value: 'Submit'} |