diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-26 01:25:23 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-26 01:25:23 +0000 |
commit | 113f8b5cf278ff32bd55bf63aafe11c3f5a085f1 (patch) | |
tree | 0f3fc20120aa01c3f32e53874dbb89d009220921 /test | |
parent | a679d19709cfbb935b18b66b779ac315b2d3f845 (diff) | |
download | redmine-113f8b5cf278ff32bd55bf63aafe11c3f5a085f1.tar.gz redmine-113f8b5cf278ff32bd55bf63aafe11c3f5a085f1.zip |
Adds a textual css class for issue priorities (#12216).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10720 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/enumerations.yml | 5 | ||||
-rw-r--r-- | test/unit/issue_priority_test.rb | 30 | ||||
-rw-r--r-- | test/unit/issue_test.rb | 7 |
3 files changed, 42 insertions, 0 deletions
diff --git a/test/fixtures/enumerations.yml b/test/fixtures/enumerations.yml index 2c4c82e90..23ea2b3aa 100644 --- a/test/fixtures/enumerations.yml +++ b/test/fixtures/enumerations.yml @@ -23,6 +23,7 @@ enumerations_004: type: IssuePriority active: true position: 1 + position_name: lowest enumerations_005: name: Normal id: 5 @@ -30,24 +31,28 @@ enumerations_005: is_default: true active: true position: 2 + position_name: default enumerations_006: name: High id: 6 type: IssuePriority active: true position: 3 + position_name: high3 enumerations_007: name: Urgent id: 7 type: IssuePriority active: true position: 4 + position_name: high2 enumerations_008: name: Immediate id: 8 type: IssuePriority active: true position: 5 + position_name: highest enumerations_009: name: Design id: 9 diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb index 96d58196c..642203301 100644 --- a/test/unit/issue_priority_test.rb +++ b/test/unit/issue_priority_test.rb @@ -73,4 +73,34 @@ class IssuePriorityTest < ActiveSupport::TestCase priority.expects(:reset_positions_in_list).once priority.move_to = 'higher' end + + def test_clear_position_names_should_set_position_names_to_nil + IssuePriority.clear_position_names + assert IssuePriority.all.all? {|priority| priority.position_name.nil?} + end + + def test_compute_position_names_with_default_priority + IssuePriority.clear_position_names + + IssuePriority.compute_position_names + assert_equal %w(lowest default high3 high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end + + def test_compute_position_names_without_default_priority_should_split_priorities + IssuePriority.clear_position_names + IssuePriority.update_all :is_default => false + + IssuePriority.compute_position_names + assert_equal %w(lowest low2 default high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end + + def test_adding_a_priority_should_update_position_names + priority = IssuePriority.create!(:name => 'New') + assert_equal %w(lowest default high4 high3 high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end + + def test_destroying_a_priority_should_update_position_names + IssuePriority.find_by_position_name('highest').destroy + assert_equal %w(lowest default high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end end diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 0c3085bb7..15e79bec4 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -1821,4 +1821,11 @@ class IssueTest < ActiveSupport::TestCase def test_journals_after_with_blank_arg_should_return_all_journals assert_equal [Journal.find(1), Journal.find(2)], Issue.find(1).journals_after('') end + + def test_css_classes_should_include_priority + issue = Issue.new(:priority => IssuePriority.find(8)) + classes = issue.css_classes.split(' ') + assert_include 'priority-8', classes + assert_include 'priority-highest', classes + end end |