limit amount of items in calendar drag and drop boxes (#2291)
This commit is contained in:
@@ -130,7 +130,8 @@ class AppExtensionTest extends TestCase
|
||||
'api_key' => null,
|
||||
'sources' => [],
|
||||
],
|
||||
'weekends' => true
|
||||
'weekends' => true,
|
||||
'dragdrop_amount' => 10,
|
||||
],
|
||||
'kimai.dashboard' => [],
|
||||
'kimai.widgets' => [],
|
||||
|
||||
@@ -128,6 +128,19 @@ class ConfigurationTest extends TestCase
|
||||
$this->assertConfig($config, []);
|
||||
}
|
||||
|
||||
public function testValidateCalendarDragDropMaxEntries()
|
||||
{
|
||||
$this->expectException(InvalidConfigurationException::class);
|
||||
$this->expectExceptionMessage('Invalid configuration for path "kimai.calendar.dragdrop_amount": The dragdrop_amount must be between 0 and 20');
|
||||
|
||||
$config = $this->getMinConfig();
|
||||
$config['calendar'] = [
|
||||
'dragdrop_amount' => 50,
|
||||
];
|
||||
|
||||
$this->assertConfig($config, []);
|
||||
}
|
||||
|
||||
public function testValidateLdapFilterInvalidParenthesisCounter()
|
||||
{
|
||||
$this->expectException(InvalidConfigurationException::class);
|
||||
@@ -346,6 +359,7 @@ class ConfigurationTest extends TestCase
|
||||
],
|
||||
],
|
||||
'weekends' => true,
|
||||
'dragdrop_amount' => 10,
|
||||
],
|
||||
'theme' => [
|
||||
'active_warning' => 3,
|
||||
|
||||
@@ -24,7 +24,7 @@ class CalendarDragAndDropSourceEventTest extends TestCase
|
||||
$user = new User();
|
||||
$user->setAlias('foo');
|
||||
|
||||
$sut = new CalendarDragAndDropSourceEvent($user);
|
||||
$sut = new CalendarDragAndDropSourceEvent($user, 10);
|
||||
|
||||
$hello = new TestDragAndDropSource('hello');
|
||||
$tmp1 = new TestDragAndDropSource('foo');
|
||||
@@ -40,6 +40,7 @@ class CalendarDragAndDropSourceEventTest extends TestCase
|
||||
self::assertInstanceOf(CalendarDragAndDropSourceEvent::class, $sut->addSource($tmp3));
|
||||
self::assertCount(4, $sut->getSources());
|
||||
self::assertEquals([$tmp1, $tmp2, $hello, $tmp3], $sut->getSources());
|
||||
self::assertEquals(10, $sut->getMaxEntries());
|
||||
|
||||
self::assertFalse($sut->removeSource(new TestDragAndDropSource('foo')));
|
||||
self::assertTrue($sut->removeSource($hello));
|
||||
|
||||
Reference in New Issue
Block a user