fix css never been loaded
This commit is contained in:
1 parent
5fc89dfff4
commit
8910a46d1d
4 files changed
+48
No files matched your search
File renamed without changes.
@@ -20,6 +20,7 @@ use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\IDateTimeZone;
|
||||
use OCP\IL10N;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Sabre\VObject\Reader;
|
||||
|
||||
@@ -347,6 +348,12 @@ class CalendarController extends Controller
|
||||
string $calendarId = '',
|
||||
string $error = ''
|
||||
): TemplateResponse {
|
||||
/*
|
||||
* Stylesheets are not auto-loaded, css/style.css
|
||||
* must be registered for the page layout.
|
||||
*/
|
||||
Util::addStyle(Application::APP_ID, 'style');
|
||||
|
||||
return new TemplateResponse(
|
||||
Application::APP_ID,
|
||||
'confirm',
|
||||
|
||||
@@ -24,6 +24,8 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
require_once __DIR__ . '/OCUtilStub.php';
|
||||
|
||||
class CalendarControllerTest extends TestCase
|
||||
{
|
||||
private IManager&MockObject $calendarManager;
|
||||
@@ -709,4 +711,20 @@ class CalendarControllerTest extends TestCase
|
||||
$response->getParams()['errors'][0]['error']
|
||||
);
|
||||
}
|
||||
|
||||
public function testConfirmRegistersStylesheet(): void
|
||||
{
|
||||
$this->userSession->method('getUser')->willReturn($this->mockUser('alice'));
|
||||
$this->setUpWritableCalendars();
|
||||
$this->urlGenerator->method('getAbsoluteURL')->willReturn('https://cloud.example.com/');
|
||||
|
||||
$c = $this->newController();
|
||||
|
||||
$c->confirm('Weekly sync', '', '2026-10-07T14:15', '2026-10-07T15:15');
|
||||
|
||||
$this->assertContains(
|
||||
['atocal', 'style', false],
|
||||
\OC_Util::$styles
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Minimal stand-in for the server class OC_Util, which is not part
|
||||
* of the OCP vendor package. Records addStyle() calls for assertions.
|
||||
*/
|
||||
if (!class_exists(\OC_Util::class, false)) {
|
||||
class OC_Util
|
||||
{
|
||||
/** @var list<array{string, ?string, bool}> */
|
||||
public static array $styles = [];
|
||||
|
||||
public static function addStyle(
|
||||
string $application,
|
||||
?string $file = null,
|
||||
bool $prepend = false
|
||||
): void {
|
||||
self::$styles[] = [$application, $file, $prepend];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user