You are here

protected function LikeAndDislikeTest::assertVotingIconExistence in Like & Dislike 8

Asserts voting icon existence on the page.

Parameters

string $entity_type_id: The entity type ID.

string $entity_id: The entity ID.

string $type: Type of the icon, can be 'like' or 'dislike'.

bool $exist: TRUE if icon should exist, FALSE if not.

1 call to LikeAndDislikeTest::assertVotingIconExistence()
LikeAndDislikeTest::testVisibility in tests/src/FunctionalJavascript/LikeAndDislikeTest.php
Tests likes visibility.

File

tests/src/FunctionalJavascript/LikeAndDislikeTest.php, line 592

Class

LikeAndDislikeTest
Provides a web test for like_and_dislike module.

Namespace

Drupal\Tests\like_and_dislike\FunctionalJavascript

Code

protected function assertVotingIconExistence($entity_type_id, $entity_id, $type, $exist) {
  $container_id = $type . '-container-' . $entity_type_id . '-' . $entity_id;
  $css_selector = "#{$container_id} a[data-entity-type]";
  if ($exist) {
    $this
      ->assertSession()
      ->elementExists('css', $css_selector);
  }
  else {
    $this
      ->assertSession()
      ->elementNotExists('css', $css_selector);
  }
}