summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-03-18 14:48:36 +0100
committerGitHub <noreply@github.com>2019-03-18 14:48:36 +0100
commit4824d278f9e530d7c5111dc75a1186e7b3ec580e (patch)
tree1d684d9eee65a68e144db4256ee43b66a2ae2c43
parentc41687530d59940792a5bd131d93d27769967e6e (diff)
parent970d52fc298c53d9386dcca83f2eb5fca21167af (diff)
downloadnextcloud-server-4824d278f9e530d7c5111dc75a1186e7b3ec580e.tar.gz
nextcloud-server-4824d278f9e530d7c5111dc75a1186e7b3ec580e.zip
Merge pull request #14666 from nextcloud/design/settings-header
Don't show 'Personal' header in settings when Admin section is not there
-rw-r--r--settings/templates/settings/frame.php4
-rw-r--r--tests/acceptance/features/access-levels.feature3
-rw-r--r--tests/acceptance/features/bootstrap/SettingsMenuContext.php18
3 files changed, 23 insertions, 2 deletions
diff --git a/settings/templates/settings/frame.php b/settings/templates/settings/frame.php
index 1734a92b064..e32c4ed2fc9 100644
--- a/settings/templates/settings/frame.php
+++ b/settings/templates/settings/frame.php
@@ -30,8 +30,10 @@ script('files', 'jquery.fileupload');
<div id="app-navigation">
<ul>
- <li class="app-navigation-caption"><?php p($l->t('Personal')); ?></li>
+ <?php if(!empty($_['forms']['admin'])) { ?>
+ <li class="app-navigation-caption"><?php p($l->t('Personal')); ?></li>
<?php
+ }
foreach($_['forms']['personal'] as $form) {
if (isset($form['anchor'])) {
$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
diff --git a/tests/acceptance/features/access-levels.feature b/tests/acceptance/features/access-levels.feature
index fb6b180be7e..9d5695897c0 100644
--- a/tests/acceptance/features/access-levels.feature
+++ b/tests/acceptance/features/access-levels.feature
@@ -12,7 +12,8 @@ Feature: access-levels
Scenario: regular users cannot see admin-level items on the Settings page
Given I am logged in
When I visit the settings page
- Then I see that the "Personal" settings panel is shown
+ Then I see that the "Personal info" entry in the settings panel is shown
+ And I see that the "Personal" settings panel is not shown
And I see that the "Administration" settings panel is not shown
Scenario: admin users can see admin-level items on the Settings page
diff --git a/tests/acceptance/features/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php
index 3dd5022ecc9..e4e20997fc2 100644
--- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php
+++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php
@@ -94,6 +94,15 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
}
/**
+ * @param string $itemText
+ * @return Locator
+ */
+ private static function settingsPanelEntryFor($itemText) {
+ return Locator::forThe()->xpath("//div[@id = 'app-navigation']//ul//li[normalize-space() = '$itemText']")->
+ describedAs($itemText . " entry in Settings panel");
+ }
+
+ /**
* @return array
*/
public function menuItems() {
@@ -189,6 +198,15 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that the :itemText entry in the settings panel is shown
+ */
+ public function iSeeThatTheItemEntryInTheSettingsPanelIsShown($itemText) {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::settingsPanelEntryFor($itemText), 10)->isVisible()
+ );
+ }
+
+ /**
* @Then I see that the :itemText settings panel is not shown
*/
public function iSeeThatTheItemSettingsPanelIsNotShown($itemText) {