You are here

protected function LazyloaderTestBase::assertLazyloaderEnabled in Image Lazyloader 7.2

Asserts if lazyloader is enabled on the page.

Parameters

bool|TRUE $enabled:

string $message:

3 calls to LazyloaderTestBase::assertLazyloaderEnabled()
LazyloaderExcludeTestCase::testContentTypeExclude in tests/lazyloader_exclude.test
Tests functioning of the content type exclude settings.
LazyloaderExcludeTestCase::testImageStyleExclude in tests/lazyloader_exclude.test
Test functioning of the image style exclude setting.
LazyloaderExcludeTestCase::testPathExclude in tests/lazyloader_exclude.test
Test functioning of the path exclude setting.

File

tests/lazyloader_test_base.test, line 73

Class

LazyloaderTestBase
Test case for typical lazyloader tests.

Code

protected function assertLazyloaderEnabled($enabled = TRUE, $message = '') {
  if ($message === '') {
    $message = $enabled ? 'Lazyloader is enabled' : 'Lazyloader is disabled';
  }
  $image_count = count($this->node->field_images[$this->node->language]);
  $images = $this
    ->xpath('//img[@data-echo]');
  if ($enabled) {
    $this
      ->assertEqual(count($images), $image_count, $message);
  }
  else {
    $this
      ->assertFalse(count($images), $message);
  }
}