You are here

protected function AdminToolbarSearchTest::assertSuggestionContains in Admin Toolbar 8

Assert that the search suggestions contain a given string with given input.

Parameters

string $search: The string to search for.

string $contains: Some HTML that is expected to be within the suggestions element.

1 call to AdminToolbarSearchTest::assertSuggestionContains()
AdminToolbarSearchTest::testSearchFunctionality in tests/src/FunctionalJavascript/AdminToolbarSearchTest.php
Tests search functionality.

File

tests/src/FunctionalJavascript/AdminToolbarSearchTest.php, line 96

Class

AdminToolbarSearchTest
Test the functionality of admin toolbar search.

Namespace

Drupal\Tests\admin_toolbar\FunctionalJavascript

Code

protected function assertSuggestionContains($search, $contains) {
  $this
    ->assertSession()
    ->elementExists('css', '#admin-toolbar-search-input')
    ->setValue($search);
  $suggestions_markup = $this
    ->assertSession()
    ->waitForElementVisible('css', 'ul.ui-autocomplete')
    ->getHtml();
  $this
    ->assertContains($contains, $suggestions_markup);
}