function AdminUiTest::testFilterCheckboxesToggleSettings

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\AdminUiTest::testFilterCheckboxesToggleSettings()
  2. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\AdminUiTest::testFilterCheckboxesToggleSettings()

Test that filter settings are only visible when the filter is enabled.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php, line 157

Class

AdminUiTest
Tests for CKEditor 5 in the admin UI.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testFilterCheckboxesToggleSettings() : void {
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->createNewTextFormat($page, $assert_session);
    $media_tab = $page->find('css', '[href^="#edit-filters-media-embed-settings"]');
    $this->assertFalse($media_tab->isVisible(), 'Media filter settings should not be present because media filter is not enabled');
    $this->assertTrue($page->hasUncheckedField('filters[media_embed][status]'));
    $page->checkField('filters[media_embed][status]');
    $assert_session->assertWaitOnAjaxRequest();
    $media_tab = $assert_session->waitForElementVisible('css', '[href^="#edit-filters-media-embed-settings"]');
    $this->assertTrue($media_tab->isVisible(), 'Media settings should appear when media filter enabled');
    $page->uncheckField('filters[media_embed][status]');
    $assert_session->assertWaitOnAjaxRequest();
    $media_tab = $page->find('css', '[href^="#edit-filters-media-embed-settings"]');
    $this->assertFalse($media_tab->isVisible(), 'Media settings should be removed when media filter disabled');
}

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