diff --git a/lib/Drupal/views/Tests/UI/DisplayTest.php b/lib/Drupal/views/Tests/UI/DisplayTest.php index 5a38e696aec77073acb6d2917697da5e9e96cb7d..918478b81fa856760cbf6346b29b45fe5576ec8d 100644 --- a/lib/Drupal/views/Tests/UI/DisplayTest.php +++ b/lib/Drupal/views/Tests/UI/DisplayTest.php @@ -73,16 +73,23 @@ public function testRemoveDisplay() { * Tests adding a display. */ public function testAddDisplay() { + // Show the master display. + config('views.settings')->set('ui.show.master_display', TRUE)->save(); + $settings['page[create]'] = FALSE; $view = $this->randomView($settings); $path_prefix = 'admin/structure/views/view/' . $view['name'] .'/edit'; $this->drupalGet($path_prefix); + $this->drupalPost(NULL, array(), t('Save')); // Add a new display. $this->drupalPost(NULL, array(), 'Add Page'); // @todo Revising this after http://drupal.org/node/1793700 got in. $this->assertLinkByHref($path_prefix . '/page_1', 0, 'Make sure after adding a display the new display appears in the UI'); + + $this->assertNoLink('Master*', 0, 'Make sure the master display is not marked as changed.'); + $this->assertLink('Page*', 0, 'Make sure the added display is marked as changed.'); } /** diff --git a/lib/Drupal/views/ViewUI.php b/lib/Drupal/views/ViewUI.php index 5c7e344709582525143c4d385329330b7c89a780..91d7e90f01a83c174fc5daa48517addf4a078784 100644 --- a/lib/Drupal/views/ViewUI.php +++ b/lib/Drupal/views/ViewUI.php @@ -789,6 +789,9 @@ public function submitDisplayAdd($form, &$form_state) { $parents = $form_state['triggering_element']['#parents']; $display_type = array_pop($parents); $display_id = $this->storage->addDisplay($display_type); + // A new display got added so the asterisks symbol should appear on the new + // display. + $this->current_display = $display_id; views_ui_cache_set($this); // Redirect to the new display's edit page.