diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test
index b12ccb1..95ff7f7 100755
--- a/modules/simpletest/tests/menu.test
+++ b/modules/simpletest/tests/menu.test
@@ -1644,3 +1644,127 @@ class MenuTrailTestCase extends MenuWebTestCase {
     $this->assertBreadcrumb('admin/config/development/menu-trail', $override_breadcrumb, t('Menu trail - Case 2'), $override_tree);
   }
 }
+
+
+/**
+ * Menu node edit form tests.
+ *
+ * Tests using the content type screen to enable menus.
+ * Tests using node edit form to add a menu item to a node.
+ * Tests that loading and saving a menu via code doesn't cause data loss.
+ */
+class MenuNodeUITestCase extends MenuWebTestCase {
+  protected $web_user;
+  protected $admin_user;
+
+  public static function getInfo() {
+    return array(
+        'name' => 'Node editing',
+        'description' => 'Tests menu management from node edit page.',
+        'group' => 'Menu',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+    $this->web_user = $this->drupalCreateUser(array('edit own page content', 'create page content', 'administer menu'));
+    $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer nodes'));
+  }
+
+
+  /**
+   * Tests node edit form for menus.
+   */
+  function testMenuNodeUI() {
+
+    $type = 'page';
+    $langcode = LANGUAGE_NONE;
+
+    // Enable menu support for the node type.
+    // Try enabling menus on content types *through the UI*,
+    // as that's what we are testing.
+    $this->drupalLogin($this->admin_user);
+    $this->drupalGet('admin/structure/types/manage/' . $type);
+    $this->assertResponse(200, t('Content type admin form loaded'));
+    $edit = array();
+    // The main-menu should show items in the nav bar by default.
+    // This means we don't have to worry about enabling blocks etc.
+    $edit['menu_options[main-menu]'] = 'main-menu';
+    $edit['menu_parent'] = 'main-menu:0';
+    $this->drupalPost(NULL, $edit, 'Saving content type');
+
+    // Check it sticks, by reloading the form and checking values are there.
+    $this->drupalGet('admin/structure/types/manage/' . $type);
+    $this->assertFieldChecked('edit-menu-options-main-menu', t('Menu preferences for content type were saved OK'));
+
+    // Create a node with no menu yet.
+    $this->drupalLogin($this->web_user);
+    $node1 = $this->drupalCreateNode(array('title' => 'No menu yet', 'promoted' => TRUE));
+    $nid1 = $node1->nid;
+
+    // Check the simple node exists now and can be viewed.
+    $this->drupalGet('node');
+
+    // Load the node edit form.
+    $this->drupalGet('node/' . $nid1 . '/edit');
+    $this->assertResponse(200, t('Node edit form loaded'));
+
+    // Enable menu item. By checking buttons.
+    $edit = array();
+    $this->assertField('menu[link_title]', t('Node edit form contains menu settings'));
+    $edit['title'] = 'Node with menu added from UI';
+    $edit['menu[enabled]'] = TRUE;
+    $menu_title = 'A node menu title';
+    $edit['menu[link_title]'] = $menu_title;
+
+    // Save the node.
+    $this->drupalPost(NULL, $edit, 'Save');
+
+    // Load the node page
+    $this->drupalGet('node/' . $nid1);
+
+    // Verify the menu link is showing up on the page.
+    $this->assertRaw($menu_title, t('The menu item text is displayed on the page.'));
+    // Need to check the text is actually in a menu block, not just on the page
+    // somewhere.
+    // ... Though showing in the breadcrumbs is also a sign of success.
+    $href = url('node/' . $nid1);
+    $found = $this->xpath('//*[contains(@class, "menu")]//a[@href=:href]', array(':href' => $href));
+    $this->assertTrue((count($found) > 0), t('A link to the node appears in a menu now'));
+
+    // Here's a potential issue.
+
+    // Programatically load the node.
+    $node = node_load($nid1);
+    // Make a small change to the node.
+    $node->title = "Node title changed";
+    $node->log = "Updated a litle bit";
+    // Save.
+    node_save($node);
+
+    // Verify the menu link is still showing up.
+    $this->drupalGet('node/' . $nid1);
+    $this->assertRaw($menu_title, t('Node still has a menu after being simply edited programatically.'));
+
+    // That is as expected.
+
+    // But this one fails:
+    // Programatically load the node.
+    $node = node_load($nid1);
+    // Make a small change to the node.
+    $node->title = "Node title changed again";
+    $node->log = "Updated a litle bit more";
+
+    // If we run this, data loss happens:
+    node_object_prepare($node);
+    // 'Preparing' an object should be a safe act.
+
+    // Save.
+    node_save($node);
+
+    // Verify the menu link is still showing up.
+    $this->drupalGet('node/' . $nid1);
+    $this->assertRaw($menu_title, t('Node still has a menu after being edited and prepared programatically.'));
+  }
+
+}
