You are here

public function ShortcodeTest::testDropcapShortcode in Shortcode 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/ShortcodeTest.php \Drupal\Tests\shortcode\Functional\ShortcodeTest::testDropcapShortcode()

Tests that the Dropcap shortcode returns the right content.

File

tests/src/Functional/ShortcodeTest.php, line 121

Class

ShortcodeTest
Tests the Drupal 8 shortcode module functionality.

Namespace

Drupal\Tests\shortcode\Functional

Code

public function testDropcapShortcode() {
  $sets = [
    [
      'input' => '[dropcap]text[/dropcap]',
      'output' => '<span class="dropcap">text</span>',
      'message' => 'Dropcap shortcode output matches.',
    ],
    [
      'input' => '[dropcap class="custom-class"]text[/dropcap]',
      'output' => '<span class="custom-class dropcap">text</span>',
      'message' => 'Dropcap shortcode with custom class output matches.',
    ],
  ];
  foreach ($sets as $set) {
    $output = $this->shortcodeService
      ->process($set['input']);
    $this
      ->assertEqual($output, $set['output'], $set['message']);
  }
}