function TableDragTest::assertDraggableTable

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

Asserts the whole structure of the draggable test table.

@internal

Parameters

array $structure: The table structure. Each entry represents a row and consists of:

  • id: the expected value for the ID hidden field.
  • weight: the expected row weight.
  • parent: the expected parent ID for the row.
  • indentation: how many indents the row should have.
  • changed: whether or not the row should have been marked as changed.

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

bool $skip_missing: Whether assertions done on missing elements value may be skipped or not. Defaults to FALSE.

3 calls to TableDragTest::assertDraggableTable()
TableDragTest::assertKeyboardAccessibility in core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
Asserts accessibility through keyboard of a test draggable table.
TableDragTest::testNestedDraggableTables in core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
Tests nested draggable tables through keyboard.
TableDragTest::testRootLeafDraggableRowsWithKeyboard in core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
Tests the root and leaf behaviors for rows.

File

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

Class

TableDragTest
Tests draggable table.

Namespace

Drupal\FunctionalJavascriptTests\TableDrag

Code

protected function assertDraggableTable(array $structure, string $table_id = 'tabledrag-test-table', bool $skip_missing = FALSE) : void {
    $rows = $this->getSession()
        ->getPage()
        ->findAll('xpath', "//table[@id='{$table_id}']/tbody/tr");
    $this->assertSession()
        ->elementsCount('xpath', "//table[@id='{$table_id}']/tbody/tr", count($structure));
    foreach ($structure as $delta => $expected) {
        $this->assertTableRow($rows[$delta], $expected['id'], $expected['weight'], $expected['parent'], $expected['indentation'], $expected['changed'], $skip_missing);
    }
}

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