function TableDragTest::testRowWeightSwitch
Tests row weight switch.
File
- 
              core/tests/ Drupal/ FunctionalJavascriptTests/ TableDrag/ TableDragTest.php, line 66 
Class
- TableDragTest
- Tests draggable table.
Namespace
Drupal\FunctionalJavascriptTests\TableDragCode
public function testRowWeightSwitch() : void {
  $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());
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
