The parent issue broke the $element['#ajax']['callback'] functionality. Attached is a screenshot of the problem from the book module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, current_path-fixup.patch, failed testing.

Berdir’s picture

Priority: Normal » Major
Issue tags: +Needs tests

We have some pseudo-ajax tests, how did they not catch this?

xjm’s picture

Issue summary: View changes
Wim Leers’s picture

We have some pseudo-ajax tests, how did they not catch this?

+1 :(

And thanks, @jbrown, for catching this so fast!

Wim Leers’s picture

Title: $element['#ajax']['callback'] is broken » $element['#ajax']['callback'] is broken, hence breaking e.g. inserting images in CKEditor
Priority: Major » Critical

This also broke all editor.module dialogs. Hence it's now impossible to add links or images in CKEditor.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
2.98 KB

The patch in the IS can not possibly ever have applied. I wonder against which version it was rolled.

Wim Leers’s picture

Issue tags: -Needs tests
FileSize
6.45 KB
3.53 KB

I wanted to write a test, but I don't think we actually can. That's the thing about #ajax: it is triggered by JS. We cannot emulate that, for the logic to construct the /system/ajax/SOMETHING URL lives in JS.
The best we can do, is to verify the AJAX settings. This patch adds test coverage for that.

dawehner’s picture

+++ b/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestForm.php
@@ -51,4 +65,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {}
+  public function preview(array &$form, FormStateInterface $form_state) {
+    return new Response('#ajax-triggered submit worked!');
+  }

I'm a bit confused as this does not have an assertion

Wim Leers’s picture

#8: You're right; I added that and then realized I could only manually trigger that, and hence that'd be pointless. I can just remove that hunk.

larowlan’s picture

just a gentle plug for #2232861: Create BrowserTestBase for web-testing on top of Mink
we *need* front-end testing, please review :)

twistor’s picture

I just ran into this. #7 fixes the issue.

mikeker’s picture

Marked #2385599: "Add new view" AJAX returns the entire form as a dup of this bug. The patch in #7 fixes that issue.

Wim Leers’s picture

FileSize
6.6 KB
1.9 KB

This reroll addresses #8, and adds a comment explaining why we can't test it (basically what I wrote in #7).

Anybody want to RTBC this patch and make many UIs across Drupal 8 work again? :)

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

I think the added test coverage is sufficient for what we can test. The explanation is a bit verbose on the ::preview but I see where it confused @dawehner originally. Looks good :)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 1193f67 and pushed to 8.0.x. Thanks!

diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php
index 2ac88e1..cbb7093 100644
--- a/core/modules/system/src/Tests/Ajax/DialogTest.php
+++ b/core/modules/system/src/Tests/Ajax/DialogTest.php
@@ -6,7 +6,7 @@
  */
 
 namespace Drupal\system\Tests\Ajax;
-use Drupal\Core\Ajax\SettingsCommand;
+
 use Drupal\Core\Url;
 
 /**

Fixed on commit - SettingsCommand was not used.

  • alexpott committed 1193f67 on 8.0.x
    Issue #2384545 by Wim Leers, jbrown: $element['#ajax']['callback'] is...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.