debian-mirror-gitlab/spec/features/issues/markdown_toolbar_spec.rb

36 lines
952 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2017-08-17 22:00:37 +05:30
2020-06-23 00:09:42 +05:30
RSpec.describe 'Issue markdown toolbar', :js do
2021-04-29 21:17:54 +05:30
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(: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
2021-04-29 21:17:54 +05:30
fill_in 'Comment', with: "test\nbold"
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 9)')
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
click_button 'Add bold text'
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
expect(find_field('Comment').value).to eq("test\n**bold**\n")
2017-08-17 22:00:37 +05:30
end
it "doesn't include first new line when adding underline" do
2021-04-29 21:17:54 +05:30
fill_in 'Comment', with: "test\nunderline"
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 50)')
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
click_button 'Add italic text'
2017-08-17 22:00:37 +05:30
2021-04-29 21:17:54 +05:30
expect(find_field('Comment').value).to eq("test\n_underline_\n")
2017-08-17 22:00:37 +05:30
end
end