|
|
|
@ -26,12 +26,39 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
|
|
|
|
|
|
|
|
|
|
// Add the typed predicate we will select in the reaction config. |
|
|
|
|
// Taken from FieldUiTestTrait->fieldUIAddNewField. |
|
|
|
|
if (version_compare(\Drupal::VERSION, '10.2.x-dev', 'lt')) { |
|
|
|
|
$this->submitForm([ |
|
|
|
|
'new_storage_type' => 'string', |
|
|
|
|
'label' => 'Typed Predicate', |
|
|
|
|
'field_name' => 'type_predicate', |
|
|
|
|
], 'Save and continue'); |
|
|
|
|
$this->submitForm([], $this->t('Save field settings')); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); |
|
|
|
|
// First need to submit the form with the elements displayed |
|
|
|
|
// on initial page load. The form is using AJAX to send a second element |
|
|
|
|
// after we selected the radio button above |
|
|
|
|
// we can instead get the second element by submitting the form |
|
|
|
|
// and having it throw an error since the required field is missing. |
|
|
|
|
// @todo refactor this as a functional javascript test. |
|
|
|
|
$this->submitForm([ |
|
|
|
|
'new_storage_type' => 'plain_text', |
|
|
|
|
'label' => 'Typed Predicate', |
|
|
|
|
'field_name' => 'type_predicate', |
|
|
|
|
], $this->t('Continue')); |
|
|
|
|
|
|
|
|
|
// Now we can proceed, selecting the plain text (i.e. string) |
|
|
|
|
// for the second element now that the element is displayed after |
|
|
|
|
// the initial form submission. |
|
|
|
|
$this->getSession()->getPage()->selectFieldOption('group_field_options_wrapper', 'string'); |
|
|
|
|
$this->submitForm([ |
|
|
|
|
'new_storage_type' => 'plain_text', |
|
|
|
|
'label' => 'Typed Predicate', |
|
|
|
|
'field_name' => 'type_predicate', |
|
|
|
|
'group_field_options_wrapper' => 'string', |
|
|
|
|
], $this->t('Continue')); |
|
|
|
|
} |
|
|
|
|
$this->submitForm([], $this->t('Save settings')); |
|
|
|
|
$this->assertSession()->responseContains('field_type_predicate'); |
|
|
|
|
|
|
|
|
|