Skip to content
Snippets Groups Projects
Commit dfff6528 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #385602 by Damien Tournoud, desbeers, Gabor Hojtsy: log message...

- Patch #385602 by Damien Tournoud, desbeers, Gabor Hojtsy: log message sometimes lost on node preview. With a test\!
parent 852b7622
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -91,6 +91,8 @@ function node_object_prepare(&$node) {
}
else {
$node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
// Remove the log message from the original node object.
$node->log = NULL;
}
// Always use the default revision setting.
$node->revision = in_array('revision', $node_options);
......@@ -179,6 +181,7 @@ function node_form(&$form_state, $node) {
'#type' => 'textarea',
'#title' => t('Revision log message'),
'#rows' => 4,
'#default_value' => !empty($node->log) ? $node->log : '',
'#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'),
);
}
......
......@@ -400,6 +400,33 @@ class PagePreviewTestCase extends DrupalWebTestCase {
$this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
$this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
}
/**
* Check the node preview functionality, when using revisions.
*/
function testPagePreviewWithRevisions() {
// Force revision on page content.
variable_set('node_options_page', array('status', 'revision'));
// Fill in node creation form and preview node.
$edit = array();
$edit['title'] = $this->randomName(8);
$edit['body'] = $this->randomName(16);
$edit['log'] = $this->randomName(32);
$this->drupalPost('node/add/page', $edit, t('Preview'));
// Check that the preview is displaying the title and body.
$this->assertTitle(t('Preview | Drupal'), t('Page title is preview.'));
$this->assertText($edit['title'], t('Title displayed.'));
$this->assertText($edit['body'], t('Body displayed.'));
// Check that the title and body fields are displayed with the correct values.
$this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
$this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
// Check that the log field has the correct value.
$this->assertFieldByName('log', $edit['log'], t('Log field displayed.'));
}
}
class PageCreationTestCase extends DrupalWebTestCase {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment