diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-09-26 07:27:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-09-26 07:27:30 +0000 |
commit | b9fa262165601a3b348d22ca1d8da53bda99e55b (patch) | |
tree | 21bd632e051addfee01ab7a568b01f5b6428051a /test | |
parent | c171797673f549e434dd6b94f7262fd31a77b533 (diff) | |
download | redmine-b9fa262165601a3b348d22ca1d8da53bda99e55b.tar.gz redmine-b9fa262165601a3b348d22ca1d8da53bda99e55b.zip |
Adds preview option to the wiki toolbar (#27758).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@17521 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/messages_controller_test.rb | 14 | ||||
-rw-r--r-- | test/functional/previews_controller_test.rb | 81 | ||||
-rw-r--r-- | test/integration/attachments_test.rb | 5 | ||||
-rw-r--r-- | test/integration/layout_test.rb | 2 | ||||
-rw-r--r-- | test/integration/routing/previews_test.rb | 14 | ||||
-rw-r--r-- | test/system/issues_test.rb | 10 |
6 files changed, 39 insertions, 87 deletions
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb index 353100a84..0f3d937db 100644 --- a/test/functional/messages_controller_test.rb +++ b/test/functional/messages_controller_test.rb @@ -33,7 +33,7 @@ class MessagesControllerTest < Redmine::ControllerTest assert_select 'h2', :text => 'First post' end - + def test_show_should_contain_reply_field_tags_for_quoting @request.session[:user_id] = 2 get :show, :params => { @@ -214,7 +214,7 @@ class MessagesControllerTest < Redmine::ControllerTest :id => 1, :reply => { :content => 'This is a test reply', - :subject => 'Test reply' + :subject => 'Test reply' } } reply = Message.order('id DESC').first @@ -265,9 +265,9 @@ class MessagesControllerTest < Redmine::ControllerTest post :preview, :params => { :board_id => 1, :message => { - :subject => "", - :content => "Previewed text" - } + :subject => "" + }, + :text => "Previewed text" } assert_response :success assert_include 'Previewed text', response.body @@ -280,8 +280,8 @@ class MessagesControllerTest < Redmine::ControllerTest :board_id => 1, :message => { :subject => "", - :content => "Previewed text" - } + }, + :text => "Previewed text" } assert_response :success assert_include 'Previewed text', response.body diff --git a/test/functional/previews_controller_test.rb b/test/functional/previews_controller_test.rb index 65fb9ae77..5512cff2d 100644 --- a/test/functional/previews_controller_test.rb +++ b/test/functional/previews_controller_test.rb @@ -28,62 +28,36 @@ class PreviewsControllerTest < Redmine::ControllerTest :journals, :journal_details, :news - def test_preview_new_issue + def test_preview_new_issue_description @request.session[:user_id] = 2 post :issue, :params => { :project_id => '1', - :issue => { - :description => 'Foo' - } + :text => 'Foo' } assert_response :success - assert_select 'fieldset' do - assert_select 'legend', :text => 'Description' - assert_select 'p', :text => 'Foo' - end + assert_select 'p', :text => 'Foo' end - def test_preview_issue_notes_with_no_change_to_description + def test_preview_issue_description @request.session[:user_id] = 2 post :issue, :params => { :project_id => '1', - :id => 1, - :issue => { - :description => Issue.find(1).description, - :notes => 'Foo' - } + :issue_id => 1, + :text => 'Unable to print recipes' } assert_response :success - assert_select 'legend', :text => 'Description', :count => 0 - assert_select 'legend', :text => 'Notes' - end - def test_preview_issue_notes_with_change_to_description - @request.session[:user_id] = 2 - post :issue, :params => { - :project_id => '1', - :id => 1, - :issue => { - :description => 'Changed description', - :notes => 'Foo' - } - } - assert_response :success - assert_select 'legend', :text => 'Description' - assert_select 'legend', :text => 'Notes' + assert_select 'p', :text => 'Unable to print recipes' end - def test_preview_journal_notes_for_update + def test_preview_issue_notes @request.session[:user_id] = 2 post :issue, :params => { :project_id => '1', :id => 1, - :journal => { - :notes => 'Foo' - } + :text => 'Foo' } assert_response :success - assert_select 'legend', :text => 'Notes' assert_select 'p', :text => 'Foo' end @@ -92,53 +66,30 @@ class PreviewsControllerTest < Redmine::ControllerTest @request.session[:user_id] = 2 post :issue, :params => { :project_id => '1', - :id => 1, - :issue => { - :notes => 'attachment:foo.bar' - } + :issue_id => 1, + :field => 'notes', + :text => 'attachment:foo.bar' } assert_response :success assert_select 'a.attachment', :text => 'foo.bar' end - def test_preview_issue_with_project_changed - @request.session[:user_id] = 2 - post :issue, :params => { - :project_id => '1', - :id => 1, - :issue => { - :notes => 'notes', - :project_id => 2 - } - } - assert_response :success - assert_select 'legend', :text => 'Notes' - end - def test_preview_new_news get :news, :params => { :project_id => 1, - :news => { - :title => '', - :description => 'News description', - :summary => '' - } + :text => 'News description', } assert_response :success - assert_select 'fieldset.preview', :text => /News description/ + assert_select 'p', :text => /News description/ end def test_preview_existing_news get :news, :params => { :project_id => 1, :id => 2, - :news => { - :title => '', - :description => 'News description', - :summary => '' - } + :text => 'News description' } assert_response :success - assert_select 'fieldset.preview', :text => /News description/ + assert_select 'p', :text => /News description/ end end diff --git a/test/integration/attachments_test.rb b/test/integration/attachments_test.rb index 6fd58ed5f..0b3bf1862 100644 --- a/test/integration/attachments_test.rb +++ b/test/integration/attachments_test.rb @@ -77,8 +77,9 @@ class AttachmentsTest < Redmine::IntegrationTest token = ajax_upload('myupload.jpg', 'JPEG content') - post '/issues/preview/new/ecookbook', :params => { - :issue => {:tracker_id => 1, :description => 'Inline upload: !myupload.jpg!'}, + post '/issues/preview', :params => { + :issue => {:tracker_id => 1, :project_id => 'ecookbook'}, + :text => 'Inline upload: !myupload.jpg!', :attachments => {'1' => {:filename => 'myupload.jpg', :description => 'My uploaded file', :token => token}} } assert_response :success diff --git a/test/integration/layout_test.rb b/test/integration/layout_test.rb index a52943254..08e7214ce 100644 --- a/test/integration/layout_test.rb +++ b/test/integration/layout_test.rb @@ -63,7 +63,7 @@ class LayoutTest < Redmine::IntegrationTest Role.anonymous.add_permission! :add_issues get '/projects/ecookbook/issues/new' - assert_select 'head script[src^=?]', '/javascripts/jstoolbar/jstoolbar-textile.min.js?' + assert_select 'head script[src^=?]', '/javascripts/jstoolbar/jstoolbar.js?' end def test_calendar_header_tags diff --git a/test/integration/routing/previews_test.rb b/test/integration/routing/previews_test.rb index c6a78758d..c5b4eeaee 100644 --- a/test/integration/routing/previews_test.rb +++ b/test/integration/routing/previews_test.rb @@ -19,14 +19,14 @@ require File.expand_path('../../../test_helper', __FILE__) class RoutingPreviewsTest < Redmine::RoutingTest def test_previews - should_route 'GET /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo' - should_route 'PUT /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo' - should_route 'POST /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo' - - should_route 'GET /issues/preview/edit/321' => 'previews#issue', :id => '321' - should_route 'PUT /issues/preview/edit/321' => 'previews#issue', :id => '321' - should_route 'POST /issues/preview/edit/321' => 'previews#issue', :id => '321' + should_route 'GET /issues/preview' => 'previews#issue' + should_route 'PUT /issues/preview' => 'previews#issue' + should_route 'POST /issues/preview' => 'previews#issue' should_route 'GET /news/preview' => 'previews#news' + + should_route 'GET /preview/text' => 'previews#text' + should_route 'PUT /preview/text' => 'previews#text' + should_route 'POST /preview/text' => 'previews#text' end end diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb index 0ffc1c235..f4c52996d 100644 --- a/test/system/issues_test.rb +++ b/test/system/issues_test.rb @@ -179,10 +179,10 @@ class IssuesTest < ApplicationSystemTestCase fill_in 'Subject', :with => 'new issue subject' fill_in 'Description', :with => 'new issue description' click_link 'Preview' + find 'div.wiki-preview', :visible => true, :text => 'new issue description' end - find 'div#preview fieldset', :visible => true, :text => 'new issue description' assert_difference 'Issue.count' do - find('input[name=commit]').click + click_button('Create') end issue = Issue.order('id desc').first @@ -314,9 +314,9 @@ class IssuesTest < ApplicationSystemTestCase # Update the notes fill_in 'Notes', :with => 'Updated notes' # Preview the change - click_on 'Preview' - assert page.has_css?('#journal_2_preview') - assert page.first('#journal_2_preview').has_content?('Updated notes') + page.first('#change-2 a.tab-preview').click + assert page.has_css?('#preview_journal_2_notes') + assert page.first('#preview_journal_2_notes').has_content?('Updated notes') # Save click_on 'Save' |