Files
coolify/tests/Feature/MetricsTooltipStylingTest.php
T
Andras Bacsai bd7d0b5de1 feat(charts): show local and UTC times in metric tooltips
Chart tooltips now list the viewer's local time and UTC with short
timezone names, instead of a UTC-only stamp. Also add a little left
padding on the traffic requests chart so axis labels are not clipped.
2026-09-08 13:31:40 +02:00

43 lines
1.7 KiB
PHP

<?php
test('apexcharts delegates tooltip chrome to the custom content', function () {
$utilities = file_get_contents(resource_path('css/utilities.css'));
preg_match('/@utility apexcharts-tooltip \{[^}]*\}/s', $utilities, $tooltip);
preg_match('/@utility apexcharts-tooltip-custom \{[^}]*\}/s', $utilities, $customTooltip);
expect($tooltip[0] ?? '')
->toContain('overflow-visible!')
->toContain('rounded-none!')
->toContain('border-0!')
->toContain('bg-transparent!')
->toContain('shadow-none!')
->not->toContain('dark:border-coolgray-300!')
->not->toContain('dark:bg-coolgray-200!')
->and($customTooltip[0] ?? '')
->toContain('border-neutral-200')
->toContain('dark:border-coolgray-300')
->toContain('rounded-lg')
->toContain('shadow-lg');
});
test('metrics charts render custom tooltip content', function (string $view) {
expect(file_get_contents(resource_path($view)))
->toContain('apexcharts-tooltip-custom');
})->with([
'dashboard server metrics' => 'views/livewire/dashboard/server-metrics-chart.blade.php',
'server metrics' => 'views/livewire/server/charts.blade.php',
'resource metrics' => 'views/livewire/project/shared/metrics.blade.php',
]);
test('server metric tooltips show local and UTC timestamps', function (string $view) {
expect(file_get_contents(resource_path($view)))
->toContain('formatLocalTimestamp(timestamp)')
->toContain('formatUtcTimestamp(timestamp)')
->toContain('Your time:')
->toContain('UTC:');
})->with([
'dashboard server metrics' => 'views/livewire/dashboard/server-metrics-chart.blade.php',
'server metrics' => 'views/livewire/server/charts.blade.php',
]);