function TableDragTest::findRowById

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::findRowById()
  2. 10 core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::findRowById()
  3. 8.9.x core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::findRowById()

Finds a row in the test table by the row ID.

Parameters

string $id: The ID of the row.

string $table_id: The ID of the parent table. Defaults to 'tabledrag-test-table'.

Return value

\Behat\Mink\Element\NodeElement The row element.

File

core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php, line 555

Class

TableDragTest
Tests draggable table.

Namespace

Drupal\FunctionalJavascriptTests\TableDrag

Code

protected function findRowById($id, $table_id = 'tabledrag-test-table') {
  $xpath = "//table[@id='{$table_id}']/tbody/tr[.//input[@name='table[{$id}][id]']]";
  $row = $this->getSession()
    ->getPage()
    ->find('xpath', $xpath);
  $this->assertNotEmpty($row);
  return $row;
}

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