You are here

function LazyloaderExcludeTestCase::testImageStyleExclude in Image Lazyloader 7.2

Test functioning of the image style exclude setting.

File

tests/lazyloader_exclude.test, line 85

Class

LazyloaderExcludeTestCase
Tests Lazyloader's exclusion functionality.

Code

function testImageStyleExclude() {

  // Test default rendering of a node.
  $this
    ->drupalGet("node/{$this->node->nid}");
  $this
    ->assertLazyloaderEnabled();

  // Enable exclusion option, but don't disable the current image style.
  $edit['lazyloader_image_styles[medium]'] = 'medium';
  $this
    ->drupalPost("admin/config/media/lazyloader/exclude", $edit, t('Save configuration'));
  $this
    ->drupalGet("node/{$this->node->nid}");
  $this
    ->assertLazyloaderEnabled(TRUE, 'Lazyloader is enabled for <em>medium</em> image style.');

  // Enable exclusion option, now excluding the current image style.
  $edit['lazyloader_image_styles[medium]'] = FALSE;
  $edit['lazyloader_image_styles[large]'] = 'large';
  $this
    ->drupalPost("admin/config/media/lazyloader/exclude", $edit, t('Save configuration'));
  $this
    ->drupalGet("node/{$this->node->nid}");
  $this
    ->assertLazyloaderEnabled(FALSE, 'Lazyloader is disabled for <em>medium</em> image style.');

  // @todo test that image style exclusion only affects images using an image
  // style.
}