Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-12-19 18:26:10 +0300
committerPhil Hughes <me@iamphill.com>2016-12-21 14:32:41 +0300
commita713a29aadd2908c0ad7079f5b24033736a96d9c (patch)
treec2773cf4a9819043a555f6dd8b25499210e40454 /spec/features/issues/markdown_toolbar_spec.rb
parentfecebc7991283e5f9aff89119bb2e4dcde9deeab (diff)
Fixed first newline not working
Diffstat (limited to 'spec/features/issues/markdown_toolbar_spec.rb')
-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