Commit f48f760f authored by alexpott's avatar alexpott

Issue #2285245 by Devin Carlson, martin107, swentel, mducharme: Fixed Missing...

Issue #2285245 by Devin Carlson, martin107, swentel, mducharme: Fixed Missing "Save" button on shortcut links list.
parent 12feabd3
......@@ -87,6 +87,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
// Only includes a Save action for the entity, no direct Delete button.
return array(
'submit' => array(
'#type' => 'submit',
'#value' => t('Save changes'),
'#access' => (bool) Element::getVisibleChildren($form['shortcuts']['links']),
'#submit' => array('::submit', '::save'),
......
......@@ -32,6 +32,58 @@ function testShortcutSetAdd() {
$this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
}
/**
* Tests editing a shortcut set.
*/
function testShortcutSetEdit() {
$set = $this->set;
$shortcuts = $set->getShortcuts();
// Visit the shortcut set edit admin ui.
$this->drupalGet('admin/config/user-interface/shortcut/manage/' . $set->id() . '/customize');
// Test for the page title.
$this->assertTitle(t('List links') . ' | Drupal');
// Test for the table.
$element = $this->xpath('//div[@class="layout-content"]//table');
$this->assertTrue($element, 'Shortcut entity list table found.');
// Test the table header.
$elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
$this->assertEqual(count($elements), 3, 'Correct number of table header cells found.');
// Test the contents of each th cell.
$expected_items = array(t('Name'), t('Weight'), t('Operations'));
foreach ($elements as $key => $element) {
$this->assertIdentical((string) $element[0], $expected_items[$key]);
}
// Look for test shortcuts in the table.
$weight = count($shortcuts);
$edit = array();
foreach ($shortcuts as $shortcut) {
$title = $shortcut->getTitle();
// Confirm that a link to the shortcut is found within the table.
$this->assertLink($title);
// Look for a test shortcut weight select form element.
$this->assertFieldByName('shortcuts[links][' . $shortcut->id() . '][weight]');
// Change the weight of the shortcut.
$edit['shortcuts[links][' . $shortcut->id() . '][weight]'] = $weight;
$weight--;
}
$this->drupalPostForm(NULL, $edit, t('Save changes'));
$this->assertRaw(t('The shortcut set has been updated.'));
// Check to ensure that the shortcut weights have changed.
$weights = $this->getShortcutInformation($set, 'weight');
$this->assertEqual($weights, array(2, 1));
}
/**
* Tests switching a user's own shortcut set.
*/
......
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