You are here

public function LoginTest::testScrollBoxCss in Legal 2.0.x

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

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

File

tests/src/Functional/LoginTest.php, line 75

Class

LoginTest
Tests a user loging into an account and accepting new T&C.

Namespace

Drupal\Tests\legal\Functional

Code

public function testScrollBoxCss() {

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

  // Log user in.
  $this
    ->drupalPostForm('user/login', $this->loginDetails, 'Log in');

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

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