Skip to content
Snippets Groups Projects
Commit e71ddea0 authored by catch's avatar catch
Browse files

Issue #3464431 by idebr, Lendude: Attach Ajax dialog library for Views Entity Operations

parent b6c3c60a
No related branches found
No related tags found
18 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,!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,!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 #250292 passed with warnings
......@@ -5,6 +5,7 @@
namespace Drupal\Tests\node\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\views\Views;
/**
* Tests JavaScript functionality specific to delete operations.
......@@ -65,10 +66,10 @@ public function testNodeDelete(): void {
$this->assertEquals('Are you sure you want to delete the content item Delete article from content list?', $assert_session->waitForElement('css', '.ui-dialog-title')->getText());
$page->find('css', '.ui-dialog-buttonset')->pressButton('Delete');
$assert_session->waitForText('The Article Delete article from content list has been deleted.');
$assert_session->pageTextContains('The Article Delete article from content list has been deleted.');
// Assert that the node is deleted in above operation.
$this->drupalGet('/admin/content');
$assert_session->waitForText('There are no content items yet.');
$this->drupalGet('admin/content');
$assert_session->pageTextContains('There are no content items yet.');
$node = $this->createNode([
'type' => 'article',
......@@ -82,11 +83,28 @@ public function testNodeDelete(): void {
$this->assertEquals('Are you sure you want to delete the content item Delete article from entity form?', $assert_session->waitForElement('css', '.ui-dialog-title')->getText());
$page->find('css', '.ui-dialog-buttonset')->pressButton('Delete');
$this->assertSession()->pageTextContains('The Article Delete article from entity form has been deleted.');
$assert_session->pageTextContains('The Article Delete article from entity form has been deleted.');
// Assert that the node is deleted in above operation.
$this->drupalGet('/admin/content');
$assert_session->waitForText('There are no content items yet.');
$node = $this->createNode([
'type' => 'article',
'title' => 'Delete article from views entity operations',
]);
$node->save();
\Drupal::service('module_installer')->install(['views']);
$view = Views::getView('content');
$view->storage->enable()->save();
\Drupal::service('router.builder')->rebuildIfNeeded();
$this->drupalGet('admin/content');
$page->find('css', '.dropbutton-toggle button')->click();
$page->clickLink('Delete');
// Asserts a dialog opens with the expected text.
$this->assertEquals('Are you sure you want to delete the content item Delete article from views entity operations?', $assert_session->waitForElement('css', '.ui-dialog-title')->getText());
$page->find('css', '.ui-dialog-buttonset')->pressButton('Delete');
$assert_session->pageTextContains('The Article Delete article from views entity operations has been deleted.');
$assert_session->pageTextContains('No content available.');
}
/**
......
......@@ -147,6 +147,10 @@ public function render(ResultRow $values) {
$build = [
'#type' => 'operations',
'#links' => $operations,
// Allow links to use modals.
'#attached' => [
'library' => ['core/drupal.dialog.ajax'],
],
];
return $build;
......
......@@ -134,6 +134,9 @@ public function testRenderWithDestination(): void {
$expected_build = [
'#type' => 'operations',
'#links' => $operations,
'#attached' => [
'library' => ['core/drupal.dialog.ajax'],
],
];
$expected_build['#links']['foo']['query'] = ['destination' => 'foobar'];
$build = $this->plugin->render($result);
......@@ -176,6 +179,9 @@ public function testRenderWithoutDestination(): void {
$expected_build = [
'#type' => 'operations',
'#links' => $operations,
'#attached' => [
'library' => ['core/drupal.dialog.ajax'],
],
];
$build = $this->plugin->render($result);
$this->assertSame($expected_build, $build);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment