diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers/journals_helper_test.rb | 17 | ||||
-rw-r--r-- | test/helpers/reactions_helper_test.rb | 4 | ||||
-rw-r--r-- | test/system/reactions_test.rb | 41 |
3 files changed, 60 insertions, 2 deletions
diff --git a/test/helpers/journals_helper_test.rb b/test/helpers/journals_helper_test.rb index 355d5ec6f..b8ecec685 100644 --- a/test/helpers/journals_helper_test.rb +++ b/test/helpers/journals_helper_test.rb @@ -51,6 +51,23 @@ class JournalsHelperTest < Redmine::HelperTest assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit' assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-del"]' assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-copy-link"]' + assert_select_in journal_actions, 'span.reaction-button-wrapper' + end + + def test_render_journal_actions_with_journal_without_notes + User.current = User.find(1) + issue = Issue.find(1) + issue.journals.first.update!(notes: '') + + journals = issue.visible_journals_with_index + + journal_actions = render_journal_actions(issue, journals.first, reply_links: true) + + assert_select_in journal_actions, 'span.reaction-button-wrapper' + assert_select_in journal_actions, 'span.drdn' + + assert_select_in journal_actions, 'a[class="icon-comment"]', false + assert_select_in journal_actions, 'a[class="icon-edit"]', false end def test_journal_thumbnail_attachments_should_be_in_the_same_order_as_the_journal_details diff --git a/test/helpers/reactions_helper_test.rb b/test/helpers/reactions_helper_test.rb index f2eb04b6d..1c5c82418 100644 --- a/test/helpers/reactions_helper_test.rb +++ b/test/helpers/reactions_helper_test.rb @@ -172,7 +172,7 @@ class ReactionsHelperTest < ActionView::TestCase end tooltip = 'Dave Lopper, John Smith, and Redmine Admin' - assert_select_in result, 'span[data-reaction-button-id=?]', 'reaction_issue_1' do + assert_select_in result, 'span.reaction-button-wrapper[data-reaction-button-id=?]', 'reaction_issue_1' do href = reaction_path(issue.reaction_detail.user_reaction, object_type: 'Issue', object_id: 1) assert_select 'a.icon.reaction-button.reacted[href=?]', href do @@ -194,7 +194,7 @@ class ReactionsHelperTest < ActionView::TestCase end tooltip = 'Dave Lopper, John Smith, and Redmine Admin' - assert_select_in result, 'span[data-reaction-button-id=?]', 'reaction_issue_1' do + assert_select_in result, 'span.reaction-button-wrapper[data-reaction-button-id=?]', 'reaction_issue_1' do href = reactions_path(object_type: 'Issue', object_id: 1) assert_select 'a.icon.reaction-button[href=?]', href do diff --git a/test/system/reactions_test.rb b/test/system/reactions_test.rb index 8cf849320..cd3e2e871 100644 --- a/test/system/reactions_test.rb +++ b/test/system/reactions_test.rb @@ -113,6 +113,47 @@ class ReactionsSystemTest < ApplicationSystemTestCase end end + def test_reaction_button_is_visible_on_property_changes_tab + # Create a journal with no notes + journal_without_notes = Journal.generate!(journalized: issues(:issues_001), notes: '', details: [JournalDetail.new]) + + log_user('jsmith', 'jsmith') + + visit '/issues/1?tab=properties' + + # Scroll to the history content + click_link '#1' + + assert_selector '#tab-properties.selected' + + within('#change-1') do + assert_selector 'a.reaction-button' + + assert_no_selector 'a.icon-comment' + assert_no_selector 'span.drdn' + end + within("#change-#{journal_without_notes.id}") do + assert_selector 'a.reaction-button' + + assert_no_selector '.drdn' + end + + click_link 'History' + + within('#change-1') do + assert_selector 'a.reaction-button' + + assert_selector 'a.icon-comment' + assert_selector 'span.drdn' + end + within("#change-#{journal_without_notes.id}") do + assert_selector 'a.reaction-button' + assert_selector 'span.drdn' + + assert_no_selector 'a.icon-comment' + end + end + private def assert_reaction_add_and_remove(reaction_button, expected_subject) |