You are here

private function LayoutBuilderTest::assertOffCanvasFormAfterWait in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderTest::assertOffCanvasFormAfterWait()

Waits for the specified form and returns it when available and visible.

Parameters

string $expected_form_id: The expected form ID.

3 calls to LayoutBuilderTest::assertOffCanvasFormAfterWait()
LayoutBuilderTest::openAddBlockForm in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php
Opens the add block form in the off-canvas dialog.
LayoutBuilderTest::testConfigurableLayoutSections in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php
Tests configurable layouts.
LayoutBuilderTest::testLayoutBuilderUi in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php
Tests the Layout Builder UI.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php, line 480

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

private function assertOffCanvasFormAfterWait($expected_form_id) {
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $off_canvas = $this
    ->assertSession()
    ->waitForElementVisible('css', '#drupal-off-canvas');
  $this
    ->assertNotNull($off_canvas);
  $form_id_element = $off_canvas
    ->find('hidden_field_selector', [
    'hidden_field',
    'form_id',
  ]);

  // Ensure the form ID has the correct value and that the form is visible.
  $this
    ->assertNotEmpty($form_id_element);
  $this
    ->assertSame($expected_form_id, $form_id_element
    ->getValue());
  $this
    ->assertTrue($form_id_element
    ->getParent()
    ->isVisible());
}