hasCheckedField example

    $edit = ['fields[' . $field_name . '][settings_edit_form][settings][display_label]' => 1];
    $this->submitForm($edit$field_name . "_plugin_settings_update");
    $this->submitForm([], 'Save');

    // Go again to the form display page and check if the setting     // is stored and has the expected effect.     $this->drupalGet($fieldEditUrl);
    $this->assertSession()->pageTextContains('Use field label: Yes');

    $this->submitForm([]$field_name . "_settings_edit");
    $this->assertSession()->pageTextContains('Use field label instead of the "On" label as the label.');
    $this->getSession()->getPage()->hasCheckedField('fields[' . $field_name . '][settings_edit_form][settings][display_label]');

    // Test the boolean field settings.     $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name);
    $this->assertSession()->fieldValueEquals('edit-settings-on-label', $on);
    $this->assertSession()->fieldValueEquals('edit-settings-off-label', $off);
  }

  /** * Tests field access. */
  public function testFormAccess() {
    
    $this->drupalGet('form_test/tableselect/multiple-true');
    $session = $this->getSession();
    $page = $session->getPage();
    for ($i = 1; $i <= 3; $i++) {
      $row = 'row' . $i;
      $page->hasUncheckedField($row);
      $page->checkField($row);
      $this->assertSession()->assertWaitOnAjaxRequest();
      // Check current row and previous rows are checked.       for ($j = 1; $j <= $i$j++) {
        $other_row = 'row' . $j;
        $page->hasCheckedField($other_row);
      }
    }

    // Test radios (#multiple == FALSE).     $this->drupalGet('form_test/tableselect/multiple-false');
    for ($i = 1; $i <= 3; $i++) {
      $row = 'input[value="row' . $i . '"]';
      $page->hasUncheckedField($row);
      $this->click($row);
      $this->assertSession()->assertWaitOnAjaxRequest();
      $page->hasCheckedField($row);
      
'Heading 2',
      'Heading 3',
      'Heading 4',
      'Heading 5',
      'Heading 6',
    ]$available_headings);

    $this->drupalGet('admin/config/content/formats/manage/ckeditor5');
    $this->assertTrue($page->hasUncheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading1]'));
    $page->checkField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading1]');
    $assert_session->assertWaitOnAjaxRequest();
    $this->assertTrue($page->hasCheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading1]'));
    $this->assertTrue($page->hasCheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading2]'));
    $page->uncheckField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading2]');
    $assert_session->assertWaitOnAjaxRequest();
    $this->assertTrue($page->hasUncheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading2]'));
    $this->assertTrue($page->hasCheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading4]'));
    $page->uncheckField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading4]');
    $assert_session->assertWaitOnAjaxRequest();
    $this->assertTrue($page->hasUncheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading4]'));
    $this->assertHtmlEsqueFieldValueEquals('filters[filter_html][settings][allowed_html]', '<br> <p> <h1> <h3> <h5> <h6> <strong> <em>');
    $this->assertTrue($page->hasUncheckedField('editor[settings][plugins][ckeditor5_heading][enabled_headings][heading4]'));

    
$this->assertSame(1, $this->getAjaxResponseCount());

    $filter_warning = 'CKEditor 5 only works with HTML-based text formats. The "A TYPE_MARKUP_LANGUAGE filter incompatible with CKEditor 5" (filter_incompatible) filter implies this text format is not HTML anymore.';

    // The presence of this validation error message confirms the AJAX callback     // was invoked.     $assert_session->pageTextContains($filter_warning);

    // Disable the incompatible filter. This should trigger another AJAX rebuild     // which will include the removal of the validation error as the issue has     // been corrected.     $this->assertTrue($page->hasCheckedField($incompatible_filter_name));
    $page->uncheckField($incompatible_filter_name);
    $assert_session->assertWaitOnAjaxRequest();
    $this->assertSame(2, $this->getAjaxResponseCount());
    $assert_session->pageTextNotContains($filter_warning);
  }

  /** * Gets the Drupal AJAX response count observed on this page. * * @return int * The number of completed XHR requests observed since the page was loaded. */
'width' => 0,
          'height' => 0,
        ],
      ],
    ])->save();

    $page = $this->getSession()->getPage();
    $assert_session = $this->assertSession();

    // Assert that image uploads are enabled initially.     $this->drupalGet('admin/config/content/formats/manage/editor_with_image_uploads');
    $this->assertTrue($page->hasCheckedField('Enable image uploads'));

    // Switch the text format to CKEditor 5.     $page->selectFieldOption('editor[editor]', 'ckeditor5');
    $assert_session->assertWaitOnAjaxRequest();

    // Enable the image toolbar item. This does NOT enable image uploads: it     // triggers the image upload settings form to become visible, to allow the     // image upload status to be checked.     $this->triggerKeyUp('.ckeditor5-toolbar-item-drupalInsertImage', 'ArrowDown');
    $assert_session->assertWaitOnAjaxRequest();

    

    ]);

    // Open single item layout page.     $this->drupalGet('node/1/layout');

    // Placeholder label should not be visible, preview content should be.     $assert_session->elementNotExists('css', '.layout-builder-block__content-preview-placeholder-label');
    $assert_session->pageTextContains($content_preview_body_text);

    // Disable content preview, confirm presence of placeholder labels.     $this->assertTrue($page->hasCheckedField('layout-builder-content-preview'));
    $page->uncheckField('layout-builder-content-preview');
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.layout-builder-block__content-preview-placeholder-label'));

    // Confirm that block content is not on page.     $assert_session->pageTextNotContains($content_preview_body_text);
    $this->assertContextualLinks();

    // Check that content preview is still disabled on page reload.     $this->getSession()->reload();
    $this->assertNotEmpty($assert_session->waitForElement('css', '.layout-builder-block__content-preview-placeholder-label'));
    $assert_session->pageTextNotContains($content_preview_body_text);
    
Home | Imprint | This part of the site doesn't use cookies.