diff --git a/core/modules/contact/src/Tests/MessageEntityTest.php b/core/modules/contact/src/Tests/MessageEntityTest.php
index 7d9b9b2..1ef2c42 100644
--- a/core/modules/contact/src/Tests/MessageEntityTest.php
+++ b/core/modules/contact/src/Tests/MessageEntityTest.php
@@ -6,8 +6,11 @@
 
 namespace Drupal\contact\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\contact\Entity\Message;
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
 use Drupal\system\Tests\Entity\EntityUnitTestBase;
+use Drupal\user\Entity\User;
 
 /**
  * Tests the message entity class.
@@ -73,4 +76,57 @@ public function testMessageMethods() {
     $this->assertFalse($message->access('edit', $access_user));
   }
 
+  /**
+   * Tests the extra fields visibility on the message form.
+   */
+  public function testExtraFieldsVisibility() {
+    // Simulate a logged in user. We need this to check the access to 'copy'
+    // base field. That field is accessible only for logged in users.
+    $account = $this->createUser([], ['access site-wide contact form']);
+    $this->container->get('current_user')->setAccount($account);
+
+    $base_fields = ['name', 'mail', 'copy'];
+
+    /** @var \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder */
+    $entity_form_builder = $this->container->get('entity.form_builder');
+
+    /** @var \Drupal\contact\MessageInterface $message */
+    $message = Message::create(['contact_form' => 'feedback']);
+    $message->save();
+
+    $form_display = EntityFormDisplay::create([
+      'targetEntityType' => 'contact_message',
+      'bundle' => 'feedback',
+      'mode' => 'default',
+      'status' => TRUE,
+    ]);
+    $form_display->save();
+
+    // Build the form.
+    $form = $entity_form_builder->getForm($message);
+
+    // All base fields should be accessible (with '#access' == TRUE).
+    foreach ($base_fields as $field) {
+      // If '#access' key is missed, then the element is allowed.
+      $access = !isset($form[$field]['#access']) || $form[$field]['#access'];
+      $this->assertTrue($access);
+    }
+
+    // Hide 'name' and 'copy'.
+    $form_display
+      ->removeComponent('name')
+      ->removeComponent('copy')
+      ->save();
+
+    // Reload the form.
+    $form = $entity_form_builder->getForm($message);
+
+    $expectations = array_combine($base_fields, [FALSE, TRUE, FALSE]);
+    foreach($expectations as $field => $expectation) {
+      // If '#access' key is missed, then the element is allowed.
+      $access = !array_key_exists('#access', $form[$field]) || $form[$field]['#access'];
+      $this->assertIdentical($access, $expectation);
+    }
+  }
+
 }
