diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-01-05 20:54:27 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-01-05 20:54:27 +0000 |
commit | 297e6e29f2eb76d67fc82538dd38e230f79787e2 (patch) | |
tree | ba90a52355c4484e95c82d1a6b7573755ce78b0d /spec | |
parent | 32b1ceb03677a7484bf10412fbe67ad94b57d51c (diff) | |
parent | a713a29aadd2908c0ad7079f5b24033736a96d9c (diff) | |
download | gitlab-ce-297e6e29f2eb76d67fc82538dd38e230f79787e2.tar.gz |
Merge branch 'markdown-button-newline-bug-fix' into 'master'
Fixed new line being included in bold/italic in GFM form
Closes #25456
See merge request !8086
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/issues/markdown_toolbar_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb new file mode 100644 index 00000000000..6ad4d4adbed --- /dev/null +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -0,0 +1,37 @@ +require 'rails_helper' + +feature 'Issue markdown toolbar', feature: true, js: true do + let(:project) { create(:project, :public) } + let(:issue) { create(:issue, project: project) } + let(:user) { create(:user) } + + before do + login_as(user) + + visit namespace_project_issue_path(project.namespace, project, issue) + end + + it "doesn't include first new line when adding bold" do + find('#note_note').native.send_keys('test') + find('#note_note').native.send_key(:enter) + find('#note_note').native.send_keys('bold') + + page.evaluate_script('document.getElementById("note_note").setSelectionRange(4, 9)') + + first('.toolbar-btn').click + + expect(find('#note_note')[:value]).to eq("test\n**bold**\n") + end + + it "doesn't include first new line when adding underline" do + find('#note_note').native.send_keys('test') + find('#note_note').native.send_key(:enter) + find('#note_note').native.send_keys('underline') + + page.evaluate_script('document.getElementById("note_note").setSelectionRange(4, 50)') + + find('.toolbar-btn:nth-child(2)').click + + expect(find('#note_note')[:value]).to eq("test\n*underline*\n") + end +end |