Skip to content
Snippets Groups Projects

Issue#3376566: Display page title even it's zero.

Closed Issue#3376566: Display page title even it's zero.
5 unresolved threads
5 unresolved threads

Closes #3376566

Merge request reports

Merge request pipeline #116402 passed

Merge request pipeline passed for 3e20aefe

Approval is optional
Code Quality is loading
Test summary results are being parsed

Closed by Théodore BiadalaThéodore Biadala 1 year ago (Mar 15, 2024 10:42pm UTC)

Merge details

  • The changes were not merged into 11.x.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
109 99 // Test that the title appears as <title> when reloading the node page.
110 100 $this->drupalGet('node/' . $node->id());
111 101 $this->assertSession()->responseContains('<title>' . $edge_case_title_escaped . ' | Drupal</title>');
102 }
112 103
104 /**
105 * Data provider for testNodeWithTitle0().
106 *
107 * @return array[][]
108 * The test cases.
109 */
110 public function providerTestNodeWithTitle0() {
  • 114 ],
    115 'Claro theme' => [
    116 'claro',
    117 ],
    118 'Olivero theme' => [
    119 'olivero',
    120 ],
    121 ];
    122 }
    123
    124 /**
    125 * Creates one node with title 0 and tests if the node title has the correct value.
    126 *
    127 * @dataProvider providerTestNodeWithTitle0
    128 */
    129 public function testNodeWithTitle0($theme) {
  • 20 20 %}
    21 21
    22 22 {{ title_prefix }}
    23 {% if title|render|striptags|trim %}
    23 {% if (title is not empty)|render|striptags|trim %}
  • Kunal Sachdev added 1 commit

    added 1 commit

    • b77f2ead - add return types, type-hints in test

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 125 * Creates one node with title 0 and tests if the node title has the correct value.
    126 *
    127 * @dataProvider providerTestNodeWithTitle0
    128 */
    129 public function testNodeWithTitle0(string $theme): void {
    130 if ($theme !== $this->defaultTheme) {
    131 $system_theme_config = $this->container->get('config.factory')
    132 ->getEditable('system.theme');
    133 $system_theme_config
    134 ->set('default', $theme)
    135 ->save();
    136 \Drupal::service('theme_installer')->install([$theme]);
    137 }
    138 $edit['admin_theme'] = $theme;
    139 $this->drupalGet('admin/appearance');
    140 $this->submitForm($edit, 'Save configuration');
  • Kunal Sachdev added 1 commit

    added 1 commit

    Compare with previous version

  • Kunal Sachdev added 1 commit

    added 1 commit

    Compare with previous version

  • Kunal Sachdev added 303 commits

    added 303 commits

    Compare with previous version

  • 111 101 // Test that the title appears as <title> when reloading the node page.
    112 102 $this->drupalGet('node/' . $node->id());
    113 103 $this->assertSession()->responseContains('<title>' . $edge_case_title_escaped . ' | Drupal</title>');
    104 }
    114 105
    106 /**
    107 * Creates one node with title 0 and tests if the node title has the correct value.
    108 */
    109 public function testNodeWithTitle0(): void {
    • instead of adding this here, can we extend \Drupal\FunctionalTests\Theme\OliveroTest instead? it does not seem like this is an appropriate place to test olivero, especially since the original test already had a check for the "0" as a title case.

    • I know that the existing test had a test for "0" title case but it was only tested for one theme. I added this test here because it tests other themes along with the olivero theme.

      If we remove this test from here and shift the test in Olivero specific test class, then for testing claro also we'll have to add new test in Claro specific test class.

      Edited by Kunal Sachdev
    • Feedback from @catch :

      If we're going to test the same thing in three themes (and umami too, so maybe four?) then it should probably have a NodeTitleTest base class where only the theme name is required.

    • For modules we have GenericTest, we could try something similar for themes

    • Kunal Sachdev changed this line in version 12 of the diff

      changed this line in version 12 of the diff

    • Please register or sign in to reply
  • Kunal Sachdev added 217 commits

    added 217 commits

    Compare with previous version

  • Kunal Sachdev added 1 commit

    added 1 commit

    • 71a84e58 - revert changes in core/modules/node/tests/src/Functional/NodeTitleTest.php

    Compare with previous version

  • Kunal Sachdev added 1 commit

    added 1 commit

    • ca7b3c85 - add new test base and add different tests in respective themes

    Compare with previous version

  • Kunal Sachdev added 1 commit

    added 1 commit

    Compare with previous version

  • Kunal Sachdev added 1 commit

    added 1 commit

    Compare with previous version

  • Kunal Sachdev added 1 commit

    added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading