public function HierarchicalTaxonomyMenuImageTest::testBlockImagesEnabled in Hierarchical Taxonomy Menu 8
Tests that images are displayed.
File
- tests/
src/ Functional/ HierarchicalTaxonomyMenuImageTest.php, line 131
Class
- HierarchicalTaxonomyMenuImageTest
- Tests the Hierarchical Taxonomy Menu images.
Namespace
Drupal\Tests\hierarchical_taxonomy_menu\FunctionalCode
public function testBlockImagesEnabled() {
$this
->drupalGet('<front>');
$block_element = $this
->getSession()
->getPage()
->find('css', '.block-taxonomymenu__menu');
$this
->assertStringContainsString('Term 1', $block_element
->getText());
$this
->assertStringContainsString('Term 2', $block_element
->getText());
$this
->assertSession()
->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:first-child img', 'alt', 'Term 1');
$this
->assertSession()
->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:first-child img', 'height', '16');
$this
->assertSession()
->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:first-child img', 'width', '16');
$this
->assertSession()
->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:last-child img', 'alt', 'Term 2');
$this
->assertSession()
->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:last-child img', 'height', '16');
$this
->assertSession()
->elementAttributeContains('css', '.hierarchical-taxonomy-menu li:last-child img', 'width', '16');
}