forked from asantibanez/livewire-calendar
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add localization for days asantibanez#30, event count asantibanez#29 …
…and "No description"
- Loading branch information
Showing
5 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<div class="flex-1 h-12 border -mt-px -ml-px flex items-center justify-center bg-indigo-100 text-gray-900" | ||
style="min-width: 10rem;"> | ||
|
||
<p class="text-sm"> | ||
{{ $day->format('l') }} | ||
<p class="text-sm day-of-week"> | ||
{{ $day->locale(app()->getLocale())->isoFormat('dddd') }} | ||
</p> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace LittleSaneVillage\LivewireCalendar\Tests; | ||
|
||
use LittleSaneVillage\LivewireCalendar\Tests\Support\LivewireCalendarTestComponent; | ||
use Livewire\Livewire; | ||
|
||
class ViewLocalization extends TestCase | ||
{ | ||
public function testDayOfWeekLocalization(): void | ||
{ | ||
app()->setLocale('en'); | ||
Livewire::test(LivewireCalendarTestComponent::class) | ||
->assertSeeText('Monday') | ||
->assertDontSeeText('понеділок'); | ||
app()->setLocale('uk'); | ||
Livewire::test(LivewireCalendarTestComponent::class) | ||
->assertDontSeeText('Monday') | ||
->assertSeeText('понеділок'); | ||
} | ||
|
||
public function testEventsLocalization(): void | ||
{ | ||
/** @var \Illuminate\Translation\Translator $translator */ | ||
$translator = app('translator'); | ||
$translator->addLines(['*.event' => 'подія', '*.events' => 'події'], 'uk'); | ||
|
||
app()->setLocale('en'); | ||
Livewire::test(LivewireCalendarTestComponent::class) | ||
->assertSeeText('1 event') | ||
->assertSeeText('2 events'); | ||
|
||
app()->setLocale('uk'); | ||
Livewire::test(LivewireCalendarTestComponent::class) | ||
->assertSeeText('1 подія') | ||
->assertSeeText('2 події'); | ||
} | ||
|
||
public function testNoDescriptionLocalization(): void | ||
{ | ||
/** @var \Illuminate\Translation\Translator $translator */ | ||
$translator = app('translator'); | ||
$translator->addLines(['*.No description' => 'без опису'], 'uk'); | ||
|
||
app()->setLocale('en'); | ||
Livewire::test(LivewireCalendarTestComponent::class) | ||
->assertSeeText('No description'); | ||
|
||
app()->setLocale('uk'); | ||
Livewire::test(LivewireCalendarTestComponent::class) | ||
->assertSeeText('без опису'); | ||
} | ||
} |