diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index a8e99d6..32e6e5e 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1787,25 +1787,24 @@ protected function drupalPostForm($path, $edit, $submit, array $options = array( * @see ajax.js */ protected function drupalPostAjaxForm($path, $edit, $triggering_element, $ajax_path = NULL, array $options = array(), array $headers = array(), $form_html_id = NULL, $ajax_settings = NULL) { - if (isset($options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE])) { - $original_wrapper = $options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE]; - unset($options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE]); - } // Get the content of the initial page prior to calling drupalPostForm(), // since drupalPostForm() replaces $this->content. if (isset($path)) { - $this->drupalGet($path, $options); + // Avoid sending the wrapper query argument to drupalGet so we can fetch + // the form and populate the internal WebTest values. + $get_options = $options; + unset($get_options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE]); + $this->drupalGet($path, $get_options); } $content = $this->content; $drupal_settings = $this->drupalSettings; - if (isset($original_wrapper)) { - $options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE] = $original_wrapper; - } - else { - $options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE] = 'drupal_ajax'; - } + // Provide a default value for the wrapper envelope. + $options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE] = + isset($options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE]) ? + $options['query'][MainContentViewSubscriber::WRAPPER_ENVELOPE] : + 'drupal_ajax'; // Get the Ajax settings bound to the triggering element. if (!isset($ajax_settings)) { diff --git a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php index 663a904..fe9ff94 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php @@ -120,7 +120,6 @@ public function dialog() { '#url' => Url::fromRoute('ajax_test.dialog_contents'), '#attributes' => array( 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-modal', // TODO replace this. ), );