Loading tests/src/FunctionalJavascript/ConfigurationUiTest.php +23 −33 Original line number Diff line number Diff line Loading @@ -85,7 +85,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { * The error message that should display. * * @dataProvider providerTestValidations * @dataProvider providerTestValidationWhenAdding */ public function testValidationWhenAdding($filter_html_status, $entity_embed_status, $allowed_html, $expected_error_message) { $this->drupalGet('admin/config/content/formats/add'); Loading Loading @@ -115,12 +114,15 @@ class ConfigurationUiTest extends EntityEmbedTestBase { $this->assertSession()->waitForElementVisible('css', $target); $this->sortableTo($item, $from, $target); if ($allowed_html == 'default' && $entity_embed_status) { // Unfortunately the <drupal-entity> tag is not yet allowed due to // https://www.drupal.org/project/drupal/issues/2763075. if ($allowed_html === 'default' && $entity_embed_status) { $allowed_html = $this->assertSession()->fieldExists('filters[filter_html][settings][allowed_html]')->getValue(); if ($entity_embed_status) { $this->assertStringContainsString('drupal-entity', $allowed_html); } else { $this->assertStringNotContainsString('drupal-entity', $allowed_html); } } elseif (!empty($allowed_html)) { $page->fillField('filters[filter_html][settings][allowed_html]', $allowed_html); } Loading @@ -136,20 +138,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { } } /** * Data provider for testValidationWhenAdding(). */ public function providerTestValidationWhenAdding() { return [ 'Tests validation when drupal-entity not added.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => 'default', 'expected_error_message' => 'The Media Entity Embed button requires <drupal-entity> among the allowed HTML tags.', ], ]; } /** * Test integration with Filter and Text Editor form validation. * Loading @@ -164,7 +152,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { * The error message that should display. * * @dataProvider providerTestValidations * @dataProvider providerTestValidationWhenEditing */ public function testValidationWhenEditing($filter_html_status, $entity_embed_status, $allowed_html, $expected_error_message) { $this->drupalGet('admin/config/content/formats/manage/embed_test'); Loading Loading @@ -193,8 +180,13 @@ class ConfigurationUiTest extends EntityEmbedTestBase { if ($allowed_html === 'default' && $entity_embed_status) { $allowed_html = $this->assertSession()->fieldExists('filters[filter_html][settings][allowed_html]')->getValue(); if ($entity_embed_status) { $this->assertStringContainsString('drupal-entity', $allowed_html); } else { $this->assertStringNotContainsString('drupal-entity', $allowed_html); } } elseif (!empty($allowed_html)) { $page->fillField('filters[filter_html][settings][allowed_html]', $allowed_html); } Loading @@ -210,20 +202,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { } } /** * Data provider for testValidationWhenEditing(). */ public function providerTestValidationWhenEditing() { return [ 'Tests validation when drupal-entity not added.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => 'default', 'expected_error_message' => FALSE, ], ]; } /** * Data provider for testValidationWhenAdding() and * testValidationWhenEditing(). Loading @@ -248,6 +226,18 @@ class ConfigurationUiTest extends EntityEmbedTestBase { 'allowed_html' => 'default', 'expected_error_message' => FALSE, ], 'Tests validation when entity_embed filter enabled and filter_html is enabled.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => 'default', 'expected_error_message' => FALSE, ], 'Tests validation when drupal-entity not added.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => "<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>", 'expected_error_message' => 'The Media Entity Embed button requires <drupal-entity> among the allowed HTML tags.', ], 'Tests validation when drupal-entity element has no attributes.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, Loading Loading
tests/src/FunctionalJavascript/ConfigurationUiTest.php +23 −33 Original line number Diff line number Diff line Loading @@ -85,7 +85,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { * The error message that should display. * * @dataProvider providerTestValidations * @dataProvider providerTestValidationWhenAdding */ public function testValidationWhenAdding($filter_html_status, $entity_embed_status, $allowed_html, $expected_error_message) { $this->drupalGet('admin/config/content/formats/add'); Loading Loading @@ -115,12 +114,15 @@ class ConfigurationUiTest extends EntityEmbedTestBase { $this->assertSession()->waitForElementVisible('css', $target); $this->sortableTo($item, $from, $target); if ($allowed_html == 'default' && $entity_embed_status) { // Unfortunately the <drupal-entity> tag is not yet allowed due to // https://www.drupal.org/project/drupal/issues/2763075. if ($allowed_html === 'default' && $entity_embed_status) { $allowed_html = $this->assertSession()->fieldExists('filters[filter_html][settings][allowed_html]')->getValue(); if ($entity_embed_status) { $this->assertStringContainsString('drupal-entity', $allowed_html); } else { $this->assertStringNotContainsString('drupal-entity', $allowed_html); } } elseif (!empty($allowed_html)) { $page->fillField('filters[filter_html][settings][allowed_html]', $allowed_html); } Loading @@ -136,20 +138,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { } } /** * Data provider for testValidationWhenAdding(). */ public function providerTestValidationWhenAdding() { return [ 'Tests validation when drupal-entity not added.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => 'default', 'expected_error_message' => 'The Media Entity Embed button requires <drupal-entity> among the allowed HTML tags.', ], ]; } /** * Test integration with Filter and Text Editor form validation. * Loading @@ -164,7 +152,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { * The error message that should display. * * @dataProvider providerTestValidations * @dataProvider providerTestValidationWhenEditing */ public function testValidationWhenEditing($filter_html_status, $entity_embed_status, $allowed_html, $expected_error_message) { $this->drupalGet('admin/config/content/formats/manage/embed_test'); Loading Loading @@ -193,8 +180,13 @@ class ConfigurationUiTest extends EntityEmbedTestBase { if ($allowed_html === 'default' && $entity_embed_status) { $allowed_html = $this->assertSession()->fieldExists('filters[filter_html][settings][allowed_html]')->getValue(); if ($entity_embed_status) { $this->assertStringContainsString('drupal-entity', $allowed_html); } else { $this->assertStringNotContainsString('drupal-entity', $allowed_html); } } elseif (!empty($allowed_html)) { $page->fillField('filters[filter_html][settings][allowed_html]', $allowed_html); } Loading @@ -210,20 +202,6 @@ class ConfigurationUiTest extends EntityEmbedTestBase { } } /** * Data provider for testValidationWhenEditing(). */ public function providerTestValidationWhenEditing() { return [ 'Tests validation when drupal-entity not added.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => 'default', 'expected_error_message' => FALSE, ], ]; } /** * Data provider for testValidationWhenAdding() and * testValidationWhenEditing(). Loading @@ -248,6 +226,18 @@ class ConfigurationUiTest extends EntityEmbedTestBase { 'allowed_html' => 'default', 'expected_error_message' => FALSE, ], 'Tests validation when entity_embed filter enabled and filter_html is enabled.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => 'default', 'expected_error_message' => FALSE, ], 'Tests validation when drupal-entity not added.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, 'allowed_html' => "<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>", 'expected_error_message' => 'The Media Entity Embed button requires <drupal-entity> among the allowed HTML tags.', ], 'Tests validation when drupal-entity element has no attributes.' => [ 'filters[filter_html][status]' => TRUE, 'filters[entity_embed][status]' => TRUE, Loading