function InlineFormErrorsIntegrationTest::testDisabledInlineFormErrors

Tests that the inline form errors are not visible for Quick Edit forms.

File

core/modules/quickedit/tests/src/FunctionalJavascript/InlineFormErrorsIntegrationTest.php, line 63

Class

InlineFormErrorsIntegrationTest
Tests Inline Form Errors compatibility with Quick Edit.

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

public function testDisabledInlineFormErrors() {
  $session = $this->getSession();
  $web_assert = $this->assertSession();
  // Create a page node.
  $node = $this->drupalCreateNode();
  // Visit the node page.
  $this->drupalGet('node/' . $node->id());
  // Wait until the quick edit link is available.
  $web_assert->waitForElement('css', '.quickedit > a');
  // Activate the quick editing mode.
  $session->executeScript("jQuery('article.node').find('.quickedit > a').click()");
  $web_assert->waitForElement('css', '.quickedit-toolbar');
  // Clear the title field. Trigger a 'keyup' to be able to save the changes.
  $session->executeScript("jQuery('.field--name-title').text('').trigger('keyup')");
  // Try to save the changes.
  $save_button = $web_assert->waitForElement('css', '.action-save.quickedit-button');
  $save_button->click();
  // Wait until the form submission is complete.
  $web_assert->assertWaitOnAjaxRequest();
  // Assert that no error summary from Inline Form Errors is shown.
  $web_assert->elementTextNotContains('css', '.quickedit-validation-errors', '1 error has been found');
  // Assert that the required title error is shown.
  $web_assert->elementTextContains('css', '.quickedit-validation-errors', 'Title field is required.');
}

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