diff --git a/tests/Feature/Views/SidebarBrandViewTest.php b/tests/Feature/Views/SidebarBrandViewTest.php new file mode 100644 index 00000000..10b840bf --- /dev/null +++ b/tests/Feature/Views/SidebarBrandViewTest.php @@ -0,0 +1,71 @@ +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'); + } +}