Gantt code cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4523 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-12-17 14:05:43 +00:00
parent 98c7c179ca
commit edc35d4d5b
3 changed files with 26 additions and 79 deletions

View File

@@ -216,10 +216,10 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
context "project" do
should "be rendered" do
assert_select "div.project_todo"
assert_select "div.project-line.starting"
assert_select "div.project-line.ending"
assert_select "div.label.project-name", /#{@project.name}/
assert_select "div.project.task_todo"
assert_select "div.project.starting"
assert_select "div.project.ending"
assert_select "div.label.project", /#{@project.name}/
end
end
@@ -310,7 +310,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
:tracker => @tracker,
:project => @project,
:done_ratio => 30,
:start_date => Date.yesterday,
:start_date => 1.week.ago.to_date,
:due_date => 1.week.from_now.to_date)
end
@@ -318,12 +318,12 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
context "todo line" do
should "start from the starting point on the left" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project_todo[style*=left:52px]"
assert_select "div.project.task_todo[style*=left:28px]", true, @response.body
end
should "be the total width of the project" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project_todo[style*=width:31px]"
assert_select "div.project.task_todo[style*=width:58px]", true, @response.body
end
end
@@ -331,24 +331,24 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
context "late line" do
should "start from the starting point on the left" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project_late[style*=left:52px]"
assert_select "div.project.task_late[style*=left:28px]", true, @response.body
end
should "be the total delayed width of the project" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project_late[style*=width:6px]"
assert_select "div.project.task_late[style*=width:30px]", true, @response.body
end
end
context "done line" do
should "start from the starting point on the left" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project_done[style*=left:52px]"
assert_select "div.project.task_done[style*=left:28px]", true, @response.body
end
should "Be the total done width of the project" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project_done[style*=left:52px]"
assert_select "div.project.task_done[style*=width:18px]", true, @response.body
end
end
@@ -358,12 +358,12 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
@gantt.instance_variable_set('@date_from', Date.today)
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-line.starting", false
assert_select "div.project.starting", false, @response.body
end
should "appear at the starting point" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-line.starting[style*=left:52px]"
assert_select "div.project.starting[style*=left:28px]", true, @response.body
end
end
@@ -373,13 +373,13 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
@gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date)
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-line.ending", false
assert_select "div.project.ending", false, @response.body
end
should "appear at the end of the date range" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-line.ending[style*=left:84px]"
assert_select "div.project.ending[style*=left:84px]", true, @response.body
end
end
@@ -388,17 +388,17 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
@gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date)
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-name", /#{@project.name}/
assert_select "div.project.label", /#{@project.name}/
end
should "show the project name" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-name", /#{@project.name}/
assert_select "div.project.label", /#{@project.name}/
end
should "show the percent complete" do
@response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project-name", /0%/
assert_select "div.project.label", /0%/
end
end
end