function FieldTest::testFormatterChanging

Same name in other branches
  1. 9 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::testFormatterChanging()
  2. 8.9.x core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::testFormatterChanging()
  3. 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::testFormatterChanging()

File

core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php, line 115

Class

FieldTest
Tests the field handler UI.

Namespace

Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler

Code

public function testFormatterChanging() : void {
    $web_assert = $this->assertSession();
    $url = '/admin/structure/views/view/test_field_body';
    $this->drupalGet($url);
    $page = $this->getSession()
        ->getPage();
    $page->clickLink('Body field');
    $web_assert->assertWaitOnAjaxRequest();
    $page->fillField('options[type]', 'text_trimmed');
    // Add a value to the trim_length setting.
    $web_assert->assertWaitOnAjaxRequest();
    $page->fillField('options[settings][trim_length]', '700');
    $apply_button = $page->find('css', '.views-ui-dialog button.button--primary');
    $this->assertNotEmpty($apply_button);
    $apply_button->press();
    $web_assert->assertWaitOnAjaxRequest();
    // Save the page.
    $save_button = $page->find('css', '#edit-actions-submit');
    $save_button->press();
    // Set the body field back to 'default' and test that the trim_length
    // settings are not in the config.
    $this->drupalGet($url);
    $page->clickLink('Body field');
    $web_assert->assertWaitOnAjaxRequest();
    $page->fillField('options[type]', 'text_default');
    $web_assert->assertWaitOnAjaxRequest();
    $apply_button = $page->find('css', '.views-ui-dialog button.button--primary');
    $apply_button->press();
    $web_assert->assertWaitOnAjaxRequest();
    // Save the page.
    $save_button = $page->find('css', '#edit-actions-submit');
    $save_button->press();
    $this->assertConfigSchemaByName('views.view.test_field_body');
}

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