diff --git a/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipePlaceholderTest.php b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipePlaceholderTest.php new file mode 100644 index 0000000..1b045e4 --- /dev/null +++ b/core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipePlaceholderTest.php @@ -0,0 +1,116 @@ +container->get('theme_installer')->install(['big_pipe_test_theme']); + $this->container->get('config.factory')->getEditable('system.theme')->set('default', 'big_pipe_test_theme')->save(); + // Clear the theme registry. + $this->container->set('theme.registry', NULL); + + // Ensure an `article` node type exists. + $this->createContentType(['type' => 'article']); + $this->addDefaultCommentField('node', 'article'); + + // Enable CKEditor. + FilterFormat::create([ + 'format' => 'full_html', + 'name' => 'Full HTML', + 'weight' => 1, + 'filters' => [], + ])->save(); + $settings['toolbar']['rows'] = [ + [ + [ + 'name' => 'Links', + 'items' => [ + 'DrupalLink', + 'DrupalUnlink', + ], + ], + ], + ]; + $editor = Editor::create([ + 'format' => 'full_html', + 'editor' => 'ckeditor', + ]); + $editor->setSettings($settings); + $editor->save(); + + $admin_user = $this->drupalCreateUser([ + 'access comments', + 'post comments', + 'use text format full_html', + ]); + $this->drupalLogin($admin_user); + } + + /** + * Ensure comment form works with history and big_pipe modules. + */ + public function testCommentForm() { + $node = $this->createNode([ + 'type' => 'article', + 'comment' => CommentItemInterface::OPEN, + ]); + // Create some comments. + foreach (range(1, 5) as $i) { + $comment = Comment::create([ + 'status' => CommentInterface::PUBLISHED, + 'field_name' => 'comment', + 'entity_type' => 'node', + 'entity_id' => $node->id(), + ]); + $comment->save(); + } + $this->drupalGet($node->toUrl()->toString()); + // Confirm that CKEditor loaded. + $javascript = << 0; + }()); +JS; + $this->assertJsCondition($javascript); + } + +} diff --git a/core/modules/big_pipe/tests/themes/big_pipe_test_theme/big_pipe_test_theme.info.yml b/core/modules/big_pipe/tests/themes/big_pipe_test_theme/big_pipe_test_theme.info.yml new file mode 100644 index 0000000..d2296e6 --- /dev/null +++ b/core/modules/big_pipe/tests/themes/big_pipe_test_theme/big_pipe_test_theme.info.yml @@ -0,0 +1,5 @@ +name: 'Big Pipe test theme' +type: theme +description: 'Theme for testing the duplicate big pipe placeholders' +version: VERSION +core: 8.x diff --git a/core/modules/big_pipe/tests/themes/big_pipe_test_theme/templates/field--comment.html.twig b/core/modules/big_pipe/tests/themes/big_pipe_test_theme/templates/field--comment.html.twig new file mode 100644 index 0000000..b59fc87 --- /dev/null +++ b/core/modules/big_pipe/tests/themes/big_pipe_test_theme/templates/field--comment.html.twig @@ -0,0 +1,21 @@ +{# +/** + * @file + * Test that comments still work with the form above instead of below. + */ +#} + + {% if comments and not label_hidden %} + {{ title_prefix }} + {{ label }} + {{ title_suffix }} + {% endif %} + + {% if comment_form %} + {{ 'Add new comment'|t }} + {{ comment_form }} + {% endif %} + + {{ comments }} + +