You are here

public function DrupalNbspTest::testEditorWorksWhenNbspNotEnabled in CKEditor Non-breaking space Plugin ( ) 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/DrupalNbspTest.php \Drupal\Tests\nbsp\FunctionalJavascript\DrupalNbspTest::testEditorWorksWhenNbspNotEnabled()

Ensure the CKeditor still works when NBSP plugin is not enabled.

File

tests/src/FunctionalJavascript/DrupalNbspTest.php, line 162

Class

DrupalNbspTest
Ensure the NBSP CKeditor dialog works.

Namespace

Drupal\Tests\nbsp\FunctionalJavascript

Code

public function testEditorWorksWhenNbspNotEnabled() {

  // Add a default class in the settings.
  $settings = [
    'toolbar' => [
      'rows' => [
        [
          [
            'name' => 'All the things',
            'items' => [
              'Bold',
              'Italic',
            ],
          ],
        ],
      ],
    ],
    'plugins' => [],
  ];
  $this->editor
    ->setSettings($settings);
  $this->editor
    ->save();
  $this
    ->drupalGet('node/add/page');
  $this
    ->waitForEditor();
  $this
    ->assignNameToCkeditorIframe();
  $this
    ->getSession()
    ->switchToIFrame('ckeditor');
  $assert_session = $this
    ->assertSession();

  // Ensure CKeditor works properly.
  $this
    ->assertNotEmpty($assert_session
    ->waitForElementVisible('css', '.cke_editable', 1000));

  // Ensure the button NBSP is not visible.
  $this
    ->getSession()
    ->switchToIFrame();
  $this
    ->assertEmpty($this
    ->assertSession()
    ->waitForElementVisible('css', 'a.cke_button__drupalnbsp'));
}