You are here

public function FontYourFaceFontDisplayTest::testFontDisplayedViaFontDisplayRule in @font-your-face 8.3

Tests font displayed once added in FontDisplay.

File

tests/src/Functional/FontYourFaceFontDisplayTest.php, line 76

Class

FontYourFaceFontDisplayTest
Tests that font displays show css.

Namespace

Drupal\Tests\fontyourface\Functional

Code

public function testFontDisplayedViaFontDisplayRule() {
  $this
    ->drupalGet(url::fromRoute('entity.font.activate', [
    'font' => 1,
    'js' => 'nojs',
  ]));
  $edit = [
    'label' => 'Headers',
    'id' => 'headers',
    'font_url' => 'https://en.wikipedia.org/wiki/Arial',
    'fallback' => '',
    'preset_selectors' => '.fontyourface h1, .fontyourface h2, .fontyourface h3, .fontyourface h4, .fontyourface h5, .fontyourface h6',
    'selectors' => '.fontyourface h1, .fontyourface h2, .fontyourface h3, .fontyourface h4, .fontyourface h5, .fontyourface h6',
    'theme' => 'bartik',
  ];
  $this
    ->drupalGet(Url::fromRoute('entity.font_display.add_form'));
  $this
    ->submitForm($edit, 'Save');
  $this
    ->drupalGet(Url::fromRoute('entity.font_display.collection'));
  $this
    ->resetAll();

  // Assert Arial loads in general bartik section.
  $this
    ->drupalGet('/node');
  $this
    ->assertSession()
    ->responseContains('<meta name="Websafe Font" content="Arial" />');
  $this
    ->assertSession()
    ->responseContains("fontyourface/font_display/headers.css");
}