function TableTest::assertTableStructureInEditorData

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

Confirms the structure of the table within the editor data.

2 calls to TableTest::assertTableStructureInEditorData()
TableTest::testTableCaptionUi in core/modules/ckeditor5/tests/src/FunctionalJavascript/TableTest.php
Tests creating a table with caption in the UI.
TableTest::testTableConversion in core/modules/ckeditor5/tests/src/FunctionalJavascript/TableTest.php
Confirms tables convert to the expected markup.

File

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

Class

TableTest
For testing the table plugin.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function assertTableStructureInEditorData() : void {
    $xpath = new \DOMXPath($this->getEditorDataAsDom());
    $this->assertEmpty($xpath->query('//figure'), 'There should be no figure tag in editor data');
    $this->assertNotEmpty($xpath->query('//table/caption'), 'A caption should be the immediate child of <table>');
    $this->assertEquals($this->captionText, (string) $xpath->query('//table/caption')[0]->nodeValue, "The caption should say {$this->captionText}");
    $this->assertNotEmpty($xpath->query('//table/tbody/tr/td'), 'There is an expected table structure.');
    $this->assertEquals($this->tableCellText, (string) $xpath->query('//table/tbody/tr/td')[0]->nodeValue, "The table cell should say {$this->tableCellText}");
}

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