diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php index 8c3798a..eea62d1 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php @@ -3,7 +3,6 @@ namespace Drupal\FunctionalJavascriptTests; use Drupal\Tests\BrowserTestBase; -use Zend\Escaper\Escaper; use Zumba\Mink\Driver\PhantomJSDriver; /** @@ -109,22 +108,19 @@ protected function assertJsCondition($condition, $timeout = 1000, $message = '') * @param string $filename * The file name of the resulting screenshot. If using the default phantomjs * driver then this should be a JPG filename. - * @param string $background_color - * (optional) Background color name. To use the default background color set - * to NULL, however this can result in completely black screenshots if the - * theme does not have a background color. This string is escaped by - * \Zend\Escaper\Escaper::escapeJs(). + * @param bool $set_background_color + * (optional) By default this method will set the background color to white. + * Set to FALSE to override this behaviour. * * @throws \Behat\Mink\Exception\UnsupportedDriverActionException * When operation not supported by the driver. * @throws \Behat\Mink\Exception\DriverException * When the operation cannot be done. */ - protected function createScreenshot($filename, $background_color = 'white') { + protected function createScreenshot($filename, $set_background_color = TRUE) { $session = $this->getSession(); - if (!empty($background_color)) { - $escaper = new Escaper(); - $session->executeScript("document.body.style.backgroundColor = '" . $escaper->escapeJs($background_color) . "';"); + if ($set_background_color) { + $session->executeScript("document.body.style.backgroundColor = 'white';"); } $image = $session->getScreenshot(); file_put_contents($filename, $image);