diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml index f990e0a96bb..8ecfa3b3072 100644 --- a/.idea/php-test-framework.xml +++ b/.idea/php-test-framework.xml @@ -17,6 +17,7 @@ + diff --git a/packages/framework/tests/Feature/Views/SidebarBrandViewTest.php b/packages/framework/tests/Feature/Views/SidebarBrandViewTest.php index 76d3c067ace..10b840bf5e4 100644 --- a/packages/framework/tests/Feature/Views/SidebarBrandViewTest.php +++ b/packages/framework/tests/Feature/Views/SidebarBrandViewTest.php @@ -4,12 +4,68 @@ namespace Hyde\Framework\Testing\Feature\Views; +use Hyde\Hyde; use Hyde\Testing\TestCase; +use Hyde\Foundation\HydeKernel; use Hyde\Testing\TestsBladeViews; +use Hyde\Pages\DocumentationPage; class SidebarBrandViewTest extends TestCase { use TestsBladeViews; - // + public function testSidebarBrandView() + { + $view = $this->test(view('hyde::components.docs.sidebar-brand')); + + $view->assertSee('HydePHP Docs'); + $view->assertSee('theme-toggle-button'); + $view->assertDontSee('href'); + } + + public function testSidebarBrandViewWithHomeRoute() + { + Hyde::routes()->addRoute((new DocumentationPage('index'))->getRoute()); + + $view = $this->test(view('hyde::components.docs.sidebar-brand')); + + $view->assertSee('HydePHP Docs'); + $view->assertSee('theme-toggle-button'); + $view->assertSeeHtml('HydePHP Docs', true); + } + + public function testSidebarBrandViewWithDefaultHeaderText() + { + config(['docs.sidebar' => []]); + + $view = $this->test(view('hyde::components.docs.sidebar-brand')); + + $view->assertSee('Documentation'); + $view->assertDontSee('HydePHP Docs'); + } + + public function testSidebarBrandViewWithDefaultHeaderTextAndHomeRoute() + { + Hyde::routes()->addRoute((new DocumentationPage('index'))->getRoute()); + + config(['docs.sidebar' => []]); + + $view = $this->test(view('hyde::components.docs.sidebar-brand')); + + $view->assertSee('Documentation'); + $view->assertSeeHtml('Documentation', true); + $view->assertDontSee('HydePHP Docs'); + } + + public function testSidebarBrandViewWithoutDarkmodeFeature() + { + $mock = $this->mock(HydeKernel::class)->makePartial(); + $mock->shouldReceive('hasFeature')->with('darkmode')->andReturn(false); + HydeKernel::setInstance($mock); + + $view = $this->test(view('hyde::components.docs.sidebar-brand')); + + $view->assertSee('HydePHP Docs'); + $view->assertDontSee('theme-toggle-button'); + } }