Verified Commit fe3be7e1 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2314443 by olli, Lendude, immaculatexavier, dawehner: Changing view...

Issue #2314443 by olli, Lendude, immaculatexavier, dawehner: Changing view name does not update page title in views ui
parent 5888e036
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ public function __construct($title) {
  public function render() {
    return [
      'command' => 'viewsReplaceTitle',
      'selector' => $this->title,
      'title' => $this->title,
      'siteName' => \Drupal::config('system.site')->get('name'),
    ];
  }

+22 −0
Original line number Diff line number Diff line
@@ -81,6 +81,28 @@ public function testAddDisplay() {
    $this->assertNotEmpty($element);
  }

  /**
   * Tests setting the administrative title.
   */
  public function testRenameDisplayAdminName() {
    $titles = ['New admin title', '</title><script>alert("alert!")</script>'];
    foreach ($titles as $new_title) {
      $this->drupalGet('admin/structure/views/view/test_content_ajax');
      $page = $this->getSession()->getPage();

      $page->findLink('Edit view name/description')->click();
      $this->getSession()->executeScript("document.title = 'Initial title | " . \Drupal::config('system.site')->get('name') . "'");

      $admin_name_field = $this->assertSession()
        ->waitForField('Administrative name');
      $dialog_buttons = $page->find('css', '.ui-dialog-buttonset');
      $admin_name_field->setValue($new_title);

      $dialog_buttons->pressButton('Apply');
      $this->assertJsCondition("document.title === '" . $new_title . " (Content) | " . \Drupal::config('system.site')->get('name') . "'");
    }
  }

  /**
   * Tests contextual links on Views page displays.
   */