diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-08-18 19:10:27 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-08-18 23:48:11 +0300 |
commit | 8db088ccc726996bdcda74373d9ce855dedf5bd5 (patch) | |
tree | a712322a254a7032fefcf215dcb0306a339a422c | |
parent | 0baaf490e289adb36ef7145a57f75cdab05eb01c (diff) |
Don't use global variables.
-rw-r--r-- | app/assets/javascripts/blob_edit/blob_edit_bundle.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/snippet/snippet_bundle.js | 2 | ||||
-rw-r--r-- | features/steps/project/source/browse_files.rb | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/app/assets/javascripts/blob_edit/blob_edit_bundle.js b/app/assets/javascripts/blob_edit/blob_edit_bundle.js index 99034a7678f..2afef43f3d6 100644 --- a/app/assets/javascripts/blob_edit/blob_edit_bundle.js +++ b/app/assets/javascripts/blob_edit/blob_edit_bundle.js @@ -2,10 +2,10 @@ (function() { $(function() { - url = $(".js-edit-blob-form").data("relative-url-root"); + var url = $(".js-edit-blob-form").data("relative-url-root"); url += $(".js-edit-blob-form").data("assets-prefix"); - blob = new EditBlob(url, $('.js-edit-blob-form').data('blob-language')); + var blob = new EditBlob(url, $('.js-edit-blob-form').data('blob-language')); new NewCommitForm($('.js-edit-blob-form')); }); diff --git a/app/assets/javascripts/snippet/snippet_bundle.js b/app/assets/javascripts/snippet/snippet_bundle.js index 093f266059d..855e97eb301 100644 --- a/app/assets/javascripts/snippet/snippet_bundle.js +++ b/app/assets/javascripts/snippet/snippet_bundle.js @@ -2,7 +2,7 @@ (function() { $(function() { - editor = ace.edit("editor") + var editor = ace.edit("editor") $(".snippet-form-holder form").on('submit', function() { $(".snippet-file-content").val(editor.getValue()); diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 841d191d55b..bb79424ee08 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -44,7 +44,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I should see its content with new lines preserved at end of file' do - expect(evaluate_script('blob.editor.getValue()')).to eq "Sample\n\n\n" + expect(evaluate_script('ace.edit("editor").getValue()')).to eq "Sample\n\n\n" end step 'I click link "Raw"' do @@ -65,7 +65,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I can edit code' do set_new_content - expect(evaluate_script('blob.editor.getValue()')).to eq new_gitignore_content + expect(evaluate_script('ace.edit("editor").getValue()')).to eq new_gitignore_content end step 'I edit code' do @@ -74,7 +74,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I edit code with new lines at end of file' do - execute_script('blob.editor.setValue("Sample\n\n\n")') + execute_script('ace.edit("editor").setValue("Sample\n\n\n")') end step 'I fill the new file name' do @@ -378,7 +378,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps private def set_new_content - execute_script("blob.editor.setValue('#{new_gitignore_content}')") + execute_script("ace.edit('editor').setValue('#{new_gitignore_content}')") end # Content of the gitignore file on the seed repository. |