Skip to content
Snippets Groups Projects
Commit 5afe0331 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Preserve trailing new lines at the end of file on the online editor

Because Haml automatically indents the HTML source code, the contents
of whitespace-sensitive tags like pre and textarea can get screwed up.
parent b95f7b18
No related branches found
No related tags found
1 merge request!2099Preserve trailing new lines at the end of file on the online editor
Pipeline #
Loading
Loading
@@ -54,6 +54,7 @@ v 8.3.0 (unreleased)
- Suppress warning about missing `.gitlab-ci.yml` if builds are disabled
- Do not show build status unless builds are enabled and `.gitlab-ci.yml` is present
- Persist runners registration token in database
- Fix online editor should not remove newlines at the end of the file
 
v 8.2.3
- Fix application settings cache not expiring after changes (Stan Hu)
Loading
Loading
Loading
Loading
@@ -16,8 +16,7 @@
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'select2'
 
.file-content.code
%pre.js-edit-mode-pane#editor
= params[:content] || local_assigns[:blob_data]
%pre.js-edit-mode-pane#editor #{params[:content] || local_assigns[:blob_data]}
- if local_assigns[:path]
.js-edit-mode-pane#preview.hide
.center
Loading
Loading
Loading
Loading
@@ -34,6 +34,17 @@ Feature: Project Source Browse Files
Then I am redirected to the new file
And I should see its new content
 
@javascript
Scenario: I can create and commit file with new lines at the end of file
Given I click on "New file" link in repo
And I edit code with new lines at end of file
And I fill the new file name
And I fill the commit message
And I click on "Commit Changes"
Then I am redirected to the new file
And I click button "Edit"
And I should see its content with new lines preserved at end of file
@javascript
Scenario: I can upload file and commit
Given I click on "Upload file" link in repo
Loading
Loading
Loading
Loading
@@ -37,6 +37,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
expect(page).to have_content new_gitignore_content
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"
end
step 'I click link "Raw"' do
click_link 'Raw'
end
Loading
Loading
@@ -62,6 +66,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
set_new_content
end
 
step 'I edit code with new lines at end of file' do
execute_script('blob.editor.setValue("Sample\n\n\n")')
end
step 'I fill the new file name' do
fill_in :file_name, with: new_file_name
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment