function ManageFieldsTest::testFieldDelete

Same name in other branches
  1. 11.x core/modules/field_ui/tests/src/FunctionalJavascript/ManageFieldsTest.php \Drupal\Tests\field_ui\FunctionalJavascript\ManageFieldsTest::testFieldDelete()

Tests that field delete operation opens in modal.

File

core/modules/field_ui/tests/src/FunctionalJavascript/ManageFieldsTest.php, line 159

Class

ManageFieldsTest
Tests the Field UI "Manage Fields" screens.

Namespace

Drupal\Tests\field_ui\FunctionalJavascript

Code

public function testFieldDelete() : void {
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->drupalGet('admin/structure/types/manage/article/fields');
    $page->find('css', '.dropbutton-toggle button')
        ->click();
    $page->clickLink('Delete');
    // Asserts a dialog opens with the expected text.
    $this->assertEquals('Are you sure you want to delete the field Body?', $assert_session->waitForElement('css', '.ui-dialog-title')
        ->getText());
    $page->find('css', '.ui-dialog-buttonset')
        ->pressButton('Delete');
    $assert_session->waitForText('The field Body has been deleted from the Article content type.');
}

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