waitForOffCanvasArea example

->save();

    $assert_session = $this->assertSession();
    $page = $this->getSession()->getPage();

    $this->drupalGet($layout_url);
    $this->markCurrentPage();

    $assert_session->linkExists('Add section');
    $this->clickLink('Add section');
    $assert_session->assertWaitOnAjaxRequest();
    $this->waitForOffCanvasArea();

    $assert_session->linkExists('One column');
    $this->clickLink('One column');
    $assert_session->assertWaitOnAjaxRequest();
    $this->waitForOffCanvasArea();

    // Add another section.     $assert_session->linkExists('Add section');
    $this->clickLink('Add section');

    $this->waitForOffCanvasArea();
    
/** * Checks if contextual links are working properly. * * @internal */
  protected function assertContextualLinks(): void {
    $page = $this->getSession()->getPage();
    $assert_session = $this->assertSession();

    $this->clickContextualLink('.block-field-blocknodebundle-for-this-particular-testbody', 'Configure');
    $this->waitForOffCanvasArea();
    $this->assertSession()->assertWaitOnAjaxRequest();
    $this->assertNotEmpty($this->assertSession()->waitForButton('Close'));
    $page->pressButton('Close');
    $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');
  }

  /** * Asserts that blocks in a given order in the page. * * @param string[] $items * An ordered list of strings that should appear in the blocks. * * @internal */


  /** * Waits for off-canvas dialog to open. * * @param string $position * The position of the dialog. * * @throws \Behat\Mink\Exception\ElementNotFoundException */
  protected function waitForOffCanvasToOpen($position = 'side') {
    $this->waitForOffCanvasArea();
    // Check that the canvas is positioned on the side.     $this->assertSession()->elementExists('css', '.ui-dialog-position-' . $position);
  }

  /** * Waits for off-canvas dialog to close. */
  protected function waitForOffCanvasToClose() {
    $this->assertSession()->assertNoElementAfterWait('css', '#drupal-off-canvas');
  }

  
protected function assertContextualLinksClickable(): void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()->getPage();
    $this->drupalGet($this->getUrl());

    $this->clickContextualLink('.block-field-blocknodebundle-with-section-fieldbody [data-contextual-id^="layout_builder_block"]', 'Configure');
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.ui-dialog-titlebar [title="Close"]'));
    // We explicitly wait for the off-canvas area to be fully resized before     // trying to press the Close button, instead of waiting for the Close button     // itself to become visible. This is to prevent a regularly occurring random     // test failure.     $this->waitForOffCanvasArea();
    $page->pressButton('Close');
    $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');

    // Run the steps a second time after closing dialog, which reverses the     // order that behaviors.layoutBuilderDisableInteractiveElements and     // contextual link initialization occurs.     $this->clickContextualLink('.block-field-blocknodebundle-with-section-fieldbody [data-contextual-id^="layout_builder_block"]', 'Configure');
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-off-canvas'));
    $page->pressButton('Close');
    $assert_session->assertNoElementAfterWait('css', '#drupal-off-canvas');
    $this->assertContextualLinkRetainsMouseup();
  }
$assert_session->pageTextContains('The node body');
    $assert_session->pageTextNotContains('Every word is like an unnecessary stain on silence and nothingness.');

    // From the manage display page, go to manage the layout.     $this->clickLink('Layout');
    // The body field is present.     $assert_session->elementExists('css', '.field--name-body');

    // Add a new block.     $assert_session->linkExists('Add block');
    $this->clickLink('Add block');
    $this->waitForOffCanvasArea();
    $assert_session->assertWaitOnAjaxRequest();
    $assert_session->linkExists('TestAjax');
    $this->clickLink('TestAjax');
    $this->waitForOffCanvasArea();
    $assert_session->assertWaitOnAjaxRequest();
    // Find the radio buttons.     $name = 'settings[ajax_test]';
    /** @var \Behat\Mink\Element\NodeElement[] $radios */
    $radios = $this->assertSession()->fieldExists($name);
    // Click them both a couple of times.     foreach ([1, 2] as $rounds) {
      
Home | Imprint | This part of the site doesn't use cookies.