You are here

public function GeshiFilterCssTest::testOnlyCss in GeSHi Filter for syntax highlighting 8

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

Test the use of css when CSS mode for syntax highlighting is only add css.

In this case we do not have both geshifilter.css and geshi-languages.css.

File

tests/src/Functional/GeshiFilterCssTest.php, line 159

Class

GeshiFilterCssTest
Test for css generation and use in GeshiFilter.

Namespace

Drupal\Tests\geshifilter\Functional

Code

public function testOnlyCss() {

  // Node Content.
  $node = [
    'title' => 'Test for GeShi Filter',
    'body' => [
      [
        'value' => "dfgdfg <code language=\"php\">echo(\"hi\");</code> dfgdg",
        'format' => 'geshifilter_text_format',
      ],
    ],
    'type' => 'geshifilter_content_type',
  ];

  // Only CSS.
  $form_values = [
    'css_mode' => 3,
  ];
  $this
    ->drupalPostForm('admin/config/content/formats/geshifilter', $form_values, t('Save configuration'));

  // Create the node and read it.
  $this
    ->drupalCreateNode($node);
  $this
    ->drupalGet('node/1');

  // Test if we have both css.
  $this
    ->assertNoRaw('/assets/css/geshifilter.css', 'The CSS file /assets/css/geshifilter.css is present.');
  $this
    ->assertNoRaw('/geshi/geshifilter-languages.css', 'The CSS file /geshi/geshifilter-languages.css is present.');
}