Skip to content

Commit

Permalink
Update tests for D10.3's new field selector form.
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiel committed Apr 4, 2024
1 parent a2c31fc commit cde2c13
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions tests/src/Functional/JsonldTypeAlterReactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public function testMappingReaction() {
], 'Save and continue');
$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');
// 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
// For Drupal 10.2, we 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.
Expand All @@ -59,6 +59,25 @@ public function testMappingReaction() {
'group_field_options_wrapper' => 'string',
], '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->assertSession()->responseContains('field_type_predicate');

Expand Down

0 comments on commit cde2c13

Please sign in to comment.