diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-03-28 17:35:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-03-28 17:35:20 +0000 |
commit | 86eed08fbf4960737b43aa93db979781c54ac888 (patch) | |
tree | 2b86cd0ec9e625583b1747e0ad6bc0a94e7982a1 /test | |
parent | 927a6b045e74ea15918aec6389d8e8411d54a4c0 (diff) | |
download | redmine-86eed08fbf4960737b43aa93db979781c54ac888.tar.gz redmine-86eed08fbf4960737b43aa93db979781c54ac888.zip |
Fixes progress calculation on gantt (#7838).
Contributed by Etienne Massip.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5236 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/lib/redmine/helpers/gantt_test.rb | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb index 1f6d507b7..a32b41d27 100644 --- a/test/unit/lib/redmine/helpers/gantt_test.rb +++ b/test/unit/lib/redmine/helpers/gantt_test.rb @@ -547,9 +547,9 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase assert_select "div.version.task_done[style*=left:28px]", true, @response.body end - should "Be the total done width of the version" do + should "be the total done width of the version" do @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) - assert_select "div.version.task_done[style*=width:18px]", true, @response.body + assert_select "div.version.task_done[style*=width:16px]", true, @response.body end end @@ -707,9 +707,10 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase assert_select "div.task_done[style*=left:28px]", true, @response.body end - should "Be the total done width of the issue" do + should "be the total done width of the issue" do @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) - assert_select "div.task_done[style*=width:18px]", true, @response.body + # 15 days * 4 px * 30% - 2 px for borders = 16 px + assert_select "div.task_done[style*=width:16px]", true, @response.body end should "not be the total done width if the chart starts after issue start date" do @@ -717,7 +718,24 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) assert_select "div.task_done[style*=left:0px]", true, @response.body - assert_select "div.task_done[style*=width:10px]", true, @response.body + assert_select "div.task_done[style*=width:8px]", true, @response.body + end + + context "for completed issue" do + setup do + @issue.done_ratio = 100 + end + + should "be the total width of the issue" do + @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) + assert_select "div.task_done[style*=width:58px]", true, @response.body + end + + should "be the total width of the issue with due_date=start_date" do + @issue.due_date = @issue.start_date + @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) + assert_select "div.task_done[style*=width:2px]", true, @response.body + end end end |