Issue #2587755 by aerozeppelin, NickWilde, swentel: AJAX error when using progress bar on file field widget
							parent
							
								
									d8cf1783df
								
							
						
					
					
						commit
						de27f1970a
					
				| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
file.ajax_progress:
 | 
			
		||||
  path: '/file/progress'
 | 
			
		||||
  path: '/file/progress/{key}'
 | 
			
		||||
  defaults:
 | 
			
		||||
    _controller: '\Drupal\file\Controller\FileWidgetAjaxController::progress'
 | 
			
		||||
  requirements:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -271,7 +271,7 @@ class ManagedFile extends FormElement {
 | 
			
		|||
      }
 | 
			
		||||
 | 
			
		||||
      // 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 @@ class FileFieldWidgetTest extends FileFieldTestBase {
 | 
			
		|||
 | 
			
		||||
    // 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...');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue