function InlineBlockTestBase::assertDialogClosedAndTextVisible

Same name and namespace in other branches
  1. 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::assertDialogClosedAndTextVisible()

Asserts that the dialog closes and the new text appears on the main canvas.

Parameters

string $text: The text.

string|null $css_locator: The css locator to use inside the main canvas if any.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php, line 187

Class

InlineBlockTestBase
Base class for testing inline blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertDialogClosedAndTextVisible($text, $css_locator = NULL) {
  $assert_session = $this->assertSession();
  $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');
  $assert_session->assertWaitOnAjaxRequest();
  $assert_session->elementNotExists('css', '#drupal-off-canvas');
  if ($css_locator) {
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', ".dialog-off-canvas-main-canvas {$css_locator}:contains('{$text}')"));
  }
  else {
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', ".dialog-off-canvas-main-canvas:contains('{$text}')"));
  }
}

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