summaryrefslogtreecommitdiff
path: root/spec/features/issues
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-12-19 15:26:10 +0000
committerPhil Hughes <me@iamphill.com>2016-12-21 11:32:41 +0000
commita713a29aadd2908c0ad7079f5b24033736a96d9c (patch)
treec2773cf4a9819043a555f6dd8b25499210e40454 /spec/features/issues
parentfecebc7991283e5f9aff89119bb2e4dcde9deeab (diff)
downloadgitlab-ce-a713a29aadd2908c0ad7079f5b24033736a96d9c.tar.gz
Fixed first newline not workingmarkdown-button-newline-bug-fix
Diffstat (limited to 'spec/features/issues')
-rw-r--r--spec/features/issues/markdown_toolbar_spec.rb37
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