blob: aad5d319bc45e7e9752aa5618b96da218bfa59b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Issue markdown toolbar', :js do
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
visit project_issue_path(project, issue)
end
it "doesn't include first new line when adding bold" do
fill_in 'Comment', with: "test\nbold"
page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 9)')
click_button 'Add bold text'
expect(find_field('Comment').value).to eq("test\n**bold**\n")
end
it "doesn't include first new line when adding underline" do
fill_in 'Comment', with: "test\nunderline"
page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 50)')
click_button 'Add italic text'
expect(find_field('Comment').value).to eq("test\n_underline_\n")
end
end
|