Browse Source

Update tests for D10.3's new field selector form.

pull/1007/head
Rosie Le Faive 7 months ago
parent
commit
cde2c133e1
  1. 27
      tests/src/Functional/JsonldTypeAlterReactionTest.php

27
tests/src/Functional/JsonldTypeAlterReactionTest.php

@ -34,11 +34,11 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
], 'Save and continue'); ], 'Save and continue');
$this->submitForm([], 'Save field settings'); $this->submitForm([], 'Save field settings');
} }
else { elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt'){
$this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text');
// First need to submit the form with the elements displayed // For Drupal 10.2, we first need to submit the form with the elements
// on initial page load. The form is using AJAX to send a second element // displayed on initial page load. The form is using AJAX to send a
// after we selected the radio button above // second element after we selected the radio button above
// we can instead get the second element by submitting the form // we can instead get the second element by submitting the form
// and having it throw an error since the required field is missing. // and having it throw an error since the required field is missing.
// @todo refactor this as a functional javascript test. // @todo refactor this as a functional javascript test.
@ -59,6 +59,25 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
'group_field_options_wrapper' => 'string', 'group_field_options_wrapper' => 'string',
], 'Continue'); ], 'Continue');
} }
else {
$this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text');
// For Drupal 10.3 the label is not visible at first.
// @todo refactor this as a functional javascript test.
$this->submitForm([
'new_storage_type' => 'plain_text',
], 'Continue');
// Now we can proceed, entering a label and selecting Text (plain)
// for the second element now that the elements are 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',
], 'Continue');
}
$this->submitForm([], 'Save settings'); $this->submitForm([], 'Save settings');
$this->assertSession()->responseContains('field_type_predicate'); $this->assertSession()->responseContains('field_type_predicate');

Loading…
Cancel
Save