mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
@@ -119,12 +119,10 @@ if (! function_exists('Filament\Support\generate_href_html')) {
|
||||
{
|
||||
$html = "href=\"{$url}\"";
|
||||
|
||||
if (FilamentView::hasSpaMode() && str($url)->startsWith(request()->root())) {
|
||||
$html .= ' wire:navigate';
|
||||
}
|
||||
|
||||
if ($shouldOpenInNewTab) {
|
||||
$html .= ' target="_blank"';
|
||||
} elseif (FilamentView::hasSpaMode() && str($url)->startsWith(request()->root())) {
|
||||
$html .= ' wire:navigate';
|
||||
}
|
||||
|
||||
return new HtmlString($html);
|
||||
|
||||
@@ -40,7 +40,7 @@ test('`wire:navigate` is not used in the `href` HTML if it doesn\'t match the re
|
||||
test('`target` HTML can be generated if the URL should open in a new tab', function () {
|
||||
FilamentView::spa();
|
||||
expect(generate_href_html('http://localhost/page', shouldOpenInNewTab: true))
|
||||
->toHtml()->toBe('href="http://localhost/page" wire:navigate target="_blank"');
|
||||
->toHtml()->toBe('href="http://localhost/page" target="_blank"');
|
||||
|
||||
FilamentView::spa(false);
|
||||
expect(generate_href_html('http://localhost/page', shouldOpenInNewTab: true))
|
||||
|
||||
Reference in New Issue
Block a user