You are here

protected function SimpleRecaptchaWebformJavascriptTest::assignNameToCaptchaIframe in Simple Google reCAPTCHA 8

Assigns a name to the reCAPTCHA iframe.

assignNameToCkeditorIframe

@TODO duplicate - move this logic to some sort of Trait.

See also

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

1 call to SimpleRecaptchaWebformJavascriptTest::assignNameToCaptchaIframe()
SimpleRecaptchaWebformJavascriptTest::testContactWebform in modules/simple_recaptcha_webform/tests/src/FunctionalJavascript/SimpleRecaptchaWebformJavascriptTest.php
Check if reCAPTCHA validation is added to contact webform.

File

modules/simple_recaptcha_webform/tests/src/FunctionalJavascript/SimpleRecaptchaWebformJavascriptTest.php, line 73

Class

SimpleRecaptchaWebformJavascriptTest
JavaScripts tests for the Simple reCAPTCHA webform module.

Namespace

Drupal\Tests\simple_recaptcha_webform\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);
}