diff --git a/core/modules/menu_ui/src/Tests/MenuNodeTest.php b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
index 3fc8423..d939424 100644
--- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
@@ -2,9 +2,11 @@
 
 namespace Drupal\menu_ui\Tests;
 
+use Drupal\Core\Url;
 use Drupal\simpletest\WebTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\menu_link_content\Entity\MenuLinkContent;
+use Drupal\system\Entity\Menu;
 use Drupal\node\Entity\Node;
 
 /**
@@ -22,6 +24,13 @@ class MenuNodeTest extends WebTestBase {
   protected $editor;
 
   /**
+   * A test content type.
+   *
+   * @var \Drupal\node\NodeTypeInterface
+   */
+  protected $contentType;
+
+  /**
    * Modules to enable.
    *
    * @var array
@@ -34,7 +43,7 @@ protected function setUp() {
     $this->drupalPlaceBlock('system_menu_block:main');
     $this->drupalPlaceBlock('page_title_block');
 
-    $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
+    $this->contentType = $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
 
     $this->editor = $this->drupalCreateUser(array(
       'access administration pages',
@@ -338,4 +347,46 @@ function testMultilingualMenuNodeFormWidget() {
     $this->assertFieldById('edit-menu-title', $translated_node_title);
   }
 
+  /**
+   * Test the node form with invalid menu settings.
+   *
+   * Checks whether menu settings fields on node form are valid even if settings
+   * contain invalid menu_ui configuration.
+   */
+  function testNodeFormInvalidMenu() {
+    $menu = Menu::create([
+      'id' => $this->randomMachineName(),
+      'label' => $this->randomString(),
+    ]);
+    $menu->save();
+    // Non-existent menu ID:
+    $menu_id_decoy = $this->randomMachineName();
+
+    $menu_ids = [
+      $menu->id(),
+      $menu_id_decoy,
+    ];
+    $this->contentType
+      ->setThirdPartySetting('menu_ui', 'available_menus', $menu_ids)
+      ->save();
+
+    $menu_link_content = MenuLinkContent::create([
+      'title' => $this->randomString(),
+      'link' => ['uri' => 'route:<front>'],
+      'menu_name' => $menu->id(),
+    ]);
+    $menu_link_content->save();
+
+    $url = Url::fromRoute('node.add')
+      ->setRouteParameter('node_type', $this->contentType->id());
+    $this->drupalGet($url);
+
+    $select_id = 'edit-menu-menu-parent';
+    $options_count = $this->xpath('//select[@id="' . $select_id . '"]/option');
+    $this->assertEqual(2, count($options_count), 'There are two options in the menu parent select field.');
+    $this->assertOption($select_id, $menu->id() . ':');
+    $this->assertOption($select_id, $menu->id() . ':' . $menu_link_content->getPluginId());
+    $this->assertNoOption($select_id, $menu_id_decoy . ':');
+  }
+
 }
diff --git a/core/modules/menu_ui/tests/src/Kernel/MenuNodeTest.php b/core/modules/menu_ui/tests/src/Kernel/MenuNodeTest.php
new file mode 100644
index 0000000..059e3c6
--- /dev/null
+++ b/core/modules/menu_ui/tests/src/Kernel/MenuNodeTest.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Drupal\Tests\menu_ui\Kernel;
+
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\node\Entity\NodeType;
+use Drupal\system\Entity\Menu;
+
+/**
+ * Tests node type settings are updated when menus are changed.
+ *
+ * @group menu_ui
+ */
+class MenuNodeTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system', 'menu_ui', 'node', 'user', 'field', 'text'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->installConfig(['menu_ui', 'node']);
+    $this->installEntitySchema('node');
+  }
+
+  /**
+   * Tests whether node type available menus are updated when a menu is deleted.
+   */
+  public function testNodeTypeAvailableMenu() {
+    $menu = Menu::create(['id' => $this->randomMachineName()]);
+    $menu->save();
+    $node_type = NodeType::create(['type' => $this->randomMachineName()])
+      ->setThirdPartySetting('menu_ui', 'available_menus', [$menu->id()]);
+    $node_type->save();
+    $menu->delete();
+
+    $node_type = NodeType::load($node_type->id());
+    $menu_ids = $node_type->getThirdPartySetting('menu_ui', 'available_menus');
+    $this->assertFalse(in_array($menu->id(), $menu_ids), 'Content type does not contain deleted menu in available_menus setting.');
+  }
+
+}
