You are here

protected function ContentEntityAutosaveFormTestBase::addItemToUnlimitedTestField in Autosave Form 8

Adds a new item to the unlimited test field.

Parameters

$delta: The new excepted delta.

1 call to ContentEntityAutosaveFormTestBase::addItemToUnlimitedTestField()
ContentEntityAutosaveFormTestBase::makeEntityFormChange in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Makes a change by the given change/step ID.

File

tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php, line 522

Class

ContentEntityAutosaveFormTestBase
Base test class for testing autosave support for entity forms.

Namespace

Drupal\Tests\autosave_form\FunctionalJavascript\ContentEntity

Code

protected function addItemToUnlimitedTestField($delta) {
  $this
    ->logHtmlOutput(__FUNCTION__ . ' before adding a new item to unlimited field');
  $page = $this
    ->getSession()
    ->getPage();
  $add_button = $page
    ->find('css', '[data-drupal-selector="edit-' . Html::cleanCssIdentifier($this->unlimitedCardinalityField) . '-add-more"]');
  $this
    ->assertTrue(!empty($add_button));
  $add_button
    ->press();
  $result = $this
    ->assertSession()
    ->waitForElement('css', "[name=\"{$this->unlimitedCardinalityField}[{$delta}][value]\"]");
  $this
    ->assertNotEmpty($result);
  $this
    ->logHtmlOutput(__FUNCTION__ . ' after adding a new item to unlimited field');
}