function EntityReferenceAutocompleteWidgetTest::doAutocomplete

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php \Drupal\FunctionalJavascriptTests\EntityReference\EntityReferenceAutocompleteWidgetTest::doAutocomplete()
  2. 10 core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php \Drupal\FunctionalJavascriptTests\EntityReference\EntityReferenceAutocompleteWidgetTest::doAutocomplete()
  3. 11.x core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php \Drupal\FunctionalJavascriptTests\EntityReference\EntityReferenceAutocompleteWidgetTest::doAutocomplete()

Executes an autocomplete on a given field and waits for it to finish.

Parameters

string $field_name: The field name.

1 call to EntityReferenceAutocompleteWidgetTest::doAutocomplete()
EntityReferenceAutocompleteWidgetTest::testEntityReferenceAutocompleteWidget in core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
Tests that the default autocomplete widget return the correct results.

File

core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php, line 158

Class

EntityReferenceAutocompleteWidgetTest
Tests the output of entity reference autocomplete widgets.

Namespace

Drupal\FunctionalJavascriptTests\EntityReference

Code

protected function doAutocomplete($field_name) {
    $autocomplete_field = $this->getSession()
        ->getPage()
        ->findField($field_name . '[0][target_id]');
    $autocomplete_field->setValue('Test');
    $this->getSession()
        ->getDriver()
        ->keyDown($autocomplete_field->getXpath(), ' ');
    $this->assertSession()
        ->waitOnAutocomplete();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.