You are here

public function HierarchicalTaxonomyMenuImageTest::testBlockImageDimensions in Hierarchical Taxonomy Menu 8

Tests image dimensions.

File

tests/src/Functional/HierarchicalTaxonomyMenuImageTest.php, line 147

Class

HierarchicalTaxonomyMenuImageTest
Tests the Hierarchical Taxonomy Menu images.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\Functional

Code

public function testBlockImageDimensions() {
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $this->vocabulary
      ->id() . '|field_icon',
    'collapsible' => FALSE,
    'image_height' => 128,
    'image_width' => 256,
  ])
    ->save();
  $this
    ->drupalGet('<front>');
  $this
    ->assertSession()
    ->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:first-child img', 'height', '128');
  $this
    ->assertSession()
    ->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:first-child img', 'width', '256');
  $this
    ->assertSession()
    ->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:last-child img', 'height', '128');
  $this
    ->assertSession()
    ->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:last-child img', 'width', '256');
}