function TableTest::testTableConversion

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

Confirms tables convert to the expected markup.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/TableTest.php, line 129

Class

TableTest
For testing the table plugin.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testTableConversion() : void {
  $assert_session = $this->assertSession();
  $page = $this->getSession()
    ->getPage();
  // This is CKEditor 5's default table markup, but uses elements that are
  // not allowed by the text format.
  $this->host->body->value = '<figure class="table"><table><tbody><tr><td>table cell</td></tr></tbody></table> <figcaption>some caption</figcaption></figure>';
  $this->host
    ->save();
  $this->drupalGet($this->host
    ->toUrl('edit-form'));
  $this->captionText = 'some caption';
  $this->tableCellText = 'table cell';
  $table_container = $assert_session->waitForElementVisible('css', 'figure.table');
  $this->assertNotNull($table_container);
  $caption = $page->find('css', 'figure.table > figcaption');
  $this->assertEquals($this->captionText, $caption->getText());
  $table = $page->find('css', 'figure.table > table');
  $this->assertEquals($this->tableCellText, $table->getText());
  $this->assertTableStructureInEditorData();
  $this->assertTableStructureInRenderedPage();
}

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