function FieldDialogsTest::testRemoveFieldHandler

Same name in other branches
  1. 10 core/modules/views_ui/tests/src/FunctionalJavascript/FieldDialogsTest.php \Drupal\Tests\views_ui\FunctionalJavascript\FieldDialogsTest::testRemoveFieldHandler()

Tests removing a field through the rearrange dialog.

File

core/modules/views_ui/tests/src/FunctionalJavascript/FieldDialogsTest.php, line 61

Class

FieldDialogsTest
Tests the fields dialogs.

Namespace

Drupal\Tests\views_ui\FunctionalJavascript

Code

public function testRemoveFieldHandler() : void {
    $this->drupalGet('admin/structure/views/view/test_content_ajax');
    $page = $this->getSession()
        ->getPage();
    $this->openFieldDialog();
    $remove_link = $page->findAll('css', '.views-remove-link')[1];
    $parent = $remove_link->getParent();
    $this->assertTrue($remove_link->isVisible());
    $remove_checkbox = $this->assertSession()
        ->fieldExists('fields[title][removed]', $parent);
    $this->assertFalse($remove_checkbox->isVisible());
    $this->assertFalse($remove_checkbox->isChecked());
    $remove_link->click();
    $this->assertFalse($remove_link->isVisible());
    $this->assertTrue($remove_checkbox->isChecked());
}

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