You are here

public function LazyLoadFormatterTest::testColorboxFormatter in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/LazyLoadFormatterTest.php \Drupal\Tests\video_embed_field\FunctionalJavascript\LazyLoadFormatterTest::testColorboxFormatter()

Test the lazy load formatter.

File

tests/src/FunctionalJavascript/LazyLoadFormatterTest.php, line 37

Class

LazyLoadFormatterTest
Test the lazy load formatter.

Namespace

Drupal\Tests\video_embed_field\FunctionalJavascript

Code

public function testColorboxFormatter() {
  $this
    ->setDisplayComponentSettings('video_embed_field_lazyload', [
    'autoplay' => TRUE,
    'responsive' => TRUE,
  ]);
  $node = $this
    ->createVideoNode('https://example.com/mock_video');
  $this
    ->drupalGet('node/' . $node
    ->id());
  $this
    ->click('.video-embed-field-lazy');
  $this
    ->assertSession()
    ->elementExists('css', '.video-embed-field-lazy .video-embed-field-responsive-video');

  // Make sure the right library files are loaded on the page.
  $this
    ->assertSession()
    ->elementExists('css', 'link[href*="video_embed_field.responsive-video.css"]');
}