function BigPipeRegressionTest::doInlineScriptTest
Same name and namespace in other branches
- 11.x core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php \Drupal\Tests\big_pipe\FunctionalJavascript\BigPipeRegressionTest::doInlineScriptTest()
Tests for the correct replacement of a chunk with inline javascript.
Parsing a <script> tag causes a mutation to be reported because it triggers a micro task checkpoint. Watching for template tags directly results in early mutation reporting, and the trailing markup is not yet parsed when the template is processed.
Also, chunk markup needs to not be double escaped. We encountered both regressions in https://www.drupal.org/project/drupal/issues/3526267.
File
-
core/
modules/ big_pipe/ tests/ src/ FunctionalJavascript/ BigPipeRegressionTest.php, line 200
Class
- BigPipeRegressionTest
- BigPipe regression tests.
Namespace
Drupal\Tests\big_pipe\FunctionalJavascriptCode
protected function doInlineScriptTest() : void {
$user = $this->drupalCreateUser();
$this->drupalLogin($user);
$assert_session = $this->assertSession();
$this->drupalGet(Url::fromRoute('big_pipe_regression_test.inline_script'));
$this->assertNotNull($assert_session->waitForElement('css', 'script[data-big-pipe-event="stop"]'));
$assert_session->elementExists('css', 'div.container-before');
$assert_session->elementExists('css', 'body.inline-script-fires');
$assert_session->elementExists('css', 'div.container-after');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.