Allow longer blog post excerpts
This commit is contained in:
@@ -79,9 +79,10 @@ class PostResource extends Resource
|
||||
->label('Inhalt')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('excerpt.de')
|
||||
Textarea::make('excerpt.de')
|
||||
->label('Auszug')
|
||||
->maxLength(255),
|
||||
->maxLength(65535)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('meta_title.de')
|
||||
->label('Meta-Titel')
|
||||
->maxLength(255),
|
||||
@@ -99,9 +100,10 @@ class PostResource extends Resource
|
||||
MarkdownEditor::make('content.en')
|
||||
->label('Inhalt')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('excerpt.en')
|
||||
Textarea::make('excerpt.en')
|
||||
->label('Auszug')
|
||||
->maxLength(255),
|
||||
->maxLength(65535)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('meta_title.en')
|
||||
->label('Meta-Titel')
|
||||
->maxLength(255),
|
||||
|
||||
37
tests/Unit/BlogPostExcerptFieldTest.php
Normal file
37
tests/Unit/BlogPostExcerptFieldTest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Filament\Blog\Resources\PostResource;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Schemas\Schema;
|
||||
use Livewire\Component;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BlogPostExcerptFieldTest extends TestCase
|
||||
{
|
||||
public function test_excerpt_fields_allow_long_text(): void
|
||||
{
|
||||
$livewire = new class extends Component implements HasSchemas
|
||||
{
|
||||
use InteractsWithSchemas;
|
||||
|
||||
public function render(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
$schema = PostResource::form(Schema::make($livewire));
|
||||
|
||||
$excerptDe = $schema->getComponentByStatePath('excerpt.de');
|
||||
$excerptEn = $schema->getComponentByStatePath('excerpt.en');
|
||||
|
||||
$this->assertInstanceOf(Textarea::class, $excerptDe);
|
||||
$this->assertInstanceOf(Textarea::class, $excerptEn);
|
||||
$this->assertSame(65535, $excerptDe->getMaxLength());
|
||||
$this->assertSame(65535, $excerptEn->getMaxLength());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user