Issue #3228634 by Spokje, xjm, paulocs, tim.plunkett, Lendude: Move tests for integrations between QuickEdit and other modules into QuickEdit so that it can more easily be moved into contrib
(cherry picked from commit 02bf753477
)
merge-requests/1149/head
parent
33e6832208
commit
e06d49bcae
|
@ -15,7 +15,6 @@ class MediaEmbedFilterDisabledIntegrationsTest extends MediaEmbedFilterTestBase
|
|||
*/
|
||||
protected static $modules = [
|
||||
'contextual',
|
||||
'quickedit',
|
||||
// @see media_test_embed_entity_view_alter()
|
||||
'media_test_embed',
|
||||
];
|
||||
|
@ -29,16 +28,14 @@ class MediaEmbedFilterDisabledIntegrationsTest extends MediaEmbedFilterTestBase
|
|||
$this->container->get('current_user')
|
||||
->addRole($this->drupalCreateRole([
|
||||
'access contextual links',
|
||||
'access in-place editing',
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::renderMedia
|
||||
* @covers ::disableContextualLinks
|
||||
* @dataProvider providerDisabledIntegrations
|
||||
*/
|
||||
public function testDisabledIntegrations($integration_detection_selector) {
|
||||
public function testDisabledIntegrations() {
|
||||
$text = $this->createEmbedCode([
|
||||
'data-entity-type' => 'media',
|
||||
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
|
||||
|
@ -46,21 +43,7 @@ class MediaEmbedFilterDisabledIntegrationsTest extends MediaEmbedFilterTestBase
|
|||
|
||||
$this->applyFilter($text);
|
||||
$this->assertCount(1, $this->cssSelect('div[data-media-embed-test-view-mode]'));
|
||||
$this->assertCount(0, $this->cssSelect($integration_detection_selector));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testDisabledIntegrations().
|
||||
*/
|
||||
public function providerDisabledIntegrations() {
|
||||
return [
|
||||
'contextual' => [
|
||||
'div[data-media-embed-test-view-mode].contextual-region',
|
||||
],
|
||||
'quickedit' => [
|
||||
'div[data-media-embed-test-view-mode][data-quickedit-entity-id]',
|
||||
],
|
||||
];
|
||||
$this->assertCount(0, $this->cssSelect('div[data-media-embed-test-view-mode].contextual-region'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\editor\Functional;
|
||||
namespace Drupal\Tests\quickedit\Functional;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
|
@ -10,9 +10,9 @@ use Drupal\Tests\BrowserTestBase;
|
|||
/**
|
||||
* Tests Quick Edit module integration endpoints.
|
||||
*
|
||||
* @group editor
|
||||
* @group quickedit
|
||||
*/
|
||||
class QuickEditIntegrationLoadingTest extends BrowserTestBase {
|
||||
class EditorIntegrationLoadingTest extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\layout_builder\Functional;
|
||||
namespace Drupal\Tests\quickedit\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Tests Layout Builder integration with Quick Edit.
|
||||
*
|
||||
* @group layout_builder
|
||||
* @group quickedit
|
||||
*/
|
||||
class LayoutBuilderQuickEditTest extends BrowserTestBase {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\Functional;
|
||||
namespace Drupal\Tests\quickedit\Functional;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
@ -10,7 +10,7 @@ use Drupal\Tests\TestFileCreationTrait;
|
|||
/**
|
||||
* Tests the endpoints used by the "image" in-place editor.
|
||||
*
|
||||
* @group image
|
||||
* @group quickedit
|
||||
*/
|
||||
class QuickEditImageControllerTest extends BrowserTestBase {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\inline_form_errors\FunctionalJavascript;
|
||||
namespace Drupal\Tests\quickedit\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
|
@ -8,9 +8,9 @@ use Drupal\node\Entity\NodeType;
|
|||
/**
|
||||
* Tests Inline Form Errors compatibility with Quick Edit.
|
||||
*
|
||||
* @group inline_form_errors
|
||||
* @group quickedit
|
||||
*/
|
||||
class FormErrorHandlerQuickEditTest extends WebDriverTestBase {
|
||||
class InlineFormErrorsIntegrationTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
|
@ -1,11 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\layout_builder\FunctionalJavascript;
|
||||
namespace Drupal\Tests\quickedit\FunctionalJavascript;
|
||||
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
|
||||
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
|
||||
use Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase;
|
||||
|
||||
/**
|
||||
* Tests that Layout Builder functions with Quick Edit.
|
||||
|
@ -13,7 +12,7 @@ use Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase;
|
|||
* @covers layout_builder_entity_view_alter()
|
||||
* @covers layout_builder_quickedit_render_field()
|
||||
*
|
||||
* @group layout_builder
|
||||
* @group quickedit
|
||||
*/
|
||||
class LayoutBuilderQuickEditTest extends QuickEditJavascriptTestBase {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\FunctionalJavascript;
|
||||
namespace Drupal\Tests\quickedit\FunctionalJavascript;
|
||||
|
||||
/**
|
||||
* @see \Drupal\image\Plugin\InPlaceEditor\Image
|
|
@ -1,15 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\image\FunctionalJavascript;
|
||||
namespace Drupal\Tests\quickedit\FunctionalJavascript;
|
||||
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\Tests\image\Kernel\ImageFieldCreationTrait;
|
||||
use Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase;
|
||||
use Drupal\Tests\TestFileCreationTrait;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\image\Plugin\InPlaceEditor\Image
|
||||
* @group image
|
||||
* @group quickedit
|
||||
*/
|
||||
class QuickEditImageTest extends QuickEditJavascriptTestBase {
|
||||
|
|
@ -1,17 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\settings_tray\FunctionalJavascript;
|
||||
namespace Drupal\Tests\quickedit\FunctionalJavascript;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
|
||||
/**
|
||||
* Test Settings Tray and Quick Edit modules integration.
|
||||
*
|
||||
* @group settings_tray
|
||||
* @group quickedit
|
||||
*/
|
||||
class QuickEditIntegrationTest extends SettingsTrayTestBase {
|
||||
class SettingsTrayIntegrationTest extends SettingsTrayTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
namespace Drupal\Tests\quickedit\Kernel;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
|
||||
|
@ -8,7 +8,6 @@ use Drupal\Core\Language\LanguageInterface;
|
|||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\quickedit\MetadataGenerator;
|
||||
use Drupal\Tests\quickedit\Kernel\QuickEditTestBase;
|
||||
use Drupal\quickedit_test\MockQuickEditEntityFieldAccessCheck;
|
||||
use Drupal\editor\EditorController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -19,9 +18,9 @@ use Drupal\filter\Entity\FilterFormat;
|
|||
/**
|
||||
* Tests Edit module integration (Editor module's inline editing support).
|
||||
*
|
||||
* @group editor
|
||||
* @group quickedit
|
||||
*/
|
||||
class QuickEditIntegrationTest extends QuickEditTestBase {
|
||||
class EditorIntegrationTest extends QuickEditTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\quickedit\Kernel;
|
||||
|
||||
use Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase;
|
||||
|
||||
/**
|
||||
* Tests that media embed disables certain integrations.
|
||||
*
|
||||
* @coversDefaultClass \Drupal\media\Plugin\Filter\MediaEmbed
|
||||
* @group quickedit
|
||||
*/
|
||||
class MediaEmbedFilterDisabledIntegrationsTest extends MediaEmbedFilterTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $modules = [
|
||||
'contextual',
|
||||
'quickedit',
|
||||
// @see media_test_embed_entity_view_alter()
|
||||
'media_test_embed',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->container->get('current_user')
|
||||
->addRole($this->drupalCreateRole([
|
||||
'access contextual links',
|
||||
'access in-place editing',
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::renderMedia
|
||||
* @covers ::disableContextualLinks
|
||||
*/
|
||||
public function testDisabledIntegrations() {
|
||||
$text = $this->createEmbedCode([
|
||||
'data-entity-type' => 'media',
|
||||
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
|
||||
]);
|
||||
|
||||
$this->applyFilter($text);
|
||||
$this->assertCount(1, $this->cssSelect('div[data-media-embed-test-view-mode]'));
|
||||
$this->assertCount(0, $this->cssSelect('div[data-media-embed-test-view-mode][data-quickedit-entity-id]'));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue