diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php index 333cc6a..e3399ca 100644 --- a/core/modules/system/src/Tests/Ajax/DialogTest.php +++ b/core/modules/system/src/Tests/Ajax/DialogTest.php @@ -43,7 +43,7 @@ public function testDialog() { 'data' => $dialog_contents, 'dialogOptions' => array( 'modal' => TRUE, - 'title' => 'AJAX Dialog contents', + 'title' => 'AJAX Dialog & contents', ), ); $form_expected_response = array( @@ -71,7 +71,7 @@ public function testDialog() { 'data' => $dialog_contents, 'dialogOptions' => array( 'modal' => FALSE, - 'title' => 'AJAX Dialog contents', + 'title' => 'AJAX Dialog & contents', ), ); $no_target_expected_response = array( @@ -81,7 +81,7 @@ public function testDialog() { 'data' => $dialog_contents, 'dialogOptions' => array( 'modal' => FALSE, - 'title' => 'AJAX Dialog contents', + 'title' => 'AJAX Dialog & contents', ), ); $close_expected_response = array( @@ -101,6 +101,9 @@ public function testDialog() { // Emulate going to the JS version of the page and check the JSON response. $ajax_result = $this->drupalGetAjax('ajax-test/dialog-contents', array('query' => array(MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_modal'))); $this->assertEqual($modal_expected_response, $ajax_result[3], 'Modal dialog JSON response matches.'); + // Test the HTML escaping of & character. + $this->assertEqual($ajax_result[3]['dialogOptions']['title'], 'AJAX Dialog & contents'); + $this->assertNotEqual($ajax_result[3]['dialogOptions']['title'], 'AJAX Dialog & contents'); // Check that requesting a "normal" dialog without JS goes to a page. $this->drupalGet('ajax-test/dialog-contents'); @@ -156,6 +159,8 @@ public function testDialog() { // Check that the response matches the expected value. $this->assertEqual($modal_expected_response, $ajax_result[4], 'POST request modal dialog JSON response matches.'); + // Test the HTML escaping of & character. + $this->assertNotEqual($ajax_result[4]['dialogOptions']['title'], 'AJAX Dialog & contents'); // Abbreviated test for "normal" dialogs, testing only the difference. $ajax_result = $this->drupalPostAjaxForm('ajax-test/dialog', array(), 'button2'); 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 9cce7be..35df374 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 @@ -28,7 +28,7 @@ class AjaxTestController { public static function dialogContents() { // This is a regular render array; the keys do not have special meaning. $content = array( - '#title' => 'AJAX Dialog contents', + '#title' => 'AJAX Dialog & contents', 'content' => array( '#markup' => 'Example message', ), diff --git a/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php b/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php index 922ef60d..a82e6da 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php +++ b/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php @@ -98,7 +98,7 @@ public function nonModal(&$form, FormStateInterface $form_state) { protected function dialog($is_modal = FALSE) { $content = AjaxTestController::dialogContents(); $response = new AjaxResponse(); - $title = $this->t('AJAX Dialog contents'); + $title = $this->t('AJAX Dialog & contents'); // Attach the library necessary for using the Open(Modal)DialogCommand and // set the attachments for this Ajax response. diff --git a/core/modules/views_ui/src/Tests/FieldUITest.php b/core/modules/views_ui/src/Tests/FieldUITest.php index ec666fb..577b0c9 100644 --- a/core/modules/views_ui/src/Tests/FieldUITest.php +++ b/core/modules/views_ui/src/Tests/FieldUITest.php @@ -62,7 +62,7 @@ public function testFieldUI() { $result = $this->xpath('//details[@id="edit-options-more"]'); $this->assertEqual(empty($result), true, "Container 'more' is empty and should not be displayed."); - // Ensure that dialog titles are not double escaped. + // Ensure that dialog titles are not escaped. $edit_groupby_url = 'admin/structure/views/nojs/handler/test_view/default/field/name'; $this->assertNoLinkByHref($edit_groupby_url, 0, 'No aggregation link found.');