only in patch2: unchanged: --- a/core/modules/node/content_types.js +++ b/core/modules/node/content_types.js @@ -45,17 +45,6 @@ return vals.join(', '); }); - $context.find('#edit-display').drupalSetSummary(function (context) { - var vals = []; - var $editContext = $(context); - $editContext.find('input:checked').next('label').each(function () { - vals.push(Drupal.checkPlain($(this).text())); - }); - if (!$editContext.find('#edit-display-submitted').is(':checked')) { - vals.unshift(Drupal.t("Don't display post information")); - } - return vals.join(', '); - }); } }; only in patch2: unchanged: --- a/core/modules/node/tests/src/Functional/NodePostSettingsTest.php +++ b/core/modules/node/tests/src/Functional/NodePostSettingsTest.php @@ -1,6 +1,7 @@ drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); + $page_type = NodeType::load('page'); + $page_type->setDisplaySubmitted(TRUE); + $page_type->save(); // Create a node. $edit = []; @@ -40,9 +41,8 @@ public function testPagePostInfo() { $node->delete(); // Set "Basic page" content type to display post information. - $edit = []; - $edit['display_submitted'] = FALSE; - $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); + $page_type->setDisplaySubmitted(FALSE); + $page_type->save(); // Create a node. $edit = []; only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/src/Tests/Update/UpdateNodeTypeTest.php @@ -0,0 +1,74 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + ]; + } + + /** + * Tests that authored on / by base fields are created correctly. + */ + public function testNodeTypeSetDisplaySubmitted() { + // First, let's confirm that the article node type displays the + // authored by / on information. + $article_type = NodeType::load('article'); + $this->assertTrue($article_type->displaySubmitted(), t('The node type article displays the content author and creation date.')); + + // Confirm that the current article view modes don't have the + // authored on / by base fields configuration. + foreach (['teaser', 'default'] as $view_mode) { + $config = $this->config('core.entity_view_display.node.article.' . $view_mode)->get('data'); + $this->assertFalse(isset($config['content']['created']), t('The authored on (created) base field does not exist in the article !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertFalse(isset($config['content']['uid']), t('The authored by (uid) base field does not exist in the article !view_mode view mode.', array('!view_mode' => $view_mode))); + } + + // Second, let's confirm that the page node type doesn't display the + // authored by / on information. + $page_type = NodeType::load('page'); + $this->assertFalse($page_type->displaySubmitted(), t('The node type page does not display the content author and creation date.')); + + // Confirm that the current page view modes don't have the + // authored on / by base fields configuration. + foreach (['teaser', 'default'] as $view_mode) { + $config = $this->config('core.entity_view_display.node.page.' . $view_mode)->get('data'); + $this->assertFalse(isset($config['content']['created']), t('The authored on (created) base field does not exist in the page !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertFalse(isset($config['content']['uid']), t('The authored by (uid) base field does not exist in the page !view_mode view mode.', array('!view_mode' => $view_mode))); + } + + $this->runUpdates(); + + // Confirm that the updates added the authored on / by base fields to the + // view mode configuration. + foreach (['teaser', 'default'] as $view_mode) { + $config = $this->config('core.entity_view_display.node.article.' . $view_mode)->get('data'); + $this->assertTrue(isset($config['content']['created']), t('The authored on (created) base field exists in the article !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertTrue(isset($config['content']['uid']), t('The authored by (uid) base field exists in the article !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertEqual($config['content']['created']['region'], 'content', t('The authored on (created) base field appears in the content region of the article !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertEqual($config['content']['uid']['region'], 'content', t('The authored by (uid) base field appears in the content region of the article !view_mode view mode.', array('!view_mode' => $view_mode))); + } + // Confirm that the updates added the authored on / by base fields to the + // view mode configuration. + foreach (['teaser', 'default'] as $view_mode) { + $config = $this->config('core.entity_view_display.node.page.' . $view_mode)->get('data'); + $this->assertTrue(isset($config['content']['created']), t('The authored on (created) base field exists in the page !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertTrue(isset($config['content']['uid']), t('The authored by (uid) base field exists in the page !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertTrue($config['hidden']['created'], t('The authored on (created) base field is hidden in the page !view_mode view mode.', array('!view_mode' => $view_mode))); + $this->assertTrue($config['hidden']['uid'], t('The authored by (uid) base field is hidden in the page !view_mode view mode.', array('!view_mode' => $view_mode))); + } + } +}