@@ -9,6 +9,7 @@ Feature: Move elements in the CMS
99 # This allows us to validate that page subclasses get boiled down to just "Page" as the hierarchical base.
1010 Given a "SilverStripe\F rameworkTest\E lemental\M odel\M ultiElementalBehatTestObject" "Blocks Object1"
1111 And a "SilverStripe\F rameworkTest\E lemental\M odel\M ultiElementalBehatTestObject" "Blocks Object2"
12+ And a "SilverStripe\F rameworkTest\E lemental\M odel\E lementalBehatTestObject" "Blocks Object3"
1213 And a "Page" "Non-elemental page"
1314 And a "BasicElementalPage" "Blocks Page1" with a "Block A" content element with "Some content" content
1415 And the "BasicElementalPage" "Blocks Page1" has a "Block B" content element with "Some content II" content
@@ -64,8 +65,7 @@ Feature: Move elements in the CMS
6465 And I should not see a "ElementalAreaRelation" field
6566 And the "input[name=ElementalAreaRelation]" element "value" attribute should be "ElementalArea"
6667 When I press the "Move" button
67- Then I should see a "Moved block 'Block B' successfully" success toast
68-
68+ Then I should see a "Moved block 'Block B' successfully" success toast with these actions: Go to edit form for new block parent
6969 # Check the other page now shows the block
7070 Given I left click on "Blocks Page2" in the tree
7171 Then I should see "Block B"
@@ -110,7 +110,43 @@ Feature: Move elements in the CMS
110110
111111 # Move the block and check it has visible moved
112112 When I press the "Move" button
113- Then I should see a "Moved block 'Lorem' successfully" success toast
113+ # We shouldn't see the action, since we're staying on the same record.
114+ Then I should see a "Moved block 'Lorem' successfully" success toast with no actions
114115 Then I should not see "Lorem" in the "#Form_ItemEditForm_ElementalArea1" element
115116 And I should see "Lorem" in the "#Form_ItemEditForm_ElementalArea2" element
116117 And I should see "Draft" in the "#Form_ItemEditForm_ElementalArea2 .element-editor__element .element-editor-header__info .badge" element
118+
119+ Scenario : I can move a block between different non-SiteTree DataObject parents
120+ Given I go to "/admin/multi-elemental-behat-test-admin"
121+ And I click "Blocks Object1" in the ".ss-gridfield-items" element
122+ # Create elemental block first - can't use fixtures which rely on the relation named explicitly "ElementalArea"
123+ And I click on the "#Form_ItemEditForm_ElementalArea1 .element-editor__toolbar button" element
124+ And I click "Content" in the ".popover-option-set__button-container" element
125+ And I click on the caret button for block 1
126+ And I fill in "Lorem" for "Title" for block 1
127+ And I press the "View actions" button for block 1
128+ And I press the "Publish" button
129+ Then I should see a "Published 'Lorem' successfully" success toast
130+
131+ # Open move modal, select the new parent class, and move the block
132+ When I press the "View actions" button for block 1
133+ And I press the "Move" button
134+ And I select "SilverStripe\F rameworkTest\E lemental\M odel\E lementalBehatTestObject" from "ParentClass"
135+ # we can skip selecting the parent record itself because there's only one, so it's pre-selected
136+ When I press the "Move" button
137+ # The ElementalBehatTestObject class returns null for getCMSEditLink, so we shouldn't provide a link
138+ And I should see a "Moved block 'Lorem' successfully" success toast with no actions
139+
140+ # Move the block back again
141+ Given I go to "/admin/elemental-behat-test-admin"
142+ And I click "Blocks Object3" in the ".ss-gridfield-items" element
143+ When I click on the caret button for block 1
144+ Then the "Title" field for block 1 should contain "Lorem"
145+ When I press the "View actions" button for block 1
146+ And I press the "Move" button
147+ And I select "SilverStripe\F rameworkTest\E lemental\M odel\M ultiElementalBehatTestObject" from "ParentClass"
148+ And I click on the "#Form_ElementForm_3_move_ParentID" element
149+ And I click on the ".ss-searchable-dropdown-field__option:nth-of-type(2)" element
150+ And I select "ElementalArea2" from "ElementalAreaRelation"
151+ And I press the "Move" button
152+ And I should see a "Moved block 'Lorem' successfully" success toast with these actions: Go to edit form for new block parent
0 commit comments