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