Files
cacti/tests/Unit/Ui/Html/ThemeContextMenuStylesTest.php
Thomas Vincent 62063a29e0 fix(theme): [develop] correct CSS cascade, invalid values and responsive selectors (#8293)
* fix(themes): correct CSS cascade, font fallbacks and responsive selectors

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(themes): remove validated empty and redundant CSS rules

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* style(css): remove reviewed inactive rules and redundant separators

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* style(themes): consolidate two reviewed duplicate selectors

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(themes): remove identical whitespace declaration after consolidation

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(theme): keep context menu fallbacks in Cacti overrides

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(theme): measure native CSS and header coverage

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: retain bootstrap coverage and validate request dispatch

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: synchronize native coverage fixture dispatch

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: measure coverage at the exact PR revision

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: cover Midwinter and graph heading CSS repairs in Chromium

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: take the theme coverage base from the merge commit parent

- github.event.pull_request.base.sha can predate the develop tip the checkout was merged onto, which counted develop's own CSS lines as the PR's.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 22:51:15 -04:00

33 lines
874 B
PHP

<?php
// Copyright (C) 2026 The Cacti Group. GPL-2.0-or-later.
require_once dirname(__DIR__, 4) . '/lib/html.php';
test('the common header loads context menu font overrides for the selected theme', function ($theme, $path) {
$saved = [];
foreach (['config', '_SESSION', 'settings_user'] as $key) {
$saved[$key] = [array_key_exists($key, $GLOBALS), $GLOBALS[$key] ?? null];
}
$GLOBALS['settings_user'] ??= [];
ob_start();
try {
html_common_header('Theme contract', $theme);
$header = ob_get_contents();
} finally {
ob_end_clean();
foreach ($saved as $key => [$exists, $value]) {
if ($exists) {
$GLOBALS[$key] = $value;
} else {
unset($GLOBALS[$key]);
}
}
}
expect($header)->toContain($path);
})->with([
['modern', 'include/css/context_menu_overrides.css'],
['midwinter', 'include/themes/midwinter/context_menu_overrides.css'],
]);