diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php index b464a46..9951ea7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php @@ -51,5 +51,12 @@ function testSimpleAjaxFormValue() { $expected = new DataCommand('#ajax_checkbox_value', 'form_state_value_select', (int) $item); $this->assertCommand($commands, $expected->render(), 'Verification of AJAX form values from a checkbox issued with a correct value.'); } + + // Verify that an AJAX element without a callback throws error code 500. + $edit = array( + 'select_dummy' => 'red', + ); + $commands = $this->drupalPostAJAX('ajax_forms_test_get_form', $edit, 'select_dummy'); + $this->assertResponse(500); } } diff --git a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module index 1682c01..65273ad 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module +++ b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module @@ -72,6 +72,14 @@ function ajax_forms_test_simple_form($form, &$form_state) { '#type' => 'submit', '#value' => t('submit'), ); + + $form['select_dummy'] = array( + '#type' => 'select', + '#options' => array('red' => 'red'), + '#ajax' => array('callback' => ''), + '#suffix' => '
No color yet selected
', + ); + return $form; }