You are here

protected function SimpleRecaptchaJavascriptTest::assignNameToCaptchaIframe in Simple Google reCAPTCHA 8

Assigns a name to the reCAPTCHA iframe.

assignNameToCkeditorIframe

See also

\Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::assignNameToCkeditorIframe

3 calls to SimpleRecaptchaJavascriptTest::assignNameToCaptchaIframe()
SimpleRecaptchaJavascriptTest::testFileUploadWidget in tests/src/FunctionalJavascript/SimpleRecaptchaJavascriptTest.php
Test reCAPTCHA protected form containing file upload widget.
SimpleRecaptchaJavascriptTest::testLoginForm in tests/src/FunctionalJavascript/SimpleRecaptchaJavascriptTest.php
Check if reCAPTCHA validation is added to user login form.
SimpleRecaptchaJavascriptTest::testSessionData in tests/src/FunctionalJavascript/SimpleRecaptchaJavascriptTest.php
Submit form as anonymous user and ensure that this submission doesn't keep the session cookies.

File

tests/src/FunctionalJavascript/SimpleRecaptchaJavascriptTest.php, line 117

Class

SimpleRecaptchaJavascriptTest
JavaScripts tests for the Simple reCAPTCHA module.

Namespace

Drupal\Tests\simple_recaptcha\FunctionalJavascript

Code

protected function assignNameToCaptchaIframe() {
  $javascript = <<<JS
(function(){
  var iframes = document.getElementsByTagName('iframe');
    for(var i = 0; i < iframes.length; i++){
        var f = iframes[i];
        f.name = 'recaptcha-iframe';
    }
})()
JS;
  $this
    ->getSession()
    ->evaluateScript($javascript);
}