Skip to content

Commit

Permalink
add rich-text tests publiclab#8478
Browse files Browse the repository at this point in the history
  • Loading branch information
noi5e committed Jan 14, 2021
1 parent a3c8796 commit 789361d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/system/comment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,37 @@ def get_path(page_type, path)
assert_selector('.btn[data-original-title="Help"]', count: 1)
end

test "#{page_type_string}: IMMEDIATE rich-text input works in MAIN form" do
visit get_path(page_type, nodes(node_name).path)
main_comment_form = page.find('h4', text: /Post comment|Post Comment/).find(:xpath, '..') # title text on wikis is 'Post comment'
main_comment_form.find("[data-original-title='Bold']").click
text_input_value = main_comment_form.find('#text-input').value
assert_equal(text_input_value, '****')
end

test "#{page_type_string}: rich-text input into REPLY form isn't CROSS-WIRED with EDIT form" do
nodes(node_name).add_comment({
uid: 5,
body: comment_text
})
nodes(node_name).add_comment({
uid: 2,
body: comment_text
})
visit get_path(page_type, nodes(node_name).path)
# open up the edit comment form
page.find("#edit-comment-btn").click
# find the EDIT id
edit_comment_form_id = page.find('h4', text: 'Edit comment').find(:xpath, '..')[:id]
# open up the reply comment form
page.all('p', text: 'Reply to this comment...')[1].click
page.all("[data-original-title='Bold']")[0].click
reply_input_value = page.find('[id^=text-input-reply-]').value
edit_input_value = page.find('#' + edit_comment_form_id + ' textarea').value
assert_equal(comment_text, edit_input_value)
assert_equal('****', reply_input_value)
end

test "#{page_type_string}: edit comment" do
nodes(node_name).add_comment({
uid: 2,
Expand Down

0 comments on commit 789361d

Please sign in to comment.