You are here

protected function FileUrlWidgetTest::removeFileUrlItem in File URL 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/FunctionalJavascript/FileUrlWidgetTest.php \Drupal\Tests\file_url\FunctionalJavascript\FileUrlWidgetTest::removeFileUrlItem()

Removes a file URL field.

Parameters

string $field_name: The file URL field name.

int $delta: (optional) The delta of the item being removed. Defaults to 0.

Throws

\Behat\Mink\Exception\ElementNotFoundException If the field doesn't exist.

1 call to FileUrlWidgetTest::removeFileUrlItem()
FileUrlWidgetTest::testFileUrlWidget in tests/src/FunctionalJavascript/FileUrlWidgetTest.php
Tests the file URL widget.

File

tests/src/FunctionalJavascript/FileUrlWidgetTest.php, line 222

Class

FileUrlWidgetTest
Tests the file URL widget.

Namespace

Drupal\Tests\file_url\FunctionalJavascript

Code

protected function removeFileUrlItem($field_name, $delta = 0) {
  $session = $this
    ->getSession();
  $page = $session
    ->getPage();

  // Narrow the search to the items's wrapper.
  $wrapper = $page
    ->find('css', "div.form-item-{$field_name}-{$delta}");
  if (!$wrapper) {
    throw new ElementNotFoundException($session, $field_name);
  }
  $wrapper
    ->pressButton('Remove');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
}