diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php index 914c0e401af..c76ed8988e9 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php @@ -289,6 +289,88 @@ class EditLoadingTest extends WebTestBase { } } + /** + * Tests the loading of Edit for the title base field. + */ + public function testTitleBaseField() { + $this->drupalLogin($this->editor_user); + $this->drupalGet('node/1'); + + // Retrieving the metadata should result in a 200 JSON response. + $htmlPageDrupalSettings = $this->drupalSettings; + $post = array('fields[0]' => 'node/1/title/und/full'); + $response = $this->drupalPost('edit/metadata', 'application/json', $post); + $this->assertResponse(200); + $expected = array( + 'node/1/title/und/full' => array( + 'label' => 'Title', + 'access' => TRUE, + 'editor' => 'plain_text', + 'aria' => 'Entity node 1, field Title', + ) + ); + $this->assertIdentical(drupal_json_decode($response), $expected, 'The metadata HTTP request answers with the correct JSON response.'); + // Restore drupalSettings to build the next requests; simpletest wipes them + // after a JSON response. + $this->drupalSettings = $htmlPageDrupalSettings; + + // Retrieving the form for this field should result in a 200 response, + // containing only an editFieldForm command. + $post = array('nocssjs' => 'true', 'reset' => 'true') + $this->getAjaxPageStatePostData(); + $response = $this->drupalPost('edit/form/' . 'node/1/title/und/full', 'application/vnd.drupal-ajax', $post); + $this->assertResponse(200); + $ajax_commands = drupal_json_decode($response); + $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); + $this->assertIdentical('editFieldForm', $ajax_commands[0]['command'], 'The first AJAX command is an editFieldForm command.'); + $this->assertIdentical('