From 376652df8c544f1156aefef3102c2d8305a2dd46 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Thu, 21 Jun 2012 00:28:27 +0900 Subject: [PATCH] Fix too escaped in diff page for Wiki (#11209). --- lib/redmine/helpers/diff.rb | 2 +- test/fixtures/wiki_content_versions.yml | 23 ++++++++++++++++++----- test/functional/wiki_controller_test.rb | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/redmine/helpers/diff.rb b/lib/redmine/helpers/diff.rb index b11a569..66abfc9 100644 --- a/lib/redmine/helpers/diff.rb +++ b/lib/redmine/helpers/diff.rb @@ -56,7 +56,7 @@ module Redmine end if add_at words[add_at] = '' + words[add_at] - words[add_to] = words[add_to] + '' + words[add_to] = words[add_to] + ''.html_safe end if del_at words.insert del_at - del_off + dels + words_add, '' + deleted + '' diff --git a/test/fixtures/wiki_content_versions.yml b/test/fixtures/wiki_content_versions.yml index e7c0d48..ac63c75 100644 --- a/test/fixtures/wiki_content_versions.yml +++ b/test/fixtures/wiki_content_versions.yml @@ -42,6 +42,19 @@ wiki_content_versions_003: h1. CookBook documentation Some updated [[documentation]] here... wiki_content_versions_004: + updated_on: 2007-03-08 00:10:51 +01:00 + page_id: 1 + id: 4 + version: 4 + author_id: 1 + comments: "" + wiki_content_id: 1 + compression: "" + data: |- + h1. CookBook documentation + Some updated [[documentation]] here... + More contents... +wiki_content_versions_005: data: |- h1. Another page @@ -49,11 +62,11 @@ wiki_content_versions_004: updated_on: 2007-03-08 00:18:07 +01:00 page_id: 2 wiki_content_id: 2 - id: 4 + id: 5 version: 1 author_id: 1 comments: -wiki_content_versions_005: +wiki_content_versions_006: data: |- h1. Title @@ -73,11 +86,11 @@ wiki_content_versions_005: updated_on: 2007-03-08 00:16:07 +01:00 page_id: 11 wiki_content_id: 11 - id: 5 + id: 6 version: 2 author_id: 1 comments: -wiki_content_versions_006: +wiki_content_versions_007: data: |- h1. Title @@ -95,7 +108,7 @@ wiki_content_versions_006: updated_on: 2007-03-08 00:18:07 +01:00 page_id: 11 wiki_content_id: 11 - id: 6 + id: 7 version: 3 author_id: 1 comments: diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index b87a26a..dfffd74 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -481,7 +481,7 @@ class WikiControllerTest < ActionController::TestCase assert_response :success assert_template 'history' assert_not_nil assigns(:versions) - assert_equal 3, assigns(:versions).size + assert_equal 4, assigns(:versions).size assert_select "input[type=submit][name=commit]" end @@ -494,7 +494,7 @@ class WikiControllerTest < ActionController::TestCase assert_select "input[type=submit][name=commit]", false end - def test_diff + def test_diff_change get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1 assert_response :success assert_template 'diff' @@ -502,6 +502,16 @@ class WikiControllerTest < ActionController::TestCase :content => /updated/ end + def test_diff_add + get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 4, :version_from => 3 + assert_response :success + assert_template 'diff' + puts @response.body + assert_tag :tag => 'span', :attributes => {:class => 'diff_in'}, + :content => " More contents..." + + end + def test_annotate get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2 assert_response :success -- 1.7.10