Commit de27f197 authored by catch's avatar catch

Issue #2587755 by aerozeppelin, NickWilde, swentel: AJAX error when using...

Issue #2587755 by aerozeppelin, NickWilde, swentel: AJAX error when using progress bar on file field widget
parent d8cf1783
file.ajax_progress:
path: '/file/progress'
path: '/file/progress/{key}'
defaults:
_controller: '\Drupal\file\Controller\FileWidgetAjaxController::progress'
requirements:
......
......@@ -271,7 +271,7 @@ public static function processManagedFile(&$element, FormStateInterface $form_st
}
// Add the upload progress callback.
$element['upload_button']['#ajax']['progress']['url'] = Url::fromRoute('file.ajax_progress');
$element['upload_button']['#ajax']['progress']['url'] = Url::fromRoute('file.ajax_progress', ['key' => $upload_progress_key]);
}
// The file upload field itself.
......
......@@ -447,6 +447,12 @@ public function testWidgetElement() {
// If the field has at least a item, the table should be visible.
$this->assertIdentical(count($elements), 1);
// Test for AJAX error when using progress bar on file field widget
$key = $this->randomMachineName();
$this->drupalPost('file/progress/' . $key, 'application/json', []);
$this->assertNoResponse(500, t('No AJAX error when using progress bar on file field widget'));
$this->assertText('Starting upload...');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment