You are here

public function GeshiFilterTest::testTitleAttributeOnCodeBlock in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/GeshiFilterTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterTest::testTitleAttributeOnCodeBlock()

Test title attribute on code block.

File

tests/src/Functional/GeshiFilterTest.php, line 453

Class

GeshiFilterTest
Tests for GeshiFilter in node content.

Namespace

Drupal\Tests\geshifilter\Functional

Code

public function testTitleAttributeOnCodeBlock() {
  $source_code = "for (int i=0; i!=10; ++i) {\n  fun(i);\n  bar.foo(x, y);\n}";

  // No title set.
  $this
    ->assertGeshiFilterHighlighting('<code language="cpp">' . $source_code . '</code>', [
    [
      'geshifilter-title',
      FALSE,
      0,
      0,
      0,
    ],
  ], t('Setting the title attritbute on code block.'), TRUE);

  // Title set.
  $this
    ->assertGeshiFilterHighlighting('<code language="cpp" title="Foo the bar!">' . $source_code . '</code>', [
    [
      '<div class="geshifilter-title">Foo the bar!</div>',
      FALSE,
      0,
      0,
      0,
    ],
  ], t('Setting the title attritbute on code block.'));
}