summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/helpers/journals_helper_test.rb17
-rw-r--r--test/helpers/reactions_helper_test.rb4
-rw-r--r--test/system/reactions_test.rb41
-rw-r--r--test/unit/lib/redmine/field_format/progressbar_format_test.rb12
4 files changed, 72 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)
diff --git a/test/unit/lib/redmine/field_format/progressbar_format_test.rb b/test/unit/lib/redmine/field_format/progressbar_format_test.rb
index 51bd8bc5f..6e0df724d 100644
--- a/test/unit/lib/redmine/field_format/progressbar_format_test.rb
+++ b/test/unit/lib/redmine/field_format/progressbar_format_test.rb
@@ -116,5 +116,17 @@ module Redmine::FieldFormat
end
end
end
+
+ def test_formatted_value_with_html_true
+ expected = progress_bar(50)
+ formatted = @format.formatted_value(self, @field, 50, Issue.new, true)
+ assert_equal expected, formatted
+ assert formatted.html_safe?
+ end
+
+ def test_formatted_value_with_html_false
+ formatted = @format.formatted_value(self, @field, 50, Issue.new, false)
+ assert_equal '50', formatted
+ end
end
end