Skip to content

Conversation

@Rade333
Copy link
Contributor

@Rade333 Rade333 commented Jan 28, 2022

Proposed changes:

  • add new method selectNthOptionFromList(), which can be used when we don't know what the options in the list are, but just want to pick the first option, or second etc etc

…would be added even if there was no suffix, for example when calling $field->{$target} with an empty target.
Comment on lines +99 to +102
public function __get($element = '') {
$suffix = $element ? '-' . $this->normalise($element) : '';
return $this->getXpath([
'identifier' => $this->getCurrentIdentifier() . '-' . $this->normalise($name),
'identifier' => $this->getCurrentIdentifier() . $suffix,
Copy link
Contributor Author

@Rade333 Rade333 Jan 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guncha25 Calling $i->selectOptionFromList(FormField::field_my_list(), 'foo', ''); would result in identifier //*[@data-drupal-selector="edit-field-my-list-0-"] without this fix. The last parameter (target) needs to support empty values, since custom List fields usually don't have a target.

@guncha25 guncha25 merged commit d3f7921 into guncha25:9.x Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants