44 |
44 |
def gantt_start
|
45 |
45 |
@gantt.date_from
|
46 |
46 |
end
|
|
47 |
private :gantt_start
|
|
48 |
|
|
49 |
def gantt_end
|
|
50 |
@gantt.date_to
|
|
51 |
end
|
|
52 |
private :gantt_end
|
47 |
53 |
|
48 |
54 |
# Creates a Gantt chart for a 4 week span
|
49 |
55 |
def create_gantt(project=Project.generate!, options={})
|
... | ... | |
354 |
360 |
assert_select 'div.task_todo[style*="left:28px"]', 1
|
355 |
361 |
end
|
356 |
362 |
|
|
363 |
test "#line todo line should end on the leftmost date in the gantt" do
|
|
364 |
create_gantt
|
|
365 |
[gantt_start - 1, gantt_start].each do |start_date|
|
|
366 |
@output_buffer = @gantt.line(start_date, gantt_start, 30, false, 'line', :format => :html, :zoom => 4)
|
|
367 |
# the leftmost date (Date.today - 14 days)
|
|
368 |
assert_select 'div.task_todo[style*="left:0px"]', 1, @output_buffer
|
|
369 |
assert_select 'div.task_todo[style*="width:2px"]', 1, @output_buffer
|
|
370 |
end
|
|
371 |
end
|
|
372 |
|
|
373 |
test "#line todo line should start on the rightmost date in the gantt" do
|
|
374 |
create_gantt
|
|
375 |
[gantt_end, gantt_end + 1].each do |end_date|
|
|
376 |
@output_buffer = @gantt.line(gantt_end, end_date, 30, false, 'line', :format => :html, :zoom => 4)
|
|
377 |
# the rightmost date (Date.today + 14 days)
|
|
378 |
assert_select 'div.task_todo[style*="left:112px"]', 1, @output_buffer
|
|
379 |
assert_select 'div.task_todo[style*="width:2px"]', 1, @output_buffer
|
|
380 |
end
|
|
381 |
end
|
|
382 |
|
357 |
383 |
test "#line todo line should be the total width" do
|
358 |
384 |
create_gantt
|
359 |
385 |
@output_buffer = @gantt.line(today - 7, today + 7, 30, false, 'line', :format => :html, :zoom => 4)
|