Skip to content

Commit

Permalink
fix: no tittle when not set custom html title
Browse files Browse the repository at this point in the history
This is why I use null coalescing.
  • Loading branch information
hms5232 committed Aug 15, 2024
1 parent 03d61e2 commit c17ca0f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/views/editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@php
$ver = config('swagger.editor.ver') ?? '4.5.0';
$title = config('swagger.editor.title', config('app.name') . ' - Swagger Editor');
$title = config('swagger.editor.title') ?? config('app.name') . ' - SwaggerEditor';
@endphp

<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/ui.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@php
$ver = config('swagger.ui.ver') ?? '4.5.0';
$title = config('swagger.ui.title', config('app.name') . ' - SwaggerUI');
$title = config('swagger.ui.title') ?? config('app.name') . ' - SwaggerUI';
@endphp

<!DOCTYPE html>
Expand Down
8 changes: 8 additions & 0 deletions tests/SwaggerEditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,12 @@ public function testCustomTitle()
$res->assertDontSee(' - Swagger Editor');
$res->assertSee('Custom Swagger Editor');
}

#[Test]
#[DefineEnvironment('swaggerCustomTitle')]
public function testDefaultTitle()
{
$res = $this->get('/swagger-editor');
$res->assertSee(' - Swagger Editor');
}
}
8 changes: 8 additions & 0 deletions tests/SwaggerUiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,12 @@ public function testCustomTitle()
$res->assertDontSee(' - SwaggerUI'); // Default title
$res->assertSee('My Swagger UI');
}

#[Test]
#[DefineEnvironment('enableLS')]
public function testDefaultTitle()
{
$res = $this->get('/swagger');
$res->assertSee(' - SwaggerUI'); // Default title
}
}

0 comments on commit c17ca0f

Please sign in to comment.