2016-12-19 10:26:10 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
feature 'Issue markdown toolbar', js: true do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, :public) }
|
2016-12-19 10:26:10 -05:00
|
|
|
let(:issue) { create(:issue, project: project) }
|
2017-07-26 17:49:06 -04:00
|
|
|
let(:user) { create(:user) }
|
2016-12-19 10:26:10 -05:00
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-12-19 10:26:10 -05:00
|
|
|
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-12-19 10:26:10 -05:00
|
|
|
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')
|
|
|
|
|
2017-01-06 05:02:16 -05:00
|
|
|
page.evaluate_script('document.querySelectorAll(".js-main-target-form #note_note")[0].setSelectionRange(4, 9)')
|
2016-12-19 10:26:10 -05:00
|
|
|
|
|
|
|
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')
|
|
|
|
|
2017-01-06 05:02:16 -05:00
|
|
|
page.evaluate_script('document.querySelectorAll(".js-main-target-form #note_note")[0].setSelectionRange(4, 50)')
|
2016-12-19 10:26:10 -05:00
|
|
|
|
|
|
|
find('.toolbar-btn:nth-child(2)').click
|
|
|
|
|
|
|
|
expect(find('#note_note')[:value]).to eq("test\n*underline*\n")
|
|
|
|
end
|
|
|
|
end
|