{$attribute} || ($attributes->has(':' . $attribute) && $attributes->get(':' . $attribute));
+ }
+
public function asAlpineString(ComponentAttributeBag $attributes, string $tagName): string
{
$rawTag = ':' . $tagName;
- if ($attributes->has($rawTag)) {
+ if ($attributes->has($rawTag) && $attributes->get($rawTag)) {
return $attributes->get($rawTag);
}
@@ -33,4 +39,21 @@ trait RendersAlpine
return $this->{$tagName} ? 'true' : 'false';
}
+
+ public function renderAlpineFallbackAttribute(ComponentAttributeBag $attributes, string $tagName, string $prop): string
+ {
+ return ':label="aaa"';
+
+ return new ComponentAttributeBag([]);
+ return $attributes;
+ }
+
+ public function ca(ComponentAttributeBag $attributes): ComponentAttributeBag
+ {
+ return new ComponentAttributeBag([
+ '::value' => $attributes->get(':label'),
+
+ ]);
+ return ':value="$label" ::value="{!!$attributes->get(":label")!!}"';
+ }
}
diff --git a/docker-compose.yml b/docker-compose.yml
index aa27c717..aa3c52f9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -104,6 +104,8 @@ services:
meilisearch:
image: getmeili/meilisearch:v1.6
+ ports:
+ - '7700:7700'
volumes:
- ./data/meilisearch:/meili_data
env_file:
diff --git a/modules/Contribution/Components/FillList.php b/modules/Contribution/Components/FillList.php
index 625dd14e..f3cc6abd 100644
--- a/modules/Contribution/Components/FillList.php
+++ b/modules/Contribution/Components/FillList.php
@@ -2,14 +2,63 @@
namespace Modules\Contribution\Components;
+use App\Contribution\ContributionFactory;
+use App\Country;
+use Illuminate\Support\Collection;
use Livewire\Component;
class FillList extends Component
{
+
+ public Collection $countries;
+ public ?int $country = null;
+ public Collection $compilers;
+ public string $eventName = '';
+ public string $dateFrom = '';
+ public string $dateUntil = '';
+ public string $zipLocation = '';
+
+ public function mount(): void
+ {
+ $this->countries = Country::select('name', 'id')->get();
+ $this->country = Country::firstWhere('name', 'Deutschland')->id;
+ $this->compilers = app(ContributionFactory::class)->compilerSelect();
+ }
+
public function render()
{
return <<<'HTML'
+
HTML;
}
diff --git a/modules/Contribution/Components/FillListTest.php b/modules/Contribution/Components/FillListTest.php
index 68a1ceaf..d4d8b6a8 100644
--- a/modules/Contribution/Components/FillListTest.php
+++ b/modules/Contribution/Components/FillListTest.php
@@ -2,8 +2,11 @@
namespace Modules\Contribution\Components;
+use App\Contribution\Documents\RdpNrwDocument;
+use App\Country;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
+use Livewire\Livewire;
uses(TestCase::class);
uses(DatabaseTransactions::class);
@@ -16,3 +19,17 @@ it('displays page', function () {
test()->get(route('contribution.index'))
->assertSeeLivewire(FillList::class);
});
+
+it('displays fields', function () {
+ $country = Country::factory()->create(['name' => 'Deutschland']);
+
+ Livewire::test(FillList::class)
+ ->assertSet('compilers.0.class', RdpNrwDocument::class)
+ ->assertSet('compilers.0.title', 'Für RdP NRW erstellen')
+ ->assertSet('countries.0.name', 'Deutschland')
+ ->assertSet('countries.0.id', $country->id)
+ ->assertSet('country', $country->id)
+ ->assertSee('Veranstaltungs-Name')
+ ->assertSee('Datum von')
+ ->assertSee('Deutschland');
+});
diff --git a/tests/Feature/Contribution/IndexTest.php b/tests/Feature/Contribution/IndexTest.php
deleted file mode 100644
index f9bd9ec5..00000000
--- a/tests/Feature/Contribution/IndexTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
-withoutExceptionHandling()->login()->loginNami();
- $country = Country::factory()->create(['name' => 'Deutschland']);
- Member::factory()->defaults()->create(['firstname' => 'Max', 'lastname' => 'Muster']);
- Member::factory()->defaults()->create(['firstname' => 'Jane', 'lastname' => 'Muster']);
-
- $response = $this->get('/contribution');
-
- $this->assertInertiaHas([
- 'class' => RdpNrwDocument::class,
- 'title' => 'Für RdP NRW erstellen',
- ], $response, 'compilers.0');
- $this->assertInertiaHas([
- 'id' => $country->id,
- 'name' => $country->name,
- ], $response, 'countries.0');
- $this->assertInertiaHas([
- 'country' => $country->id,
- ], $response, 'data');
- }
-}
diff --git a/tests/Unit/View/Form/LabelTest.php b/tests/Unit/View/Form/LabelTest.php
index 55f5d3ff..a9ea6682 100644
--- a/tests/Unit/View/Form/LabelTest.php
+++ b/tests/Unit/View/Form/LabelTest.php
@@ -26,6 +26,7 @@ it('renders component', function ($component, $params, $expected = '', $notExpec
'raw php string' => ['
', [], 'x-text="`the label`"'],
'raw js string' => ['
', [], 'x-text="theLabel"'],
'raw js string with tag' => ['
', [], 'x-text="the