From 2ff377f489b2b6b9d9c24b03a217a880fd43731a Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Sat, 7 Jun 2008 22:49:17 +0000 Subject: [PATCH] ActionItem370: allow to add image with alignment in TinyMceArticle --- config/environment.rb | 3 +++ test/functional/cms_controller_test.rb | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config/environment.rb b/config/environment.rb index 47e90d0..7429f04 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -53,6 +53,9 @@ Rails::Initializer.run do |config| :session_key => '_noosfero_session', :secret => '7372009258e02886ca36278257637a008959504400f6286cd09133f6e9131d23460dd77e289bf99b480a3b4d017be0578b59335ce6a1c74e3644e37514926009' } + + # Adds custom attributes to the Set of allowed html attributes for the #sanitize helper + config.action_view.sanitized_allowed_attributes = 'align' # See Rails::Configuration for more options diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 9eb27ac..4dd1ae6 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -150,8 +150,6 @@ class CmsControllerTest < Test::Unit::TestCase end end - should 'display' - should 'be able to create a RSS feed' do login_as(profile.identifier) assert_difference RssFeed, :count do @@ -429,4 +427,16 @@ class CmsControllerTest < Test::Unit::TestCase assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]', :checked => 'checked' } end + should 'be able to add image with alignment' do + post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image right align..." } + saved = TinyMceArticle.find_by_name('image-alignment') + assert_match //, saved.body + end + + should 'not be able to add image with alignment when textile' do + post :new, :type => 'TextileArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image right align..." } + saved = TextileArticle.find_by_name('image-alignment') + assert_no_match /align="right"/, saved.body + end + end -- libgit2 0.21.2