@@ -17,26 +17,13 | |||
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../../../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 |
class Redmine::Helpers::GanttTest < Acti |
|
|
21 | # Utility methods and classes so assert_select can be used. | |
|
22 | class GanttViewTest < ActionView::Base | |
|
23 | include ActionView::Helpers::UrlHelper | |
|
24 | include ActionView::Helpers::TextHelper | |
|
25 | include ActionController::UrlWriter | |
|
26 | include ApplicationHelper | |
|
27 | include ProjectsHelper | |
|
28 | include IssuesHelper | |
|
29 | ||
|
30 | def self.default_url_options | |
|
31 | {:only_path => true } | |
|
32 | end | |
|
33 | ||
|
34 | end | |
|
35 | ||
|
36 | include ActionController::Assertions::SelectorAssertions | |
|
20 | class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |
|
21 | include ApplicationHelper | |
|
22 | include ProjectsHelper | |
|
23 | include IssuesHelper | |
|
37 | 24 | |
|
38 | 25 | def setup |
|
39 | @response = ActionController::TestResponse.new | |
|
26 | setup_with_controller | |
|
40 | 27 | # Fixtures |
|
41 | 28 | ProjectCustomField.delete_all |
|
42 | 29 | Project.destroy_all |
@@ -44,21 +31,13 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
44 | 31 | User.current = User.find(1) |
|
45 | 32 | end |
|
46 | 33 | |
|
47 | def build_view | |
|
48 | @view = GanttViewTest.new | |
|
49 | end | |
|
50 | ||
|
51 | def html_document | |
|
52 | HTML::Document.new(@response.body) | |
|
53 | end | |
|
54 | ||
|
55 | 34 | # Creates a Gantt chart for a 4 week span |
|
56 | 35 | def create_gantt(project=Project.generate!, options={}) |
|
57 | 36 | @project = project |
|
58 | 37 | @gantt = Redmine::Helpers::Gantt.new(options) |
|
59 | 38 | @gantt.project = @project |
|
60 | 39 | @gantt.query = Query.generate_default!(:project => @project) |
|
61 |
@gantt.view = |
|
|
40 | @gantt.view = self | |
|
62 | 41 | @gantt.instance_variable_set('@date_from', options[:date_from] || 2.weeks.ago.to_date) |
|
63 | 42 | @gantt.instance_variable_set('@date_to', options[:date_to] || 2.weeks.from_now.to_date) |
|
64 | 43 | end |
@@ -136,24 +115,24 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
136 | 115 | |
|
137 | 116 | context "project" do |
|
138 | 117 | should "be rendered" do |
|
139 |
@ |
|
|
118 | @output_buffer = @gantt.subjects | |
|
140 | 119 | assert_select "div.project-name a", /#{@project.name}/ |
|
141 | 120 | end |
|
142 | 121 | |
|
143 | 122 | should "have an indent of 4" do |
|
144 |
@ |
|
|
123 | @output_buffer = @gantt.subjects | |
|
145 | 124 | assert_select "div.project-name[style*=left:4px]" |
|
146 | 125 | end |
|
147 | 126 | end |
|
148 | 127 | |
|
149 | 128 | context "version" do |
|
150 | 129 | should "be rendered" do |
|
151 |
@ |
|
|
130 | @output_buffer = @gantt.subjects | |
|
152 | 131 | assert_select "div.version-name a", /#{@version.name}/ |
|
153 | 132 | end |
|
154 | 133 | |
|
155 | 134 | should "be indented 24 (one level)" do |
|
156 |
@ |
|
|
135 | @output_buffer = @gantt.subjects | |
|
157 | 136 | assert_select "div.version-name[style*=left:24px]" |
|
158 | 137 | end |
|
159 | 138 | |
@@ -164,7 +143,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
164 | 143 | end |
|
165 | 144 | |
|
166 | 145 | should "not be rendered" do |
|
167 |
@ |
|
|
146 | @output_buffer = @gantt.subjects | |
|
168 | 147 | assert_select "div.version-name a", :text => /#{@version.name}/, :count => 0 |
|
169 | 148 | end |
|
170 | 149 | end |
@@ -172,12 +151,12 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
172 | 151 | |
|
173 | 152 | context "issue" do |
|
174 | 153 | should "be rendered" do |
|
175 |
@ |
|
|
154 | @output_buffer = @gantt.subjects | |
|
176 | 155 | assert_select "div.issue-subject", /#{@issue.subject}/ |
|
177 | 156 | end |
|
178 | 157 | |
|
179 | 158 | should "be indented 44 (two levels)" do |
|
180 |
@ |
|
|
159 | @output_buffer = @gantt.subjects | |
|
181 | 160 | assert_select "div.issue-subject[style*=left:44px]" |
|
182 | 161 | end |
|
183 | 162 | |
@@ -201,7 +180,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
201 | 180 | end |
|
202 | 181 | |
|
203 | 182 | should "be rendered" do |
|
204 |
@ |
|
|
183 | @output_buffer = @gantt.subjects | |
|
205 | 184 | assert_select "div.issue-subject", /#{@issue.subject}/ |
|
206 | 185 | end |
|
207 | 186 | end |
@@ -215,14 +194,14 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
215 | 194 | end |
|
216 | 195 | |
|
217 | 196 | should "indent subtasks" do |
|
218 |
@ |
|
|
197 | @output_buffer = @gantt.subjects | |
|
219 | 198 | # parent task 44px |
|
220 | 199 | assert_select "div.issue-subject[style*=left:44px]", /#{@issue.subject}/ |
|
221 | 200 | # children 64px |
|
222 | 201 | assert_select "div.issue-subject[style*=left:64px]", /child1/ |
|
223 | 202 | assert_select "div.issue-subject[style*=left:64px]", /child2/ |
|
224 | 203 | # grandchild 84px |
|
225 |
assert_select "div.issue-subject[style*=left:84px]", /grandchild/, @ |
|
|
204 | assert_select "div.issue-subject[style*=left:84px]", /grandchild/, @output_buffer | |
|
226 | 205 | end |
|
227 | 206 | end |
|
228 | 207 | end |
@@ -245,7 +224,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
245 | 224 | :due_date => 1.week.from_now.to_date) |
|
246 | 225 | @project.issues << @issue |
|
247 | 226 | |
|
248 |
@ |
|
|
227 | @output_buffer = @gantt.lines | |
|
249 | 228 | end |
|
250 | 229 | |
|
251 | 230 | context "project" do |
@@ -294,22 +273,22 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
294 | 273 | |
|
295 | 274 | context ":html format" do |
|
296 | 275 | should "add an absolute positioned div" do |
|
297 |
@ |
|
|
276 | @output_buffer = @gantt.subject_for_project(@project, {:format => :html}) | |
|
298 | 277 | assert_select "div[style*=absolute]" |
|
299 | 278 | end |
|
300 | 279 | |
|
301 | 280 | should "use the indent option to move the div to the right" do |
|
302 |
@ |
|
|
281 | @output_buffer = @gantt.subject_for_project(@project, {:format => :html, :indent => 40}) | |
|
303 | 282 | assert_select "div[style*=left:40]" |
|
304 | 283 | end |
|
305 | 284 | |
|
306 | 285 | should "include the project name" do |
|
307 |
@ |
|
|
286 | @output_buffer = @gantt.subject_for_project(@project, {:format => :html}) | |
|
308 | 287 | assert_select 'div', :text => /#{@project.name}/ |
|
309 | 288 | end |
|
310 | 289 | |
|
311 | 290 | should "include a link to the project" do |
|
312 |
@ |
|
|
291 | @output_buffer = @gantt.subject_for_project(@project, {:format => :html}) | |
|
313 | 292 | assert_select 'a[href=?]', "/projects/#{@project.identifier}", :text => /#{@project.name}/ |
|
314 | 293 | end |
|
315 | 294 | |
@@ -318,7 +297,7 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
318 | 297 | @project.versions << Version.generate!(:effective_date => Date.yesterday) |
|
319 | 298 | |
|
320 | 299 | assert @project.overdue?, "Need an overdue project for this test" |
|
321 |
@ |
|
|
300 | @output_buffer = @gantt.subject_for_project(@project, {:format => :html}) | |
|
322 | 301 | |
|
323 | 302 | assert_select 'div span.project-overdue' |
|
324 | 303 | end |
@@ -351,38 +330,38 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
351 | 330 | context ":html format" do |
|
352 | 331 | context "todo line" do |
|
353 | 332 | should "start from the starting point on the left" do |
|
354 |
@ |
|
|
355 |
assert_select "div.project.task_todo[style*=left:28px]", true, @ |
|
|
333 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
334 | assert_select "div.project.task_todo[style*=left:28px]", true, @output_buffer | |
|
356 | 335 | end |
|
357 | 336 | |
|
358 | 337 | should "be the total width of the project" do |
|
359 |
@ |
|
|
360 |
assert_select "div.project.task_todo[style*=width:58px]", true, @ |
|
|
338 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
339 | assert_select "div.project.task_todo[style*=width:58px]", true, @output_buffer | |
|
361 | 340 | end |
|
362 | 341 | |
|
363 | 342 | end |
|
364 | 343 | |
|
365 | 344 | context "late line" do |
|
366 | 345 | should_eventually "start from the starting point on the left" do |
|
367 |
@ |
|
|
368 |
assert_select "div.project.task_late[style*=left:28px]", true, @ |
|
|
346 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
347 | assert_select "div.project.task_late[style*=left:28px]", true, @output_buffer | |
|
369 | 348 | end |
|
370 | 349 | |
|
371 | 350 | should_eventually "be the total delayed width of the project" do |
|
372 |
@ |
|
|
373 |
assert_select "div.project.task_late[style*=width:30px]", true, @ |
|
|
351 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
352 | assert_select "div.project.task_late[style*=width:30px]", true, @output_buffer | |
|
374 | 353 | end |
|
375 | 354 | end |
|
376 | 355 | |
|
377 | 356 | context "done line" do |
|
378 | 357 | should_eventually "start from the starting point on the left" do |
|
379 |
@ |
|
|
380 |
assert_select "div.project.task_done[style*=left:28px]", true, @ |
|
|
358 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
359 | assert_select "div.project.task_done[style*=left:28px]", true, @output_buffer | |
|
381 | 360 | end |
|
382 | 361 | |
|
383 | 362 | should_eventually "Be the total done width of the project" do |
|
384 |
@ |
|
|
385 |
assert_select "div.project.task_done[style*=width:18px]", true, @ |
|
|
363 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
364 | assert_select "div.project.task_done[style*=width:18px]", true, @output_buffer | |
|
386 | 365 | end |
|
387 | 366 | end |
|
388 | 367 | |
@@ -391,13 +370,13 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
391 | 370 | # Shift the date range of the chart |
|
392 | 371 | @gantt.instance_variable_set('@date_from', Date.today) |
|
393 | 372 | |
|
394 |
@ |
|
|
395 |
assert_select "div.project.starting", false, @ |
|
|
373 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
374 | assert_select "div.project.starting", false, @output_buffer | |
|
396 | 375 | end |
|
397 | 376 | |
|
398 | 377 | should "appear at the starting point" do |
|
399 |
@ |
|
|
400 |
assert_select "div.project.starting[style*=left:28px]", true, @ |
|
|
378 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
379 | assert_select "div.project.starting[style*=left:28px]", true, @output_buffer | |
|
401 | 380 | end |
|
402 | 381 | end |
|
403 | 382 | |
@@ -406,14 +385,14 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
406 | 385 | # Shift the date range of the chart |
|
407 | 386 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
408 | 387 | |
|
409 |
@ |
|
|
410 |
assert_select "div.project.ending", false, @ |
|
|
388 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
389 | assert_select "div.project.ending", false, @output_buffer | |
|
411 | 390 | |
|
412 | 391 | end |
|
413 | 392 | |
|
414 | 393 | should "appear at the end of the date range" do |
|
415 |
@ |
|
|
416 |
assert_select "div.project.ending[style*=left:88px]", true, @ |
|
|
394 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
395 | assert_select "div.project.ending[style*=left:88px]", true, @output_buffer | |
|
417 | 396 | end |
|
418 | 397 | end |
|
419 | 398 | |
@@ -421,17 +400,17 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
421 | 400 | should "appear at the far left, even if it's far in the past" do |
|
422 | 401 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
423 | 402 | |
|
424 |
@ |
|
|
403 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
425 | 404 | assert_select "div.project.label", /#{@project.name}/ |
|
426 | 405 | end |
|
427 | 406 | |
|
428 | 407 | should "show the project name" do |
|
429 |
@ |
|
|
408 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
430 | 409 | assert_select "div.project.label", /#{@project.name}/ |
|
431 | 410 | end |
|
432 | 411 | |
|
433 | 412 | should_eventually "show the percent complete" do |
|
434 |
@ |
|
|
413 | @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
|
435 | 414 | assert_select "div.project.label", /0%/ |
|
436 | 415 | end |
|
437 | 416 | end |
@@ -460,35 +439,35 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
460 | 439 | |
|
461 | 440 | context ":html format" do |
|
462 | 441 | should "add an absolute positioned div" do |
|
463 |
@ |
|
|
442 | @output_buffer = @gantt.subject_for_version(@version, {:format => :html}) | |
|
464 | 443 | assert_select "div[style*=absolute]" |
|
465 | 444 | end |
|
466 | 445 | |
|
467 | 446 | should "use the indent option to move the div to the right" do |
|
468 |
@ |
|
|
447 | @output_buffer = @gantt.subject_for_version(@version, {:format => :html, :indent => 40}) | |
|
469 | 448 | assert_select "div[style*=left:40]" |
|
470 | 449 | end |
|
471 | 450 | |
|
472 | 451 | should "include the version name" do |
|
473 |
@ |
|
|
452 | @output_buffer = @gantt.subject_for_version(@version, {:format => :html}) | |
|
474 | 453 | assert_select 'div', :text => /#{@version.name}/ |
|
475 | 454 | end |
|
476 | 455 | |
|
477 | 456 | should "include a link to the version" do |
|
478 |
@ |
|
|
457 | @output_buffer = @gantt.subject_for_version(@version, {:format => :html}) | |
|
479 | 458 | assert_select 'a[href=?]', Regexp.escape("/versions/#{@version.to_param}"), :text => /#{@version.name}/ |
|
480 | 459 | end |
|
481 | 460 | |
|
482 | 461 | should "style late versions" do |
|
483 | 462 | assert @version.overdue?, "Need an overdue version for this test" |
|
484 |
@ |
|
|
463 | @output_buffer = @gantt.subject_for_version(@version, {:format => :html}) | |
|
485 | 464 | |
|
486 | 465 | assert_select 'div span.version-behind-schedule' |
|
487 | 466 | end |
|
488 | 467 | |
|
489 | 468 | should "style behind schedule versions" do |
|
490 | 469 | assert @version.behind_schedule?, "Need a behind schedule version for this test" |
|
491 |
@ |
|
|
470 | @output_buffer = @gantt.subject_for_version(@version, {:format => :html}) | |
|
492 | 471 | |
|
493 | 472 | assert_select 'div span.version-behind-schedule' |
|
494 | 473 | end |
@@ -518,38 +497,38 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
518 | 497 | context ":html format" do |
|
519 | 498 | context "todo line" do |
|
520 | 499 | should "start from the starting point on the left" do |
|
521 |
@ |
|
|
522 |
assert_select "div.version.task_todo[style*=left:28px]", true, @ |
|
|
500 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
501 | assert_select "div.version.task_todo[style*=left:28px]", true, @output_buffer | |
|
523 | 502 | end |
|
524 | 503 | |
|
525 | 504 | should "be the total width of the version" do |
|
526 |
@ |
|
|
527 |
assert_select "div.version.task_todo[style*=width:58px]", true, @ |
|
|
505 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
506 | assert_select "div.version.task_todo[style*=width:58px]", true, @output_buffer | |
|
528 | 507 | end |
|
529 | 508 | |
|
530 | 509 | end |
|
531 | 510 | |
|
532 | 511 | context "late line" do |
|
533 | 512 | should "start from the starting point on the left" do |
|
534 |
@ |
|
|
535 |
assert_select "div.version.task_late[style*=left:28px]", true, @ |
|
|
513 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
514 | assert_select "div.version.task_late[style*=left:28px]", true, @output_buffer | |
|
536 | 515 | end |
|
537 | 516 | |
|
538 | 517 | should "be the total delayed width of the version" do |
|
539 |
@ |
|
|
540 |
assert_select "div.version.task_late[style*=width:30px]", true, @ |
|
|
518 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
519 | assert_select "div.version.task_late[style*=width:30px]", true, @output_buffer | |
|
541 | 520 | end |
|
542 | 521 | end |
|
543 | 522 | |
|
544 | 523 | context "done line" do |
|
545 | 524 | should "start from the starting point on the left" do |
|
546 |
@ |
|
|
547 |
assert_select "div.version.task_done[style*=left:28px]", true, @ |
|
|
525 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
526 | assert_select "div.version.task_done[style*=left:28px]", true, @output_buffer | |
|
548 | 527 | end |
|
549 | 528 | |
|
550 | 529 | should "be the total done width of the version" do |
|
551 |
@ |
|
|
552 |
assert_select "div.version.task_done[style*=width:16px]", true, @ |
|
|
530 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
531 | assert_select "div.version.task_done[style*=width:16px]", true, @output_buffer | |
|
553 | 532 | end |
|
554 | 533 | end |
|
555 | 534 | |
@@ -558,13 +537,13 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
558 | 537 | # Shift the date range of the chart |
|
559 | 538 | @gantt.instance_variable_set('@date_from', Date.today) |
|
560 | 539 | |
|
561 |
@ |
|
|
540 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
562 | 541 | assert_select "div.version.starting", false |
|
563 | 542 | end |
|
564 | 543 | |
|
565 | 544 | should "appear at the starting point" do |
|
566 |
@ |
|
|
567 |
assert_select "div.version.starting[style*=left:28px]", true, @ |
|
|
545 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
546 | assert_select "div.version.starting[style*=left:28px]", true, @output_buffer | |
|
568 | 547 | end |
|
569 | 548 | end |
|
570 | 549 | |
@@ -573,14 +552,14 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
573 | 552 | # Shift the date range of the chart |
|
574 | 553 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
575 | 554 | |
|
576 |
@ |
|
|
555 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
577 | 556 | assert_select "div.version.ending", false |
|
578 | 557 | |
|
579 | 558 | end |
|
580 | 559 | |
|
581 | 560 | should "appear at the end of the date range" do |
|
582 |
@ |
|
|
583 |
assert_select "div.version.ending[style*=left:88px]", true, @ |
|
|
561 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
562 | assert_select "div.version.ending[style*=left:88px]", true, @output_buffer | |
|
584 | 563 | end |
|
585 | 564 | end |
|
586 | 565 | |
@@ -588,17 +567,17 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
588 | 567 | should "appear at the far left, even if it's far in the past" do |
|
589 | 568 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
590 | 569 | |
|
591 |
@ |
|
|
570 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
592 | 571 | assert_select "div.version.label", /#{@version.name}/ |
|
593 | 572 | end |
|
594 | 573 | |
|
595 | 574 | should "show the version name" do |
|
596 |
@ |
|
|
575 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
597 | 576 | assert_select "div.version.label", /#{@version.name}/ |
|
598 | 577 | end |
|
599 | 578 | |
|
600 | 579 | should "show the percent complete" do |
|
601 |
@ |
|
|
580 | @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
|
602 | 581 | assert_select "div.version.label", /30%/ |
|
603 | 582 | end |
|
604 | 583 | end |
@@ -626,28 +605,28 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
626 | 605 | |
|
627 | 606 | context ":html format" do |
|
628 | 607 | should "add an absolute positioned div" do |
|
629 |
@ |
|
|
608 | @output_buffer = @gantt.subject_for_issue(@issue, {:format => :html}) | |
|
630 | 609 | assert_select "div[style*=absolute]" |
|
631 | 610 | end |
|
632 | 611 | |
|
633 | 612 | should "use the indent option to move the div to the right" do |
|
634 |
@ |
|
|
613 | @output_buffer = @gantt.subject_for_issue(@issue, {:format => :html, :indent => 40}) | |
|
635 | 614 | assert_select "div[style*=left:40]" |
|
636 | 615 | end |
|
637 | 616 | |
|
638 | 617 | should "include the issue subject" do |
|
639 |
@ |
|
|
618 | @output_buffer = @gantt.subject_for_issue(@issue, {:format => :html}) | |
|
640 | 619 | assert_select 'div', :text => /#{@issue.subject}/ |
|
641 | 620 | end |
|
642 | 621 | |
|
643 | 622 | should "include a link to the issue" do |
|
644 |
@ |
|
|
623 | @output_buffer = @gantt.subject_for_issue(@issue, {:format => :html}) | |
|
645 | 624 | assert_select 'a[href=?]', Regexp.escape("/issues/#{@issue.to_param}"), :text => /#{@tracker.name} ##{@issue.id}/ |
|
646 | 625 | end |
|
647 | 626 | |
|
648 | 627 | should "style overdue issues" do |
|
649 | 628 | assert @issue.overdue?, "Need an overdue issue for this test" |
|
650 |
@ |
|
|
629 | @output_buffer = @gantt.subject_for_issue(@issue, {:format => :html}) | |
|
651 | 630 | |
|
652 | 631 | assert_select 'div span.issue-overdue' |
|
653 | 632 | end |
@@ -678,47 +657,47 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
678 | 657 | context ":html format" do |
|
679 | 658 | context "todo line" do |
|
680 | 659 | should "start from the starting point on the left" do |
|
681 |
@ |
|
|
682 |
assert_select "div.task_todo[style*=left:28px]", true, @ |
|
|
660 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
661 | assert_select "div.task_todo[style*=left:28px]", true, @output_buffer | |
|
683 | 662 | end |
|
684 | 663 | |
|
685 | 664 | should "be the total width of the issue" do |
|
686 |
@ |
|
|
687 |
assert_select "div.task_todo[style*=width:58px]", true, @ |
|
|
665 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
666 | assert_select "div.task_todo[style*=width:58px]", true, @output_buffer | |
|
688 | 667 | end |
|
689 | 668 | |
|
690 | 669 | end |
|
691 | 670 | |
|
692 | 671 | context "late line" do |
|
693 | 672 | should "start from the starting point on the left" do |
|
694 |
@ |
|
|
695 |
assert_select "div.task_late[style*=left:28px]", true, @ |
|
|
673 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
674 | assert_select "div.task_late[style*=left:28px]", true, @output_buffer | |
|
696 | 675 | end |
|
697 | 676 | |
|
698 | 677 | should "be the total delayed width of the issue" do |
|
699 |
@ |
|
|
700 |
assert_select "div.task_late[style*=width:30px]", true, @ |
|
|
678 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
679 | assert_select "div.task_late[style*=width:30px]", true, @output_buffer | |
|
701 | 680 | end |
|
702 | 681 | end |
|
703 | 682 | |
|
704 | 683 | context "done line" do |
|
705 | 684 | should "start from the starting point on the left" do |
|
706 |
@ |
|
|
707 |
assert_select "div.task_done[style*=left:28px]", true, @ |
|
|
685 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
686 | assert_select "div.task_done[style*=left:28px]", true, @output_buffer | |
|
708 | 687 | end |
|
709 | 688 | |
|
710 | 689 | should "be the total done width of the issue" do |
|
711 |
@ |
|
|
690 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
712 | 691 | # 15 days * 4 px * 30% - 2 px for borders = 16 px |
|
713 |
assert_select "div.task_done[style*=width:16px]", true, @ |
|
|
692 | assert_select "div.task_done[style*=width:16px]", true, @output_buffer | |
|
714 | 693 | end |
|
715 | 694 | |
|
716 | 695 | should "not be the total done width if the chart starts after issue start date" do |
|
717 | 696 | create_gantt(@project, :date_from => 5.days.ago.to_date) |
|
718 | 697 | |
|
719 |
@ |
|
|
720 |
assert_select "div.task_done[style*=left:0px]", true, @ |
|
|
721 |
assert_select "div.task_done[style*=width:8px]", true, @ |
|
|
698 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
699 | assert_select "div.task_done[style*=left:0px]", true, @output_buffer | |
|
700 | assert_select "div.task_done[style*=width:8px]", true, @output_buffer | |
|
722 | 701 | end |
|
723 | 702 | |
|
724 | 703 | context "for completed issue" do |
@@ -727,14 +706,14 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
727 | 706 | end |
|
728 | 707 | |
|
729 | 708 | should "be the total width of the issue" do |
|
730 |
@ |
|
|
731 |
assert_select "div.task_done[style*=width:58px]", true, @ |
|
|
709 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
710 | assert_select "div.task_done[style*=width:58px]", true, @output_buffer | |
|
732 | 711 | end |
|
733 | 712 | |
|
734 | 713 | should "be the total width of the issue with due_date=start_date" do |
|
735 | 714 | @issue.due_date = @issue.start_date |
|
736 |
@ |
|
|
737 |
assert_select "div.task_done[style*=width:2px]", true, @ |
|
|
715 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
716 | assert_select "div.task_done[style*=width:2px]", true, @output_buffer | |
|
738 | 717 | end |
|
739 | 718 | end |
|
740 | 719 | end |
@@ -743,24 +722,24 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |||
|
743 | 722 | should "appear at the far left, even if it's far in the past" do |
|
744 | 723 | @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) |
|
745 | 724 | |
|
746 |
@ |
|
|
747 |
assert_select "div.task.label", true, @ |
|
|
725 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
726 | assert_select "div.task.label", true, @output_buffer | |
|
748 | 727 | end |
|
749 | 728 | |
|
750 | 729 | should "show the issue status" do |
|
751 |
@ |
|
|
730 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
752 | 731 | assert_select "div.task.label", /#{@issue.status.name}/ |
|
753 | 732 | end |
|
754 | 733 | |
|
755 | 734 | should "show the percent complete" do |
|
756 |
@ |
|
|
735 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
757 | 736 | assert_select "div.task.label", /30%/ |
|
758 | 737 | end |
|
759 | 738 | end |
|
760 | 739 | end |
|
761 | 740 | |
|
762 | 741 | should "have an issue tooltip" do |
|
763 |
@ |
|
|
742 | @output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
|
764 | 743 | assert_select "div.tooltip", /#{@issue.subject}/ |
|
765 | 744 | end |
|
766 | 745 |
General Comments 0
You need to be logged in to leave comments.
Login now