Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions core/tests/Unit/Manager/ActionButtonsStyleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

function actionButtonsCss(): string
{
$dir = dirname(__DIR__, 4) . '/manager/media/style/default/css/';

return file_get_contents($dir . 'custom.css') . "\n" . file_get_contents($dir . 'forms.css');
}

test('the save button has no darker band along its bottom edge', function () {
expect(actionButtonsCss())->not->toMatch('/#actions[^{]*\.btn-success[^{]*\{[^}]*box-shadow/');
});

test('action button text sits 1px higher than the forms.css padding puts it', function () {
$css = actionButtonsCss();

expect($css)->toContain('#actions .btn-group .btn { padding-top: calc(.46153846em - 1px) }')
// the chevron toggle keeps the full padding, so it does not move with the text
->and($css)->toMatch('/#actions \.btn-group \.plus \{[^}]*padding: \.46153846em 0;/');
});
26 changes: 26 additions & 0 deletions core/tests/Unit/Manager/MenuItemGroupStyleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

test('the icon-only button beside a menu item (Clear cache) centres its SVG icon', function () {
$css = file_get_contents(dirname(__DIR__, 4) . '/manager/media/style/default/css/mainmenu.css');

// menu icons are inline SVGs: a rule for icon-font elements alone left their label gap on the right
expect($css)->toMatch('/#mainMenu \.nav li\.item-group > \*:not\(:first-child\) svg \{\s*margin-right: 0;/')
->and($css)->toMatch('/#mainMenu \.nav li\.item-group > \*:not\(:first-child\) \{\s*vertical-align: middle;/');
});

test('top menu dropdowns end at their last item, which takes the rounded corners', function () {
$css = file_get_contents(dirname(__DIR__, 4) . '/manager/media/style/default/css/mainmenu.css');
preg_match('/#mainMenu \.nav > li > ul \{([^}]*)\}/', $css, $rule);

// bottom padding under the last item showed as a white strip below its hover background
expect($rule[1] ?? '')->toMatch('/\bpadding: 0;/')
->and($rule[1] ?? '')->toContain('border-radius: 0 0 0.25rem 0.25rem;')
->and($rule[1] ?? '')->toContain('overflow: auto;');
});

test('the last top menu item is as tall as the others, which carry a 1px separator', function () {
$css = file_get_contents(dirname(__DIR__, 4) . '/manager/media/style/default/css/mainmenu.css');

expect($css)->toMatch('/#mainMenu \.nav > li > ul > li \{\s*border-bottom: 1px solid[^}]*margin-bottom: -1px;/')
->and($css)->toMatch('/#mainMenu \.nav > li > ul > li:last-child > a:first-child,\s*#mainMenu \.nav > li > ul > li:last-child > span:first-child \{\s*padding-bottom: 1px;/');
});
6 changes: 3 additions & 3 deletions manager/media/style/default/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ select[name=context] + input[type=submit] { float: none; margin: 0; }
#actions .btn-group > .btn-group { display: block }
#actions .btn-group .btn, #actions .btn-group .form-control {
font-size: .6772rem; height: 2.4em; line-height: 1.4 }
/* the forms.css padding sets the text 1px below the middle of these fixed-height buttons */
#actions .btn-group .btn { padding-top: calc(.46153846em - 1px) }
#actions .btn-group .btn .fa, #_actions .btn-group .btn .fa { display: none; width: 1em; font-size: 1em; text-align: center }
#actions .btn-group .btn-group #Button1 { min-width: 100%; text-align: left; float: right; }
#actions .btn-group .btn-success { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .07); }
#actions .btn-group .btn-success:hover { box-shadow: none }
/* the in-place save: the join box between "Save" and the stay option shows +, a spinner, then a check mark, at one width */
#actions .btn-group #Button1 .save-join { display: inline-block; position: relative; width: 1.4em; margin: 0 .25em; text-align: center }
#actions .btn-group #Button1.saving { pointer-events: none; opacity: .75 }
#actions .btn-group #Button1.saving .save-join, #actions .btn-group #Button1.saved .save-join { color: transparent }
#actions .btn-group #Button1.saving .save-join::before { content: ''; position: absolute; left: 50%; top: 50%; width: .8em; height: .8em; margin: -.45em 0 0 -.45em; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: evo-save-spin .7s linear infinite }
#actions .btn-group #Button1.saved .save-join::before { content: '\2713'; position: absolute; left: 0; right: 0; top: 0; color: #fff }
@keyframes evo-save-spin { to { transform: rotate(360deg) } }
#actions .btn-group .plus { z-index: 2; float: right; margin: -2.4em 0 0 0; width: 2rem; padding-left: 0; padding-right: 0; text-align: center; cursor: pointer; }
#actions .btn-group .plus { z-index: 2; float: right; margin: -2.4em 0 0 0; width: 2rem; padding: .46153846em 0; text-align: center; cursor: pointer; }
#actions .btn-group .plus::before { content: "\f107"; font-weight: 900; font-family: 'Font Awesome 5 Free' }
#actions .btn-group .show .plus::before { content: "\f106"; }
#actions .btn-group select#stay { display: block; position: relative; z-index: -1; clear: both; width: auto; height: 0; margin: -100% 0 -2rem 0; font-size: 0.675rem; opacity: 0; visibility: hidden; }
Expand Down
1 change: 0 additions & 1 deletion manager/media/style/default/css/forms.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions manager/media/style/default/css/mainmenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ body.sidebar-closed #bars .icon-collapse { display: none !important; }
top: 100%;
left: 0;
margin: 0;
padding: 0 0 0.25rem;
/* no bottom padding: the last item reaches the rounded edge (overflow clips it), so its hover leaves no strip */
padding: 0;
min-width: 15rem;
max-height: -webkit-calc(100vh - var(--manager-menu-height, 2.2rem));
max-height: calc(100vh - var(--manager-menu-height, 2.2rem));
Expand Down Expand Up @@ -303,6 +304,11 @@ body.sidebar-closed #bars .icon-collapse { display: none !important; }
border: none;
margin-bottom: 0;
}
/* no separator below the last item: one more pixel keeps it as tall as the others, in its own hover colour */
#mainMenu .nav > li > ul > li:last-child > a:first-child,
#mainMenu .nav > li > ul > li:last-child > span:first-child {
padding-bottom: 1px;
}
#mainMenu .nav > li > ul > li.item-input {
padding: 0.375em 0.5em;
}
Expand Down Expand Up @@ -434,7 +440,12 @@ body.sidebar-closed #bars .icon-collapse { display: none !important; }
#mainMenu .nav li.item-group > *:first-child {
width: 100%;
}
#mainMenu .nav li.item-group > *:not(:first-child) .fa {
/* an icon-only button beside the item: centred, without the gap menu icons keep before their label */
#mainMenu .nav li.item-group > *:not(:first-child) {
vertical-align: middle;
}
#mainMenu .nav li.item-group > *:not(:first-child) .fa,
#mainMenu .nav li.item-group > *:not(:first-child) svg {
margin-right: 0;
}
/* statusbar */
Expand Down
Loading