Commit c26a52638ffb59969656454a32ba1d320a04343c
1 parent
9f1c4507
Exists in
master
and in
29 other branches
Test block move for container children on box organizer
Showing
1 changed file
with
27 additions
and
0 deletions
Show diff stats
plugins/container_block/test/functional/container_block_environment_design_controller_test.rb
| @@ -53,4 +53,31 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | @@ -53,4 +53,31 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | ||
| 53 | assert_tag :a, :attributes => { :class => "button icon-save container_block_save" } | 53 | assert_tag :a, :attributes => { :class => "button icon-save container_block_save" } |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | + should 'move child of container block to another box' do | ||
| 57 | + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') | ||
| 58 | + get :move_block, :id => c1.id, :target => "end-of-box-#{@environment.boxes.last.id}" | ||
| 59 | + assert_equal @environment.boxes.last, c1.reload.box | ||
| 60 | + end | ||
| 61 | + | ||
| 62 | + should 'move block to inside of a container block' do | ||
| 63 | + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') | ||
| 64 | + c2 = RawHTMLBlock.create!(:box => @environment.boxes.last, :html => 'child2 content') | ||
| 65 | + get :move_block, :id => c2.id, :target => "before-block-#{c1.id}" | ||
| 66 | + assert_equal @block.container_box, c2.reload.box | ||
| 67 | + end | ||
| 68 | + | ||
| 69 | + should 'move down a container block child' do | ||
| 70 | + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') | ||
| 71 | + c2 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child2 content') | ||
| 72 | + get :move_block_down, :id => c1.id | ||
| 73 | + assert_equal [c2, c1], @block.blocks | ||
| 74 | + end | ||
| 75 | + | ||
| 76 | + should 'move up a container block child' do | ||
| 77 | + c1 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child1 content') | ||
| 78 | + c2 = RawHTMLBlock.create!(:box => @block.container_box, :html => 'child2 content') | ||
| 79 | + get :move_block_up, :id => c2.id | ||
| 80 | + assert_equal [c2, c1], @block.blocks | ||
| 81 | + end | ||
| 82 | + | ||
| 56 | end | 83 | end |