Commit bfd507f4 authored by alexpott's avatar alexpott
Browse files

Issue #1992730 by xjm: Sentence-case dropbutton actions in the Views UI.

parent e21c1a13
......@@ -52,10 +52,10 @@ function testAnalyzeBasic() {
$this->drupalLogin($this->admin);
$this->drupalGet('admin/structure/views/view/test_view/edit');
$this->assertLink(t('analyze view'));
$this->assertLink(t('Analyze view'));
// This redirects the user to the analyze form.
$this->clickLink(t('analyze view'));
$this->clickLink(t('Analyze view'));
$this->assertText(t('View analysis'));
foreach (array('ok', 'warning', 'error') as $type) {
......
......@@ -35,13 +35,13 @@ public function testPathUI() {
// Add a new page display and check the appearing text.
$this->drupalPost(NULL, array(), 'Add Page');
$this->assertText(t('No path is set'), 'The right text appears if no path was set.');
$this->assertNoLink(t('view @display', array('@display' => 'page')), 'No view page link found on the page.');
$this->assertNoLink(t('View @display', array('@display' => 'page')), 'No view page link found on the page.');
// Save a path and make sure the summary appears as expected.
$random_path = $this->randomName();
$this->drupalPost("admin/structure/views/nojs/display/test_view/page_1/path", array('path' => $random_path), t('Apply'));
$this->assertText('/' . $random_path, 'The custom path appears in the summary.');
$this->assertLink(t('view @display', array('@display' => 'Page')), 0, 'view page link found on the page.');
$this->assertLink(t('View @display', array('@display' => 'Page')), 0, 'view page link found on the page.');
}
/**
......@@ -50,7 +50,7 @@ public function testPathUI() {
public function testDeleteWithNoPath() {
$this->drupalGet('admin/structure/views/view/test_view');
$this->drupalPost(NULL, array(), t('Add Page'));
$this->drupalPost(NULL, array(), t('delete Page'));
$this->drupalPost(NULL, array(), t('Delete Page'));
$this->drupalPost(NULL, array(), t('Save'));
$this->assertRaw(t('The view %view has been saved.', array('%view' => 'Test view')));
}
......
......@@ -63,14 +63,14 @@ public function testRemoveDisplay() {
$path_prefix = 'admin/structure/views/view/' . $view['id'] .'/edit';
$this->drupalGet($path_prefix . '/default');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-delete', 'delete Page', 'Make sure there is no delete button on the default display.');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-delete', 'Delete Page', 'Make sure there is no delete button on the default display.');
$this->drupalGet($path_prefix . '/page_1');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-delete', 'delete Page', 'Make sure there is a delete button on the page display.');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-delete', 'Delete Page', 'Make sure there is a delete button on the page display.');
// Delete the page, so we can test the undo process.
$this->drupalPost($path_prefix . '/page_1', array(), 'delete Page');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-undo-delete', 'undo delete of Page', 'Make sure there a undo button on the page display after deleting.');
$this->drupalPost($path_prefix . '/page_1', array(), 'Delete Page');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-undo-delete', 'Undo delete of Page', 'Make sure there a undo button on the page display after deleting.');
$element = $this->xpath('//a[contains(@href, :href) and contains(@class, :class)]', array(':href' => $path_prefix . '/page_1', ':class' => 'views-display-deleted-link'));
$this->assertTrue(!empty($element), 'Make sure the display link is marked as to be deleted.');
......@@ -78,12 +78,12 @@ public function testRemoveDisplay() {
$this->assertTrue(!empty($element), 'Make sure the display link is marked as to be deleted.');
// Undo the deleting of the display.
$this->drupalPost($path_prefix . '/page_1', array(), 'undo delete of Page');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-undo-delete', 'undo delete of Page', 'Make sure there is no undo button on the page display after reverting.');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-delete', 'delete Page', 'Make sure there is a delete button on the page display after the reverting.');
$this->drupalPost($path_prefix . '/page_1', array(), 'Undo delete of Page');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-undo-delete', 'Undo delete of Page', 'Make sure there is no undo button on the page display after reverting.');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-delete', 'Delete Page', 'Make sure there is a delete button on the page display after the reverting.');
// Now delete again and save the view.
$this->drupalPost($path_prefix . '/page_1', array(), 'delete Page');
$this->drupalPost($path_prefix . '/page_1', array(), 'Delete Page');
$this->drupalPost(NULL, array(), t('Save'));
$this->assertNoLinkByHref($path_prefix . '/page_1', 'Make sure there is no display tab for the deleted display.');
......@@ -120,7 +120,7 @@ public function testReorderDisplay() {
$view = $this->randomView($view);
$path_prefix = 'admin/structure/views/view/' . $view['id'] .'/edit';
$this->clickLink(t('reorder displays'));
$this->clickLink(t('Reorder displays'));
$this->assertTrue($this->xpath('//tr[@id="display-row-default"]'), 'Make sure the default display appears on the reorder listing');
$this->assertTrue($this->xpath('//tr[@id="display-row-page_1"]'), 'Make sure the page display appears on the reorder listing');
$this->assertTrue($this->xpath('//tr[@id="display-row-block_1"]'), 'Make sure the block display appears on the reorder listing');
......@@ -157,7 +157,7 @@ public function testCloneDisplay() {
$path_prefix = 'admin/structure/views/view/' . $view['id'] .'/edit';
$this->drupalGet($path_prefix);
$this->drupalPost(NULL, array(), 'clone Page');
$this->drupalPost(NULL, array(), 'Clone Page');
$this->assertLinkByHref($path_prefix . '/page_2', 0, 'Make sure after cloning the new display appears in the UI');
$this->assertUrl($path_prefix . '/page_2', array(), 'The user got redirected to the new display.');
......@@ -168,7 +168,7 @@ public function testCloneDisplay() {
$this->drupalPost("admin/structure/views/nojs/display/{$view['id']}/page_2/css_class", array('override[dropdown]' => 'page_2', 'css_class' => $random_css), t('Apply'));
// Clone as a different display type.
$this->drupalPost(NULL, array(), 'clone as Block');
$this->drupalPost(NULL, array(), 'Clone as Block');
$this->assertLinkByHref($path_prefix . '/block_1', 0, 'Make sure after cloning the new display appears in the UI');
$this->assertUrl($path_prefix . '/block_1', array(), 'The user got redirected to the new display.');
$this->assertText(t('Block settings'));
......@@ -201,12 +201,12 @@ public function testDisableDisplay() {
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is visible.');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is not visible.');
$this->drupalPost(NULL, array(), 'disable Page');
$this->drupalPost(NULL, array(), 'Disable Page');
$this->assertTrue($this->xpath('//div[contains(@class, :class)]', array(':class' => 'views-display-disabled')), 'Make sure the disabled display css class appears once the display is marked as such.');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is not visible.');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is visible.');
$this->drupalPost(NULL, array(), 'enable Page');
$this->drupalPost(NULL, array(), 'Enable Page');
$this->assertFalse($this->xpath('//div[contains(@class, :class)]', array(':class' => 'views-display-disabled')), 'Make sure the disabled display css class does not appears once the display is enabled again.');
}
......
......@@ -396,7 +396,7 @@ public function getDisplayDetails($view, $display) {
if (!$is_enabled) {
$build['top']['actions']['enable'] = array(
'#type' => 'submit',
'#value' => t('enable @display_title', array('@display_title' => $display_title)),
'#value' => t('Enable @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayEnable'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="enable">',
......@@ -410,7 +410,7 @@ public function getDisplayDetails($view, $display) {
if ($path && (strpos($path, '%') === FALSE)) {
$build['top']['actions']['path'] = array(
'#type' => 'link',
'#title' => t('view @display', array('@display' => $display['display_title'])),
'#title' => t('View @display', array('@display' => $display['display_title'])),
'#options' => array('alt' => array(t("Go to the real page for this display"))),
'#href' => $path,
'#prefix' => '<li class="view">',
......@@ -421,7 +421,7 @@ public function getDisplayDetails($view, $display) {
if (!$is_default) {
$build['top']['actions']['duplicate'] = array(
'#type' => 'submit',
'#value' => t('clone @display_title', array('@display_title' => $display_title)),
'#value' => t('Clone @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDuplicate'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="duplicate">',
......@@ -431,7 +431,7 @@ public function getDisplayDetails($view, $display) {
// Always allow a display to be deleted.
$build['top']['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('delete @display_title', array('@display_title' => $display_title)),
'#value' => t('Delete @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDelete'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="delete">',
......@@ -445,7 +445,7 @@ public function getDisplayDetails($view, $display) {
$build['top']['actions']['clone_as'][$type] = array(
'#type' => 'submit',
'#value' => t('clone as @type', array('@type' => $label)),
'#value' => t('Clone as @type', array('@type' => $label)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitCloneDisplayAsType'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="duplicate">',
......@@ -456,7 +456,7 @@ public function getDisplayDetails($view, $display) {
else {
$build['top']['actions']['undo_delete'] = array(
'#type' => 'submit',
'#value' => t('undo delete of @display_title', array('@display_title' => $display_title)),
'#value' => t('Undo delete of @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayUndoDelete'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="undo-delete">',
......@@ -466,7 +466,7 @@ public function getDisplayDetails($view, $display) {
if ($is_enabled) {
$build['top']['actions']['disable'] = array(
'#type' => 'submit',
'#value' => t('disable @display_title', array('@display_title' => $display_title)),
'#value' => t('Disable @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDisable'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="disable">',
......@@ -674,21 +674,21 @@ public function renderDisplayTop(ViewUI $view) {
),
'#links' => array(
'edit-details' => array(
'title' => t('edit view name/description'),
'title' => t('Edit view name/description'),
'href' => "admin/structure/views/nojs/edit-details/{$view->id()}/$display_id",
'attributes' => array('class' => array('views-ajax-link')),
),
'analyze' => array(
'title' => t('analyze view'),
'title' => t('Analyze view'),
'href' => "admin/structure/views/nojs/analyze/{$view->id()}/$display_id",
'attributes' => array('class' => array('views-ajax-link')),
),
'clone' => array(
'title' => t('clone view'),
'title' => t('Clone view'),
'href' => "admin/structure/views/view/{$view->id()}/clone",
),
'reorder' => array(
'title' => t('reorder displays'),
'title' => t('Reorder displays'),
'href' => "admin/structure/views/nojs/reorder-displays/{$view->id()}/$display_id",
'attributes' => array('class' => array('views-ajax-link')),
),
......@@ -701,14 +701,14 @@ public function renderDisplayTop(ViewUI $view) {
if (isset($view->type) && $view->type != t('Default')) {
if ($view->type == t('Overridden')) {
$element['extra_actions']['#links']['revert'] = array(
'title' => t('revert view'),
'title' => t('Revert view'),
'href' => "admin/structure/views/view/{$view->id()}/revert",
'query' => array('destination' => "admin/structure/views/view/{$view->id()}"),
);
}
else {
$element['extra_actions']['#links']['delete'] = array(
'title' => t('delete view'),
'title' => t('Delete view'),
'href' => "admin/structure/views/view/{$view->id()}/delete",
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment