From c26a52638ffb59969656454a32ba1d320a04343c Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 5 Nov 2013 09:42:02 -0300 Subject: [PATCH] Test block move for container children on box organizer --- plugins/container_block/test/functional/container_block_environment_design_controller_test.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+), 0 deletions(-) diff --git a/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb b/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb index c004aec..5f9e433 100644 --- a/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb +++ b/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb @@ -53,4 +53,31 @@ class EnvironmentDesignControllerTest < ActionController::TestCase assert_tag :a, :attributes => { :class => "button icon-save container_block_save" } end + should 'move child of container block to another box' do + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') + get :move_block, :id => c1.id, :target => "end-of-box-#{@environment.boxes.last.id}" + assert_equal @environment.boxes.last, c1.reload.box + end + + should 'move block to inside of a container block' do + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') + c2 = RawHTMLBlock.create!(:box => @environment.boxes.last, :html => 'child2 content') + get :move_block, :id => c2.id, :target => "before-block-#{c1.id}" + assert_equal @block.container_box, c2.reload.box + end + + should 'move down a container block child' do + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') + c2 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child2 content') + get :move_block_down, :id => c1.id + assert_equal [c2, c1], @block.blocks + end + + should 'move up a container block child' do + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') + c2 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child2 content') + get :move_block_up, :id => c2.id + assert_equal [c2, c1], @block.blocks + end + end -- libgit2 0.21.2