public function TableDragTest::testRowWeightSwitch in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::testRowWeightSwitch()
Tests row weight switch.
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ TableDrag/ TableDragTest.php, line 64
Class
- TableDragTest
- Tests draggable table.
Namespace
Drupal\FunctionalJavascriptTests\TableDragCode
public function testRowWeightSwitch() {
$this->state
->set('tabledrag_test_table', array_flip(range(1, 3)));
$this
->drupalGet('tabledrag_test');
$session = $this
->getSession();
$page = $session
->getPage();
$weight_select1 = $page
->findField("table[1][weight]");
$weight_select2 = $page
->findField("table[2][weight]");
$weight_select3 = $page
->findField("table[3][weight]");
// Check that rows weight selects are hidden.
$this
->assertFalse($weight_select1
->isVisible());
$this
->assertFalse($weight_select2
->isVisible());
$this
->assertFalse($weight_select3
->isVisible());
// Toggle row weight selects as visible.
$this
->findWeightsToggle('Show row weights')
->click();
// Check that rows weight selects are visible.
$this
->assertTrue($weight_select1
->isVisible());
$this
->assertTrue($weight_select2
->isVisible());
$this
->assertTrue($weight_select3
->isVisible());
// Toggle row weight selects back to hidden.
$this
->findWeightsToggle('Hide row weights')
->click();
// Check that rows weight selects are hidden again.
$this
->assertFalse($weight_select1
->isVisible());
$this
->assertFalse($weight_select2
->isVisible());
$this
->assertFalse($weight_select3
->isVisible());
}