getAjaxResponseCount example


  public function testSettingsOnlyFireAjaxWithCkeditor5() {
    $page = $this->getSession()->getPage();
    $assert_session = $this->assertSession();
    $this->addNewTextFormat($page$assert_session);
    $this->addNewTextFormat($page$assert_session, 'unicorn');

    $this->drupalGet('admin/config/content/formats/manage/ckeditor5');

    // Enable media embed to trigger an AJAX rebuild.     $this->assertTrue($page->hasUncheckedField('filters[media_embed][status]'));
    $this->assertSame(0, $this->getAjaxResponseCount());
    $page->checkField('filters[media_embed][status]');
    $assert_session->assertWaitOnAjaxRequest();
    $this->assertSame(1, $this->getAjaxResponseCount());

    // Perform the same steps as above with CKEditor, and confirm AJAX callbacks     // are not triggered on settings changes.     $this->drupalGet('admin/config/content/formats/manage/unicorn');

    // Enable media embed to confirm a format not using CKEditor 5 will not     // trigger an AJAX rebuild.     $this->assertTrue($page->hasUncheckedField('filters[media_embed][status]'));
    
Home | Imprint | This part of the site doesn't use cookies.