public function RegistrationTest::testScrollBox in Legal 2.0.x
Same name and namespace in other branches
- 8 tests/src/Functional/RegistrationTest.php \Drupal\Tests\legal\Functional\RegistrationTest::testScrollBox()
Test if T&Cs scroll box (textarea) displays and behaves correctly.
File
- tests/
src/ Functional/ RegistrationTest.php, line 52
Class
- RegistrationTest
- Tests a user creating an account.
Namespace
Drupal\Tests\legal\FunctionalCode
public function testScrollBox() {
// Set conditions to display in an un-editable HTML text area.
$this
->config('legal.settings')
->set('registration_terms_style', 0)
->set('registration_container', 0)
->save();
// Go to registration page.
$this
->drupalGet('user/register');
// Check T&Cs displayed as textarea.
$readonly = $this
->assertSession()
->elementExists('css', 'textarea#edit-conditions')
->getAttribute('readonly');
// Check textarea field is not editable.
$this
->assertEquals($readonly, 'readonly');
// Check textarea only contains plain text.
$this
->assertSession()
->elementTextContains('css', 'textarea#edit-conditions', $this->conditionsPlainText);
}