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
This commit is contained in:
Vendored
+5
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user