diff --git a/core/modules/views_ui/src/Tests/DisplayOrderTest.php b/core/modules/views_ui/src/Tests/DisplayOrderTest.php new file mode 100644 index 0000000..54ccd09 --- /dev/null +++ b/core/modules/views_ui/src/Tests/DisplayOrderTest.php @@ -0,0 +1,69 @@ +set('ui.show.master_display', TRUE) + ->save(); + + $settings['page[create]'] = FALSE; + $view = $this->randomView($settings); + + $path_prefix = 'admin/structure/views/view/' . $view['id'] . '/edit'; + $this->drupalGet($path_prefix); + + // Add a new page display. + $this->drupalPostForm(NULL, array(), 'Add Page'); + $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.'); + + $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/path", array('path' => 'test/path'), t('Apply')); + $this->drupalPostForm(NULL, array(), t('Save')); + + // Add a new block display. + $this->drupalPostForm(NULL, array(), 'Add Block'); + $this->assertLinkByHref($path_prefix . '/block_1', 0, 'Make sure after adding a display the new display appears in the UI'); + + // Test that the new view displays are in the correct order. + $view = Views::getView($view['id']); + $displays = $view->storage->get('display'); + $expected_displays = array('default', 'block_1', 'page_1'); + $this->assertEqual(array_keys($displays), $expected_displays, 'The display names are in correct order.'); + } + +}