chris@22: # redMine - project management software chris@22: # Copyright (C) 2006-2008 Jean-Philippe Lang chris@22: # chris@22: # This program is free software; you can redistribute it and/or chris@22: # modify it under the terms of the GNU General Public License chris@22: # as published by the Free Software Foundation; either version 2 chris@22: # of the License, or (at your option) any later version. chris@22: # chris@22: # This program is distributed in the hope that it will be useful, chris@22: # but WITHOUT ANY WARRANTY; without even the implied warranty of chris@22: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the chris@22: # GNU General Public License for more details. chris@22: # chris@22: # You should have received a copy of the GNU General Public License chris@22: # along with this program; if not, write to the Free Software chris@22: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. chris@22: chris@22: require File.dirname(__FILE__) + '/../../../../test_helper' chris@22: chris@22: class Redmine::Helpers::GanttTest < ActiveSupport::TestCase chris@22: # Utility methods and classes so assert_select can be used. chris@22: class GanttViewTest < ActionView::Base chris@22: include ActionView::Helpers::UrlHelper chris@22: include ActionView::Helpers::TextHelper chris@22: include ActionController::UrlWriter chris@22: include ApplicationHelper chris@22: include ProjectsHelper chris@22: include IssuesHelper chris@22: chris@22: def self.default_url_options chris@22: {:only_path => true } chris@22: end chris@22: chris@22: end chris@22: chris@22: include ActionController::Assertions::SelectorAssertions chris@22: chris@22: def setup chris@22: @response = ActionController::TestResponse.new chris@22: # Fixtures chris@22: ProjectCustomField.delete_all chris@22: Project.destroy_all chris@22: chris@22: User.current = User.find(1) chris@22: end chris@22: chris@22: def build_view chris@22: @view = GanttViewTest.new chris@22: end chris@22: chris@22: def html_document chris@22: HTML::Document.new(@response.body) chris@22: end chris@22: chris@22: # Creates a Gantt chart for a 4 week span chris@22: def create_gantt(project=Project.generate!) chris@22: @project = project chris@22: @gantt = Redmine::Helpers::Gantt.new chris@22: @gantt.project = @project chris@22: @gantt.query = Query.generate_default!(:project => @project) chris@22: @gantt.view = build_view chris@22: @gantt.instance_variable_set('@date_from', 2.weeks.ago.to_date) chris@22: @gantt.instance_variable_set('@date_to', 2.weeks.from_now.to_date) chris@22: end chris@22: chris@22: context "#number_of_rows" do chris@22: chris@22: context "with one project" do chris@22: should "return the number of rows just for that project" chris@22: end chris@22: chris@22: context "with no project" do chris@22: should "return the total number of rows for all the projects, resursively" chris@22: end chris@22: chris@22: end chris@22: chris@22: context "#number_of_rows_on_project" do chris@22: setup do chris@22: create_gantt chris@22: end chris@22: chris@22: should "clear the @query.project so cross-project issues and versions can be counted" do chris@22: assert @gantt.query.project chris@22: @gantt.number_of_rows_on_project(@project) chris@22: assert_nil @gantt.query.project chris@22: end chris@22: chris@22: should "count 1 for the project itself" do chris@22: assert_equal 1, @gantt.number_of_rows_on_project(@project) chris@22: end chris@22: chris@22: should "count the number of issues without a version" do chris@22: @project.issues << Issue.generate_for_project!(@project, :fixed_version => nil) chris@22: assert_equal 2, @gantt.number_of_rows_on_project(@project) chris@22: end chris@22: chris@22: should "count the number of versions" do chris@22: @project.versions << Version.generate! chris@22: @project.versions << Version.generate! chris@22: assert_equal 3, @gantt.number_of_rows_on_project(@project) chris@22: end chris@22: chris@22: should "count the number of issues on versions, including cross-project" do chris@22: version = Version.generate! chris@22: @project.versions << version chris@22: @project.issues << Issue.generate_for_project!(@project, :fixed_version => version) chris@22: chris@22: assert_equal 3, @gantt.number_of_rows_on_project(@project) chris@22: end chris@22: chris@22: should "recursive and count the number of rows on each subproject" do chris@22: @project.versions << Version.generate! # +1 chris@22: chris@22: @subproject = Project.generate!(:enabled_module_names => ['issue_tracking']) # +1 chris@22: @subproject.set_parent!(@project) chris@22: @subproject.issues << Issue.generate_for_project!(@subproject) # +1 chris@22: @subproject.issues << Issue.generate_for_project!(@subproject) # +1 chris@22: chris@22: @subsubproject = Project.generate!(:enabled_module_names => ['issue_tracking']) # +1 chris@22: @subsubproject.set_parent!(@subproject) chris@22: @subsubproject.issues << Issue.generate_for_project!(@subsubproject) # +1 chris@22: chris@22: assert_equal 7, @gantt.number_of_rows_on_project(@project) # +1 for self chris@22: end chris@22: end chris@22: chris@22: # TODO: more of an integration test chris@22: context "#subjects" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: @version = Version.generate!(:effective_date => 1.week.from_now.to_date, :sharing => 'none') chris@22: @project.versions << @version chris@22: chris@22: @issue = Issue.generate!(:fixed_version => @version, chris@22: :subject => "gantt#line_for_project", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :done_ratio => 30, chris@22: :start_date => Date.yesterday, chris@22: :due_date => 1.week.from_now.to_date) chris@22: @project.issues << @issue chris@22: chris@22: @response.body = @gantt.subjects chris@22: end chris@22: chris@22: context "project" do chris@22: should "be rendered" do chris@22: assert_select "div.project-name a", /#{@project.name}/ chris@22: end chris@22: chris@22: should "have an indent of 4" do chris@22: assert_select "div.project-name[style*=left:4px]" chris@22: end chris@22: end chris@22: chris@22: context "version" do chris@22: should "be rendered" do chris@22: assert_select "div.version-name a", /#{@version.name}/ chris@22: end chris@22: chris@22: should "be indented 24 (one level)" do chris@22: assert_select "div.version-name[style*=left:24px]" chris@22: end chris@22: end chris@22: chris@22: context "issue" do chris@22: should "be rendered" do chris@22: assert_select "div.issue-subject", /#{@issue.subject}/ chris@22: end chris@22: chris@22: should "be indented 44 (two levels)" do chris@22: assert_select "div.issue-subject[style*=left:44px]" chris@22: end chris@22: end chris@22: end chris@22: chris@22: context "#lines" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: @version = Version.generate!(:effective_date => 1.week.from_now.to_date) chris@22: @project.versions << @version chris@22: @issue = Issue.generate!(:fixed_version => @version, chris@22: :subject => "gantt#line_for_project", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :done_ratio => 30, chris@22: :start_date => Date.yesterday, chris@22: :due_date => 1.week.from_now.to_date) chris@22: @project.issues << @issue chris@22: chris@22: @response.body = @gantt.lines chris@22: end chris@22: chris@22: context "project" do chris@22: should "be rendered" do chris@22: assert_select "div.project_todo" chris@22: assert_select "div.project-line.starting" chris@22: assert_select "div.project-line.ending" chris@22: assert_select "div.label.project-name", /#{@project.name}/ chris@22: end chris@22: end chris@22: chris@22: context "version" do chris@22: should "be rendered" do chris@22: assert_select "div.milestone_todo" chris@22: assert_select "div.milestone.starting" chris@22: assert_select "div.milestone.ending" chris@22: assert_select "div.label.version-name", /#{@version.name}/ chris@22: end chris@22: end chris@22: chris@22: context "issue" do chris@22: should "be rendered" do chris@22: assert_select "div.task_todo" chris@22: assert_select "div.label.issue-name", /#{@issue.done_ratio}/ chris@22: assert_select "div.tooltip", /#{@issue.subject}/ chris@22: end chris@22: end chris@22: end chris@22: chris@22: context "#render_project" do chris@22: should "be tested" chris@22: end chris@22: chris@22: context "#render_issues" do chris@22: should "be tested" chris@22: end chris@22: chris@22: context "#render_version" do chris@22: should "be tested" chris@22: end chris@22: chris@22: context "#subject_for_project" do chris@22: setup do chris@22: create_gantt chris@22: end chris@22: chris@22: context ":html format" do chris@22: should "add an absolute positioned div" do chris@22: @response.body = @gantt.subject_for_project(@project, {:format => :html}) chris@22: assert_select "div[style*=absolute]" chris@22: end chris@22: chris@22: should "use the indent option to move the div to the right" do chris@22: @response.body = @gantt.subject_for_project(@project, {:format => :html, :indent => 40}) chris@22: assert_select "div[style*=left:40]" chris@22: end chris@22: chris@22: should "include the project name" do chris@22: @response.body = @gantt.subject_for_project(@project, {:format => :html}) chris@22: assert_select 'div', :text => /#{@project.name}/ chris@22: end chris@22: chris@22: should "include a link to the project" do chris@22: @response.body = @gantt.subject_for_project(@project, {:format => :html}) chris@22: assert_select 'a[href=?]', "/projects/#{@project.identifier}", :text => /#{@project.name}/ chris@22: end chris@22: chris@22: should "style overdue projects" do chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @project.versions << Version.generate!(:effective_date => Date.yesterday) chris@22: chris@22: assert @project.overdue?, "Need an overdue project for this test" chris@22: @response.body = @gantt.subject_for_project(@project, {:format => :html}) chris@22: chris@22: assert_select 'div span.project-overdue' chris@22: end chris@22: chris@22: chris@22: end chris@22: chris@22: should "test the PNG format" chris@22: should "test the PDF format" chris@22: end chris@22: chris@22: context "#line_for_project" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: @version = Version.generate!(:effective_date => Date.yesterday) chris@22: @project.versions << @version chris@22: chris@22: @project.issues << Issue.generate!(:fixed_version => @version, chris@22: :subject => "gantt#line_for_project", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :done_ratio => 30, chris@22: :start_date => Date.yesterday, chris@22: :due_date => 1.week.from_now.to_date) chris@22: end chris@22: chris@22: context ":html format" do chris@22: context "todo line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project_todo[style*=left:52px]" chris@22: end chris@22: chris@22: should "be the total width of the project" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project_todo[style*=width:31px]" chris@22: end chris@22: chris@22: end chris@22: chris@22: context "late line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project_late[style*=left:52px]" chris@22: end chris@22: chris@22: should "be the total delayed width of the project" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project_late[style*=width:6px]" chris@22: end chris@22: end chris@22: chris@22: context "done line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project_done[style*=left:52px]" chris@22: end chris@22: chris@22: should "Be the total done width of the project" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project_done[style*=left:52px]" chris@22: end chris@22: end chris@22: chris@22: context "starting marker" do chris@22: should "not appear if the starting point is off the gantt chart" do chris@22: # Shift the date range of the chart chris@22: @gantt.instance_variable_set('@date_from', Date.today) chris@22: chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-line.starting", false chris@22: end chris@22: chris@22: should "appear at the starting point" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-line.starting[style*=left:52px]" chris@22: end chris@22: end chris@22: chris@22: context "ending marker" do chris@22: should "not appear if the starting point is off the gantt chart" do chris@22: # Shift the date range of the chart chris@22: @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) chris@22: chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-line.ending", false chris@22: chris@22: end chris@22: chris@22: should "appear at the end of the date range" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-line.ending[style*=left:84px]" chris@22: end chris@22: end chris@22: chris@22: context "status content" do chris@22: should "appear at the far left, even if it's far in the past" do chris@22: @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) chris@22: chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-name", /#{@project.name}/ chris@22: end chris@22: chris@22: should "show the project name" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-name", /#{@project.name}/ chris@22: end chris@22: chris@22: should "show the percent complete" do chris@22: @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) chris@22: assert_select "div.project-name", /0%/ chris@22: end chris@22: end chris@22: end chris@22: chris@22: should "test the PNG format" chris@22: should "test the PDF format" chris@22: end chris@22: chris@22: context "#subject_for_version" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: @version = Version.generate!(:effective_date => Date.yesterday) chris@22: @project.versions << @version chris@22: chris@22: @project.issues << Issue.generate!(:fixed_version => @version, chris@22: :subject => "gantt#subject_for_version", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :start_date => Date.today) chris@22: chris@22: end chris@22: chris@22: context ":html format" do chris@22: should "add an absolute positioned div" do chris@22: @response.body = @gantt.subject_for_version(@version, {:format => :html}) chris@22: assert_select "div[style*=absolute]" chris@22: end chris@22: chris@22: should "use the indent option to move the div to the right" do chris@22: @response.body = @gantt.subject_for_version(@version, {:format => :html, :indent => 40}) chris@22: assert_select "div[style*=left:40]" chris@22: end chris@22: chris@22: should "include the version name" do chris@22: @response.body = @gantt.subject_for_version(@version, {:format => :html}) chris@22: assert_select 'div', :text => /#{@version.name}/ chris@22: end chris@22: chris@22: should "include a link to the version" do chris@22: @response.body = @gantt.subject_for_version(@version, {:format => :html}) chris@22: assert_select 'a[href=?]', Regexp.escape("/versions/show/#{@version.to_param}"), :text => /#{@version.name}/ chris@22: end chris@22: chris@22: should "style late versions" do chris@22: assert @version.overdue?, "Need an overdue version for this test" chris@22: @response.body = @gantt.subject_for_version(@version, {:format => :html}) chris@22: chris@22: assert_select 'div span.version-behind-schedule' chris@22: end chris@22: chris@22: should "style behind schedule versions" do chris@22: assert @version.behind_schedule?, "Need a behind schedule version for this test" chris@22: @response.body = @gantt.subject_for_version(@version, {:format => :html}) chris@22: chris@22: assert_select 'div span.version-behind-schedule' chris@22: end chris@22: end chris@22: should "test the PNG format" chris@22: should "test the PDF format" chris@22: end chris@22: chris@22: context "#line_for_version" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: @version = Version.generate!(:effective_date => 1.week.from_now.to_date) chris@22: @project.versions << @version chris@22: chris@22: @project.issues << Issue.generate!(:fixed_version => @version, chris@22: :subject => "gantt#line_for_project", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :done_ratio => 30, chris@22: :start_date => Date.yesterday, chris@22: :due_date => 1.week.from_now.to_date) chris@22: end chris@22: chris@22: context ":html format" do chris@22: context "todo line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone_todo[style*=left:52px]" chris@22: end chris@22: chris@22: should "be the total width of the version" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone_todo[style*=width:31px]" chris@22: end chris@22: chris@22: end chris@22: chris@22: context "late line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone_late[style*=left:52px]" chris@22: end chris@22: chris@22: should "be the total delayed width of the version" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone_late[style*=width:6px]" chris@22: end chris@22: end chris@22: chris@22: context "done line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone_done[style*=left:52px]" chris@22: end chris@22: chris@22: should "Be the total done width of the version" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone_done[style*=left:52px]" chris@22: end chris@22: end chris@22: chris@22: context "starting marker" do chris@22: should "not appear if the starting point is off the gantt chart" do chris@22: # Shift the date range of the chart chris@22: @gantt.instance_variable_set('@date_from', Date.today) chris@22: chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone.starting", false chris@22: end chris@22: chris@22: should "appear at the starting point" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone.starting[style*=left:52px]" chris@22: end chris@22: end chris@22: chris@22: context "ending marker" do chris@22: should "not appear if the starting point is off the gantt chart" do chris@22: # Shift the date range of the chart chris@22: @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) chris@22: chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone.ending", false chris@22: chris@22: end chris@22: chris@22: should "appear at the end of the date range" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.milestone.ending[style*=left:84px]" chris@22: end chris@22: end chris@22: chris@22: context "status content" do chris@22: should "appear at the far left, even if it's far in the past" do chris@22: @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) chris@22: chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.version-name", /#{@version.name}/ chris@22: end chris@22: chris@22: should "show the version name" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.version-name", /#{@version.name}/ chris@22: end chris@22: chris@22: should "show the percent complete" do chris@22: @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) chris@22: assert_select "div.version-name", /30%/ chris@22: end chris@22: end chris@22: end chris@22: chris@22: should "test the PNG format" chris@22: should "test the PDF format" chris@22: end chris@22: chris@22: context "#subject_for_issue" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: chris@22: @issue = Issue.generate!(:subject => "gantt#subject_for_issue", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :start_date => 3.days.ago.to_date, chris@22: :due_date => Date.yesterday) chris@22: @project.issues << @issue chris@22: chris@22: end chris@22: chris@22: context ":html format" do chris@22: should "add an absolute positioned div" do chris@22: @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) chris@22: assert_select "div[style*=absolute]" chris@22: end chris@22: chris@22: should "use the indent option to move the div to the right" do chris@22: @response.body = @gantt.subject_for_issue(@issue, {:format => :html, :indent => 40}) chris@22: assert_select "div[style*=left:40]" chris@22: end chris@22: chris@22: should "include the issue subject" do chris@22: @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) chris@22: assert_select 'div', :text => /#{@issue.subject}/ chris@22: end chris@22: chris@22: should "include a link to the issue" do chris@22: @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) chris@22: assert_select 'a[href=?]', Regexp.escape("/issues/#{@issue.to_param}"), :text => /#{@tracker.name} ##{@issue.id}/ chris@22: end chris@22: chris@22: should "style overdue issues" do chris@22: assert @issue.overdue?, "Need an overdue issue for this test" chris@22: @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) chris@22: chris@22: assert_select 'div span.issue-overdue' chris@22: end chris@22: chris@22: end chris@22: should "test the PNG format" chris@22: should "test the PDF format" chris@22: end chris@22: chris@22: context "#line_for_issue" do chris@22: setup do chris@22: create_gantt chris@22: @project.enabled_module_names = [:issue_tracking] chris@22: @tracker = Tracker.generate! chris@22: @project.trackers << @tracker chris@22: @version = Version.generate!(:effective_date => 1.week.from_now.to_date) chris@22: @project.versions << @version chris@22: @issue = Issue.generate!(:fixed_version => @version, chris@22: :subject => "gantt#line_for_project", chris@22: :tracker => @tracker, chris@22: :project => @project, chris@22: :done_ratio => 30, chris@22: :start_date => Date.yesterday, chris@22: :due_date => 1.week.from_now.to_date) chris@22: @project.issues << @issue chris@22: end chris@22: chris@22: context ":html format" do chris@22: context "todo line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.task_todo[style*=left:52px]" chris@22: end chris@22: chris@22: should "be the total width of the issue" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.task_todo[style*=width:34px]" chris@22: end chris@22: chris@22: end chris@22: chris@22: context "late line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.task_late[style*=left:52px]" chris@22: end chris@22: chris@22: should "be the total delayed width of the issue" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.task_late[style*=width:6px]" chris@22: end chris@22: end chris@22: chris@22: context "done line" do chris@22: should "start from the starting point on the left" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.task_done[style*=left:52px]" chris@22: end chris@22: chris@22: should "Be the total done width of the issue" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.task_done[style*=left:52px]" chris@22: end chris@22: end chris@22: chris@22: context "status content" do chris@22: should "appear at the far left, even if it's far in the past" do chris@22: @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) chris@22: chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.issue-name" chris@22: end chris@22: chris@22: should "show the issue status" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.issue-name", /#{@issue.status.name}/ chris@22: end chris@22: chris@22: should "show the percent complete" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.issue-name", /30%/ chris@22: end chris@22: end chris@22: end chris@22: chris@22: should "have an issue tooltip" do chris@22: @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) chris@22: assert_select "div.tooltip", /#{@issue.subject}/ chris@22: end chris@22: chris@22: should "test the PNG format" chris@22: should "test the PDF format" chris@22: end chris@22: chris@22: context "#to_image" do chris@22: should "be tested" chris@22: end chris@22: chris@22: context "#to_pdf" do chris@22: should "be tested" chris@22: end chris@22: chris@22: end