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.
This commit is contained in:
parent
b95f7b1864
commit
5afe03315d
4 changed files with 21 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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…
Reference in a new issue