You are here

protected function TableDragTest::assertTableRow in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::assertTableRow()

Asserts the values of a draggable row.

Parameters

\Behat\Mink\Element\NodeElement $row: The row element to assert.

string $id: The expected value for the ID hidden input of the row.

int $weight: The expected weight of the row.

string $parent: The expected parent ID.

int $indentation: The expected indentation of the row.

bool $changed: Whether or not the row should have been marked as changed.

1 call to TableDragTest::assertTableRow()
TableDragTest::assertDraggableTable in core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
Asserts the whole structure of the draggable test table.

File

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

Class

TableDragTest
Tests draggable table.

Namespace

Drupal\FunctionalJavascriptTests\TableDrag

Code

protected function assertTableRow(NodeElement $row, $id, $weight, $parent = '', $indentation = 0, $changed = FALSE) {

  // Assert that the row position is correct by checking that the id
  // corresponds.
  $this
    ->assertSession()
    ->hiddenFieldValueEquals("table[{$id}][id]", $id, $row);
  $this
    ->assertSession()
    ->hiddenFieldValueEquals("table[{$id}][parent]", $parent, $row);
  $this
    ->assertSession()
    ->fieldValueEquals("table[{$id}][weight]", $weight, $row);
  $this
    ->assertSession()
    ->elementsCount('css', '.js-indentation.indentation', $indentation, $row);

  // A row is marked as changed when the related markup is present.
  $this
    ->assertSession()
    ->elementsCount('css', 'abbr.tabledrag-changed', (int) $changed, $row);
}