? overlay_subtabs_invisible.png
Index: privatemsg.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.pages.inc,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 privatemsg.pages.inc
--- privatemsg.pages.inc	19 Jun 2010 11:30:33 -0000	1.1.2.9
+++ privatemsg.pages.inc	20 Jun 2010 08:49:59 -0000
@@ -278,23 +278,23 @@ function privatemsg_new($form, &$form_st
     $body      = $form_state['values']['body'];
   }
   if (!$thread_id && !empty($recipients_string)) {
-    drupal_set_title(t('Write new message to %recipient', array('%recipient' => $recipients_string)));
+    drupal_set_title(t('Write new message to @recipient', array('@recipient' => $recipients_string)));
   } elseif (!$thread_id) {
     drupal_set_title(t('Write new message'));
   }
 
-  $form = array();
+  $form = array(
+    '#type'     => 'fieldset',
+    '#access'   => privatemsg_user_access('write privatemsg'),
+  );
   if (isset($form_state['privatemsg_preview'])) {
     $form['message_header'] = array(
       '#type' => 'fieldset',
       '#attributes' => array('class' => array('preview')),
+      '#weight' => -20,
     );
     $form['message_header']['message_preview'] = $form_state['privatemsg_preview'];
   }
-  $form = array(
-    '#type'               => 'fieldset',
-    '#access'             => privatemsg_user_access('write privatemsg'),
-  );
   $form['author'] = array(
     '#type' => 'value',
     '#value' => $user,
Index: privatemsg.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.test,v
retrieving revision 1.2.2.1.2.23
diff -u -p -r1.2.2.1.2.23 privatemsg.test
--- privatemsg.test	19 Jun 2010 11:30:33 -0000	1.2.2.1.2.23
+++ privatemsg.test	20 Jun 2010 08:49:59 -0000
@@ -723,7 +723,24 @@ class PrivatemsgTestCase extends DrupalW
   }
 
   /**
-   * Implementation of tearDown().
+   * Test preview functionality.
+   */
+  function testPreview() {
+    $user = $this->drupalCreateUser(array('read privatemsg', 'write privatemsg'));
+
+    $message = array(
+      'recipient' => $user->name,
+      'subject' => $this->randomName(),
+      'body[value]' => $this->randomName(50),
+    );
+    $this->drupalLogin($user);
+    $this->drupalPost('messages/new', $message, t('Preview message'));
+    $this->assertTitle(t('Write new message to @user', array('@user' => $user->name)) . ' | Drupal', t('Correct title is displayed.'));
+    $this->assertFieldByXPath($this->buildXPathQuery('//div[@class=:class]/p', array(':class' => 'privatemsg-message-body')), $message['body[value]'], t('Message body is previewed'));
+  }
+
+  /**
+   * Implements tearDown().
    */
   function tearDown() {
     //we dont really need to do this. i'm adding it just to keep it in front of my eyes so i can memorize it.
