You are here

protected function ContentTranslationTest::getAutocompleteSuggestions in Entity Embed 8

Return autocomplete suggestions from the entity_id field.

Parameters

string $search_string: The search string.

Return value

string The text of the autocomplete suggestions.

1 call to ContentTranslationTest::getAutocompleteSuggestions()
ContentTranslationTest::testHostEntityLangcode in tests/src/FunctionalJavascript/ContentTranslationTest.php
Tests the host entity's langcode is available in EntityEmbedDialog.

File

tests/src/FunctionalJavascript/ContentTranslationTest.php, line 55

Class

ContentTranslationTest
Test integration with content_translation.

Namespace

Drupal\Tests\entity_embed\FunctionalJavascript

Code

protected function getAutocompleteSuggestions($search_string) {
  $page = $this
    ->getSession()
    ->getPage();
  $autocomplete_field = $field = $page
    ->findField('entity_id');
  $this
    ->assertNotEmpty($autocomplete_field);
  $autocomplete_field
    ->setValue($search_string);
  $this
    ->getSession()
    ->getDriver()
    ->keyDown($autocomplete_field
    ->getXpath(), ' ');
  $this
    ->assertSession()
    ->waitOnAutocomplete();
  $suggestions = $this
    ->assertSession()
    ->waitForElementVisible('css', '.ui-autocomplete');
  $this
    ->assertNotEmpty($suggestions);
  return $suggestions
    ->getText();
}