function NavigationBlockUiTest::assertOffCanvasFormAfterWait

Same name in other branches
  1. 11.x core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php \Drupal\Tests\navigation\FunctionalJavascript\NavigationBlockUiTest::assertOffCanvasFormAfterWait()

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

@todo move this from into a trait from \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderTest

Parameters

string $expected_form_id: The expected form ID.

2 calls to NavigationBlockUiTest::assertOffCanvasFormAfterWait()
NavigationBlockUiTest::openAddBlockForm in core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
Opens the add block form in the off-canvas dialog.
NavigationBlockUiTest::testNavigationBlockAdminUiPage in core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
Tests navigation block admin page exists and functions correctly.

File

core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php, line 186

Class

NavigationBlockUiTest
Tests that the navigation block UI exists and stores data correctly.

Namespace

Drupal\Tests\navigation\FunctionalJavascript

Code

private function assertOffCanvasFormAfterWait(string $expected_form_id) : void {
    $this->assertSession()
        ->assertWaitOnAjaxRequest();
    $this->waitForOffCanvasArea();
    $off_canvas = $this->assertSession()
        ->elementExists('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());
}

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