2017-08-17 22:00:37 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
feature 'Issue markdown toolbar', js: true do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_issue_path(project, issue)
|
2017-08-17 22:00:37 +05:30
|
|
|
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.querySelectorAll(".js-main-target-form #note_note")[0].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.querySelectorAll(".js-main-target-form #note_note")[0].setSelectionRange(4, 50)')
|
|
|
|
|
|
|
|
find('.toolbar-btn:nth-child(2)').click
|
|
|
|
|
|
|
|
expect(find('#note_note')[:value]).to eq("test\n*underline*\n")
|
|
|
|
end
|
|
|
|
end
|