@@ -5,12 +5,12 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
@@ -26,7 +26,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
26 | include ApplicationHelper |
|
26 | include ApplicationHelper | |
27 | include ProjectsHelper |
|
27 | include ProjectsHelper | |
28 | include IssuesHelper |
|
28 | include IssuesHelper | |
29 |
|
29 | |||
30 | def self.default_url_options |
|
30 | def self.default_url_options | |
31 | {:only_path => true } |
|
31 | {:only_path => true } | |
32 | end |
|
32 | end | |
@@ -78,7 +78,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
78 | 5.times do |
|
78 | 5.times do | |
79 | Issue.generate_for_project!(p) |
|
79 | Issue.generate_for_project!(p) | |
80 | end |
|
80 | end | |
81 |
|
81 | |||
82 | create_gantt(p) |
|
82 | create_gantt(p) | |
83 | @gantt.render |
|
83 | @gantt.render | |
84 | assert_equal 6, @gantt.number_of_rows |
|
84 | assert_equal 6, @gantt.number_of_rows | |
@@ -109,7 +109,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
109 | version = Version.generate! |
|
109 | version = Version.generate! | |
110 | @project.versions << version |
|
110 | @project.versions << version | |
111 | @project.issues << Issue.generate_for_project!(@project, :fixed_version => version) |
|
111 | @project.issues << Issue.generate_for_project!(@project, :fixed_version => version) | |
112 |
|
112 | |||
113 | assert_equal 3, @gantt.number_of_rows_on_project(@project) |
|
113 | assert_equal 3, @gantt.number_of_rows_on_project(@project) | |
114 | end |
|
114 | end | |
115 | end |
|
115 | end | |
@@ -131,56 +131,56 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
131 | :done_ratio => 30, |
|
131 | :done_ratio => 30, | |
132 | :start_date => Date.yesterday, |
|
132 | :start_date => Date.yesterday, | |
133 | :due_date => 1.week.from_now.to_date) |
|
133 | :due_date => 1.week.from_now.to_date) | |
134 |
@project.issues << @issue |
|
134 | @project.issues << @issue | |
135 | end |
|
135 | end | |
136 |
|
136 | |||
137 | context "project" do |
|
137 | context "project" do | |
138 | should "be rendered" do |
|
138 | should "be rendered" do | |
139 | @response.body = @gantt.subjects |
|
139 | @response.body = @gantt.subjects | |
140 | assert_select "div.project-name a", /#{@project.name}/ |
|
140 | assert_select "div.project-name a", /#{@project.name}/ | |
141 | end |
|
141 | end | |
142 |
|
142 | |||
143 | should "have an indent of 4" do |
|
143 | should "have an indent of 4" do | |
144 | @response.body = @gantt.subjects |
|
144 | @response.body = @gantt.subjects | |
145 | assert_select "div.project-name[style*=left:4px]" |
|
145 | assert_select "div.project-name[style*=left:4px]" | |
146 | end |
|
146 | end | |
147 | end |
|
147 | end | |
148 |
|
148 | |||
149 | context "version" do |
|
149 | context "version" do | |
150 | should "be rendered" do |
|
150 | should "be rendered" do | |
151 | @response.body = @gantt.subjects |
|
151 | @response.body = @gantt.subjects | |
152 | assert_select "div.version-name a", /#{@version.name}/ |
|
152 | assert_select "div.version-name a", /#{@version.name}/ | |
153 | end |
|
153 | end | |
154 |
|
154 | |||
155 | should "be indented 24 (one level)" do |
|
155 | should "be indented 24 (one level)" do | |
156 | @response.body = @gantt.subjects |
|
156 | @response.body = @gantt.subjects | |
157 | assert_select "div.version-name[style*=left:24px]" |
|
157 | assert_select "div.version-name[style*=left:24px]" | |
158 | end |
|
158 | end | |
159 |
|
159 | |||
160 | context "without assigned issues" do |
|
160 | context "without assigned issues" do | |
161 | setup do |
|
161 | setup do | |
162 | @version = Version.generate!(:effective_date => 2.week.from_now.to_date, :sharing => 'none', :name => 'empty_version') |
|
162 | @version = Version.generate!(:effective_date => 2.week.from_now.to_date, :sharing => 'none', :name => 'empty_version') | |
163 | @project.versions << @version |
|
163 | @project.versions << @version | |
164 | end |
|
164 | end | |
165 |
|
165 | |||
166 | should "not be rendered" do |
|
166 | should "not be rendered" do | |
167 | @response.body = @gantt.subjects |
|
167 | @response.body = @gantt.subjects | |
168 | assert_select "div.version-name a", :text => /#{@version.name}/, :count => 0 |
|
168 | assert_select "div.version-name a", :text => /#{@version.name}/, :count => 0 | |
169 | end |
|
169 | end | |
170 | end |
|
170 | end | |
171 | end |
|
171 | end | |
172 |
|
172 | |||
173 | context "issue" do |
|
173 | context "issue" do | |
174 | should "be rendered" do |
|
174 | should "be rendered" do | |
175 | @response.body = @gantt.subjects |
|
175 | @response.body = @gantt.subjects | |
176 | assert_select "div.issue-subject", /#{@issue.subject}/ |
|
176 | assert_select "div.issue-subject", /#{@issue.subject}/ | |
177 | end |
|
177 | end | |
178 |
|
178 | |||
179 | should "be indented 44 (two levels)" do |
|
179 | should "be indented 44 (two levels)" do | |
180 | @response.body = @gantt.subjects |
|
180 | @response.body = @gantt.subjects | |
181 | assert_select "div.issue-subject[style*=left:44px]" |
|
181 | assert_select "div.issue-subject[style*=left:44px]" | |
182 | end |
|
182 | end | |
183 |
|
183 | |||
184 | context "assigned to a shared version of another project" do |
|
184 | context "assigned to a shared version of another project" do | |
185 | setup do |
|
185 | setup do | |
186 | p = Project.generate! |
|
186 | p = Project.generate! | |
@@ -189,7 +189,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
189 | @shared_version = Version.generate!(:sharing => 'system') |
|
189 | @shared_version = Version.generate!(:sharing => 'system') | |
190 | p.versions << @shared_version |
|
190 | p.versions << @shared_version | |
191 | # Reassign the issue to a shared version of another project |
|
191 | # Reassign the issue to a shared version of another project | |
192 |
|
192 | |||
193 | @issue = Issue.generate!(:fixed_version => @shared_version, |
|
193 | @issue = Issue.generate!(:fixed_version => @shared_version, | |
194 | :subject => "gantt#assigned_to_shared_version", |
|
194 | :subject => "gantt#assigned_to_shared_version", | |
195 | :tracker => @tracker, |
|
195 | :tracker => @tracker, | |
@@ -199,13 +199,13 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
199 | :due_date => 1.week.from_now.to_date) |
|
199 | :due_date => 1.week.from_now.to_date) | |
200 | @project.issues << @issue |
|
200 | @project.issues << @issue | |
201 | end |
|
201 | end | |
202 |
|
202 | |||
203 | should "be rendered" do |
|
203 | should "be rendered" do | |
204 | @response.body = @gantt.subjects |
|
204 | @response.body = @gantt.subjects | |
205 | assert_select "div.issue-subject", /#{@issue.subject}/ |
|
205 | assert_select "div.issue-subject", /#{@issue.subject}/ | |
206 | end |
|
206 | end | |
207 | end |
|
207 | end | |
208 |
|
208 | |||
209 | context "with subtasks" do |
|
209 | context "with subtasks" do | |
210 | setup do |
|
210 | setup do | |
211 | attrs = {:project => @project, :tracker => @tracker, :fixed_version => @version} |
|
211 | attrs = {:project => @project, :tracker => @tracker, :fixed_version => @version} | |
@@ -213,7 +213,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
213 | @child2 = Issue.generate!(attrs.merge(:subject => 'child2', :parent_issue_id => @issue.id, :start_date => Date.today, :due_date => 1.week.from_now.to_date)) |
|
213 | @child2 = Issue.generate!(attrs.merge(:subject => 'child2', :parent_issue_id => @issue.id, :start_date => Date.today, :due_date => 1.week.from_now.to_date)) | |
214 | @grandchild = Issue.generate!(attrs.merge(:subject => 'grandchild', :parent_issue_id => @child1.id, :start_date => Date.yesterday, :due_date => 2.day.from_now.to_date)) |
|
214 | @grandchild = Issue.generate!(attrs.merge(:subject => 'grandchild', :parent_issue_id => @child1.id, :start_date => Date.yesterday, :due_date => 2.day.from_now.to_date)) | |
215 | end |
|
215 | end | |
216 |
|
216 | |||
217 | should "indent subtasks" do |
|
217 | should "indent subtasks" do | |
218 | @response.body = @gantt.subjects |
|
218 | @response.body = @gantt.subjects | |
219 | # parent task 44px |
|
219 | # parent task 44px | |
@@ -291,7 +291,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
291 | setup do |
|
291 | setup do | |
292 | create_gantt |
|
292 | create_gantt | |
293 | end |
|
293 | end | |
294 |
|
294 | |||
295 | context ":html format" do |
|
295 | context ":html format" do | |
296 | should "add an absolute positioned div" do |
|
296 | should "add an absolute positioned div" do | |
297 | @response.body = @gantt.subject_for_project(@project, {:format => :html}) |
|
297 | @response.body = @gantt.subject_for_project(@project, {:format => :html}) | |
@@ -416,7 +416,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
416 | assert_select "div.project.ending[style*=left:88px]", true, @response.body |
|
416 | assert_select "div.project.ending[style*=left:88px]", true, @response.body | |
417 | end |
|
417 | end | |
418 | end |
|
418 | end | |
419 |
|
419 | |||
420 | context "status content" do |
|
420 | context "status content" do | |
421 | should "appear at the far left, even if it's far in the past" do |
|
421 | should "appear at the far left, even if it's far in the past" do | |
422 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
422 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
@@ -583,7 +583,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
583 | assert_select "div.version.ending[style*=left:88px]", true, @response.body |
|
583 | assert_select "div.version.ending[style*=left:88px]", true, @response.body | |
584 | end |
|
584 | end | |
585 | end |
|
585 | end | |
586 |
|
586 | |||
587 | context "status content" do |
|
587 | context "status content" do | |
588 | should "appear at the far left, even if it's far in the past" do |
|
588 | should "appear at the far left, even if it's far in the past" do | |
589 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
589 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
@@ -715,12 +715,12 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
715 |
|
715 | |||
716 | should "not be the total done width if the chart starts after issue start date" do |
|
716 | should "not be the total done width if the chart starts after issue start date" do | |
717 | create_gantt(@project, :date_from => 5.days.ago.to_date) |
|
717 | create_gantt(@project, :date_from => 5.days.ago.to_date) | |
718 |
|
718 | |||
719 | @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) |
|
719 | @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
720 | assert_select "div.task_done[style*=left:0px]", true, @response.body |
|
720 | assert_select "div.task_done[style*=left:0px]", true, @response.body | |
721 | assert_select "div.task_done[style*=width:8px]", true, @response.body |
|
721 | assert_select "div.task_done[style*=width:8px]", true, @response.body | |
722 | end |
|
722 | end | |
723 |
|
723 | |||
724 | context "for completed issue" do |
|
724 | context "for completed issue" do | |
725 | setup do |
|
725 | setup do | |
726 | @issue.done_ratio = 100 |
|
726 | @issue.done_ratio = 100 | |
@@ -730,7 +730,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
730 | @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) |
|
730 | @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
731 | assert_select "div.task_done[style*=width:58px]", true, @response.body |
|
731 | assert_select "div.task_done[style*=width:58px]", true, @response.body | |
732 | end |
|
732 | end | |
733 |
|
733 | |||
734 | should "be the total width of the issue with due_date=start_date" do |
|
734 | should "be the total width of the issue with due_date=start_date" do | |
735 | @issue.due_date = @issue.start_date |
|
735 | @issue.due_date = @issue.start_date | |
736 | @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) |
|
736 | @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
@@ -775,5 +775,5 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||||
775 | context "#to_pdf" do |
|
775 | context "#to_pdf" do | |
776 | should "be tested" |
|
776 | should "be tested" | |
777 | end |
|
777 | end | |
778 |
|
778 | |||
779 | end |
|
779 | end |
General Comments 0
You need to be logged in to leave comments.
Login now