-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: lang switcher missing site language links
- Loading branch information
Showing
10 changed files
with
51 additions
and
15 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
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
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
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,41 @@ | ||
<?php | ||
|
||
use App\Models\Individual; | ||
use App\View\Components\LanguageChanger; | ||
|
||
beforeEach(function () { | ||
$this->model = Individual::factory()->create([ | ||
'bio' => [ | ||
'en' => 'bio (en)', | ||
'fr' => 'bio (fr)', | ||
'es' => 'bio (es)', | ||
], | ||
'languages' => ['en', 'fr', 'es'], | ||
]); | ||
}); | ||
|
||
test('example', function (string $appLocale, ?string $pageLocale) { | ||
App::setLocale($appLocale); | ||
|
||
$contentLocale = $pageLocale ?? $appLocale; | ||
$otherLocales = array_filter($this->model->languages, fn ($code) => $code !== $contentLocale); | ||
|
||
$view = $this->component(LanguageChanger::class, [ | ||
'model' => $this->model, | ||
'currentLanguage' => $pageLocale, | ||
]); | ||
|
||
$view->assertDontSee(get_language_exonym($contentLocale)); | ||
|
||
foreach ($otherLocales as $locale) { | ||
$view->assertSee(get_language_exonym($locale)); | ||
} | ||
})->with([ | ||
'English app locale' => 'en', | ||
'French app locale' => 'fr', | ||
])->with([ | ||
'English page locale' => 'en', | ||
'French page locale' => 'fr', | ||
'Spanish page locale' => 'es', | ||
'No page locale' => null, | ||
]); |