You are here

public function RegistrationTest::testScrollBoxCss in Legal 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/RegistrationTest.php \Drupal\Tests\legal\Functional\RegistrationTest::testScrollBoxCss()

Test if T&Cs scroll box (CSS) displays and behaves correctly.

File

tests/src/Functional/RegistrationTest.php, line 76

Class

RegistrationTest
Tests a user creating an account.

Namespace

Drupal\Tests\legal\Functional

Code

public function testScrollBoxCss() {

  // Set conditions to display in a CSS scroll box.
  $this
    ->config('legal.settings')
    ->set('registration_terms_style', 1)
    ->set('registration_container', 0)
    ->save();

  // Go to registration page.
  $this
    ->drupalGet('user/register');

  // Check T&Cs displayed as a div with class JS will target as a scroll box.
  $this
    ->assertSession()
    ->elementExists('css', '#user-register-form > div.legal-terms-scroll');

  // Check scroll area contains full HTML version of T&Cs.
  $this
    ->assertSession()
    ->elementContains('css', '#user-register-form > div.legal-terms-scroll', $this->conditions);
}