gitlab-org--gitlab-foss/spec/features/issues/markdown_toolbar_spec.rb

36 lines
952 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
2016-12-19 10:26:10 -05:00
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) }
2016-12-19 10:26:10 -05:00
before do
sign_in(user)
2016-12-19 10:26:10 -05: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
fill_in 'Comment', with: "test\nbold"
2016-12-19 10:26:10 -05:00
page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 9)')
2016-12-19 10:26:10 -05:00
click_button 'Add bold text'
2016-12-19 10:26:10 -05:00
expect(find_field('Comment').value).to eq("test\n**bold**\n")
2016-12-19 10:26:10 -05:00
end
it "doesn't include first new line when adding underline" do
fill_in 'Comment', with: "test\nunderline"
2016-12-19 10:26:10 -05:00
page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 50)')
2016-12-19 10:26:10 -05:00
click_button 'Add italic text'
2016-12-19 10:26:10 -05:00
expect(find_field('Comment').value).to eq("test\n_underline_\n")
2016-12-19 10:26:10 -05:00
end
end