Merge pull request #8567 from fouteox/patch-2

Update helpers.php
This commit is contained in:
Dan Harrin
2023-09-18 08:57:50 +01:00
committed by GitHub
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -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);
+1 -1
View File
@@ -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))