You are here

protected function FormatterTest::assertFormatterSettingsSummary in The CodeMirror Editor 8

Asserts formatter settings summary.

1 call to FormatterTest::assertFormatterSettingsSummary()
FormatterTest::testFormatter in tests/src/FunctionalJavascript/FormatterTest.php
Test callback.

File

tests/src/FunctionalJavascript/FormatterTest.php, line 107

Class

FormatterTest
Tests the CodeMirror field formatter.

Namespace

Drupal\Tests\codemirror_editor\FunctionalJavascript

Code

protected function assertFormatterSettingsSummary(array $formatter_settings) {
  $expected_summary[] = 'Language mode: ' . $formatter_settings['mode'];
  $expected_summary[] = 'Line wrapping: ' . ($formatter_settings['lineWrapping'] ? 'Yes' : 'No');
  $expected_summary[] = 'Line numbers: ' . ($formatter_settings['lineNumbers'] ? 'Yes' : 'No');
  $expected_summary[] = 'Fold gutter: ' . ($formatter_settings['foldGutter'] ? 'Yes' : 'No');
  $summary_xpath = '//tr[@id = "field-code"]//div[@class = "field-plugin-summary"]';
  $summary = $this
    ->xpath($summary_xpath)[0]
    ->getHtml();
  self::assertEquals(implode('<br>', $expected_summary), $summary);
}