$this->
assertSession()->
elementExists('css', '.layout__region--first .field--name-field-test-text'
);
// After a refresh the new regions are still there.
$this->
drupalGet('entity_test/structure/entity_test/form-display'
);
$this->
assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'
],
$this->
getRegionTitles());
$this->
assertSession()->
waitForElement('css', '.tabledrag-handle'
);
$id =
$this->
getSession()->
getPage()->
find('css', '[name="form_build_id"]'
)->
getValue();
// Drag the field to the second region.
$field_test_text_row =
$this->
getSession()->
getPage()->
find('css', '#field-test-text'
);
$second_region_row =
$this->
getSession()->
getPage()->
find('css', '.region-second-message'
);
$field_test_text_row->
find('css', '.handle'
)->
dragTo($second_region_row);
$this->
assertSession()->
assertWaitOnAjaxRequest();
$this->
assertSession()->
waitForElement('css', "[name='form_build_id']:not([value='
$id'])"
);
$this->
submitForm([], 'Save'
);
$this->
assertSession()->
pageTextContains('Your settings have been saved.'
);
// The new layout is used.
$this->
drupalGet('entity_test/manage/1/edit'
);
$this->
assertSession()->
elementExists('css', '.layout__region--second .field--name-field-test-text'
);
$this->
assertFieldInRegion('field_test_text[0][value]', 'second'
);
// Tests if this layout works in an embedded context.