Skip to content
Snippets Groups Projects
Verified Commit d7bb4b3b authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3467821 by catch, smustgrave: Remove a couple of data providers from ckeditor5 ImageTestBase

parent cab9c0a9
Branches
Tags
20 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #253723 failed
......@@ -359,15 +359,21 @@ public function testLinkability(): void {
}
}
/**
* Tests that alt text is required for images.
*/
public function testAltTextRequired() {
foreach ([FALSE, TRUE] as $unrestricted) {
$this->doTestAltTextRequired($unrestricted);
}
}
/**
* Tests that alt text is required for images.
*
* @see https://ckeditor.com/docs/ckeditor5/latest/framework/guides/architecture/editing-engine.html#conversion
*
* @dataProvider providerAltTextRequired
*/
public function testAltTextRequired(bool $unrestricted): void {
// Disable filter_html.
protected function doTestAltTextRequired(bool $unrestricted): void {
if ($unrestricted) {
FilterFormat::load('test_format')
->setFilterConfig('filter_html', ['status' => FALSE])
......@@ -380,7 +386,7 @@ public function testAltTextRequired(bool $unrestricted): void {
'width="500"',
'<img ' . $this->imageAttributesAsString() . ' />'
);
$this->host->body->value .= $img_tag . "<p>$img_tag</p>";
$this->host->body->value = "<p>I'm a pirate</p>" . $img_tag . "<p>$img_tag</p>";
$this->host->save();
$page = $this->getSession()->getPage();
......@@ -455,13 +461,6 @@ public function testAltTextRequired(bool $unrestricted): void {
$this->assertVisibleBalloon('.ck-text-alternative-form');
}
public static function providerAltTextRequired(): array {
return [
'Restricted' => [FALSE],
'Unrestricted' => [TRUE],
];
}
protected function providerLinkability(): array {
return [
'BLOCK image, restricted' => ['block', FALSE],
......@@ -473,15 +472,22 @@ protected function providerLinkability(): array {
/**
* Tests alignment integration.
*
* @dataProvider providerAlignment
*/
public function testAlignment(string $image_type): void {
public function testAlignment() {
foreach (['block', 'inline'] as $image_type) {
$this->doTestAlignment($image_type);
}
}
/**
* Tests alignment integration.
*/
protected function doTestAlignment(string $image_type): void {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
// Make the test content have either a block image or an inline image.
$img_tag = '<img alt="drupalimage test image" ' . $this->imageAttributesAsString() . ' />';
$this->host->body->value .= $image_type === 'block'
$this->host->body->value = "<p>I'm a pirate</p>" . $image_type === 'block'
? $img_tag
: "<p>$img_tag</p>";
$this->host->save();
......@@ -533,22 +539,22 @@ public function testAlignment(string $image_type): void {
$this->assertFalse($drupal_media_element->hasAttribute('data-align'));
}
public static function providerAlignment() {
return [
'Block image' => ['block'],
'Inline image' => ['inline'],
];
/**
* Ensures that width attribute upcasts and downcasts correctly.
*/
public function testWidth() {
foreach (static::providerWidth() as $data) {
$this->doTestWidth($data['width']);
}
}
/**
* Ensures that width attribute upcasts and downcasts correctly.
* Tests the width attribute with different widths.
*
* @param string $width
* The width input for the image.
*
* @dataProvider providerWidth
*/
public function testWidth(string $width): void {
protected function doTestWidth(string $width): void {
$page = $this->getSession()->getPage();
$assert_session = $this->assertSession();
......@@ -641,13 +647,20 @@ public static function providerWidth(): array {
*
* Confirms that enabling the resize plugin introduces the resize class to
* images within CKEditor 5.
*/
public function testResize() {
foreach ([TRUE, FALSE] as $is_resize_enabled) {
$this->doTestResize($is_resize_enabled);
}
}
/**
* Tests the image resize plugin.
*
* @param bool $is_resize_enabled
* Boolean flag to test enabled or disabled.
*
* @dataProvider providerResize
*/
public function testResize(bool $is_resize_enabled): void {
protected function doTestResize(bool $is_resize_enabled): void {
// Disable resize plugin because it is enabled by default.
if (!$is_resize_enabled) {
Editor::load('test_format')->setSettings([
......@@ -673,21 +686,4 @@ public function testResize(bool $is_resize_enabled): void {
$this->assertSame($is_resize_enabled, $image_figure->hasClass('ck-widget_with-resizer'));
}
/**
* Data provider for ::testResize().
*
* @return array
* The test cases.
*/
public static function providerResize(): array {
return [
'Image resize is enabled' => [
'is_resize_enabled' => TRUE,
],
'Image resize is disabled' => [
'is_resize_enabled' => FALSE,
],
];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment