');
// English link (inactive when locale is 'ar') should use text-primary
expect($html)
->toContain('text-primary')
->toContain('hover:text-cta-hover')
->toContain('hover:bg-primary/10');
});
test('light variant separator uses text-primary/50 class', function () {
$html = Blade::render('');
expect($html)->toContain('text-primary/50');
});
test('light variant does not use old text-body classes for inactive', function () {
App::setLocale('ar');
$html = Blade::render('');
// Should NOT contain the old classes
expect($html)
->not->toContain('text-body/70')
->not->toContain('hover:text-body');
});
test('light variant separator does not use old text-body/30 class', function () {
$html = Blade::render('');
expect($html)->not->toContain('text-body/30');
});
});
describe('Language Toggle Dark Variant', function () {
test('dark variant inactive language uses text-off-white class', function () {
App::setLocale('ar');
$html = Blade::render('');
// English link (inactive when locale is 'ar') should use text-off-white
expect($html)
->toContain('text-off-white')
->toContain('hover:text-cta')
->toContain('hover:bg-active-hover');
});
test('dark variant separator uses text-cta/50 class', function () {
$html = Blade::render('');
expect($html)->toContain('text-cta/50');
});
test('dark variant does not use light variant classes', function () {
App::setLocale('ar');
$html = Blade::render('');
// Should NOT contain light variant classes
expect($html)
->not->toContain('text-primary/50')
->not->toContain('hover:text-cta-hover')
->not->toContain('hover:bg-primary/10');
});
});
describe('Language Toggle Active State', function () {
test('active language has correct styling regardless of variant', function () {
App::setLocale('ar');
$lightHtml = Blade::render('');
$darkHtml = Blade::render('');
// Both variants should show active state styling for Arabic
expect($lightHtml)
->toContain('bg-active')
->toContain('text-white')
->toContain('font-bold');
expect($darkHtml)
->toContain('bg-active')
->toContain('text-white')
->toContain('font-bold');
});
test('English shows active state when locale is English', function () {
App::setLocale('en');
$html = Blade::render('');
// Should still have active styling classes present
expect($html)
->toContain('bg-active')
->toContain('text-white')
->toContain('font-bold');
});
});
describe('Language Toggle Default Variant', function () {
test('default variant is dark', function () {
App::setLocale('ar');
$defaultHtml = Blade::render('');
$darkHtml = Blade::render('');
// Default should behave same as dark variant
expect($defaultHtml)
->toContain('text-off-white')
->toContain('text-cta/50');
});
});
describe('Language Toggle Structure', function () {
test('contains both Arabic and English language links', function () {
$html = Blade::render('');
expect($html)
->toContain('العربية')
->toContain('English')
->toContain('language-switch-ar')
->toContain('language-switch-en');
});
test('contains separator between languages', function () {
$html = Blade::render('');
expect($html)->toContain('|');
});
});