@@ -50,16 +50,17 module Redmine | |||
|
50 | 50 | words_add += 1 |
|
51 | 51 | else |
|
52 | 52 | del_at = pos unless del_at |
|
53 |
deleted << ' ' |
|
|
53 | deleted << ' ' unless deleted.empty? | |
|
54 | deleted << h(change[2]) | |
|
54 | 55 | words_del += 1 |
|
55 | 56 | end |
|
56 | 57 | end |
|
57 | 58 | if add_at |
|
58 | words[add_at] = '<span class="diff_in">' + words[add_at] | |
|
59 | words[add_to] = words[add_to] + '</span>' | |
|
59 | words[add_at] = '<span class="diff_in">'.html_safe + words[add_at] | |
|
60 | words[add_to] = words[add_to] + '</span>'.html_safe | |
|
60 | 61 | end |
|
61 | 62 | if del_at |
|
62 | words.insert del_at - del_off + dels + words_add, '<span class="diff_out">' + deleted + '</span>' | |
|
63 | words.insert del_at - del_off + dels + words_add, '<span class="diff_out">'.html_safe + deleted + '</span>'.html_safe | |
|
63 | 64 | dels += 1 |
|
64 | 65 | del_off += words_del |
|
65 | 66 | words_del = 0 |
@@ -495,11 +495,19 class WikiControllerTest < ActionController::TestCase | |||
|
495 | 495 | end |
|
496 | 496 | |
|
497 | 497 | def test_diff |
|
498 | get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1 | |
|
498 | content = WikiPage.find(1).content | |
|
499 | assert_difference 'WikiContent::Version.count', 2 do | |
|
500 | content.text = "Line removed\nThis is a sample text for testing diffs" | |
|
501 | content.save! | |
|
502 | content.text = "This is a sample text for testing diffs\nLine added" | |
|
503 | content.save! | |
|
504 | end | |
|
505 | ||
|
506 | get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => content.version, :version_from => (content.version - 1) | |
|
499 | 507 | assert_response :success |
|
500 | 508 | assert_template 'diff' |
|
501 | assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, | |
|
502 | :content => /updated/ | |
|
509 | assert_select 'span.diff_out', :text => 'Line removed' | |
|
510 | assert_select 'span.diff_in', :text => 'Line added' | |
|
503 | 511 | end |
|
504 | 512 | |
|
505 | 513 | def test_annotate |
General Comments 0
You need to be logged in to leave comments.
Login now