diff --git a/src/UIKit/Elements/Simple/PageTitle.php b/src/UIKit/Elements/Simple/PageTitle.php index f533644..cc287a9 100755 --- a/src/UIKit/Elements/Simple/PageTitle.php +++ b/src/UIKit/Elements/Simple/PageTitle.php @@ -14,6 +14,8 @@ class PageTitle extends HtmlElement private $reversed = false; + private $stringOnly = false; + public function __construct(array $titleParts, string $separater = " | ") { $this->main = $titleParts; @@ -33,6 +35,10 @@ public function unfold(): string $string = implode($this->separater, $this->main); + if ($this->stringOnly) { + return $string; + } + return Html::title($string)->attr(...$this->attributes)->unfold(); } @@ -41,4 +47,10 @@ public function reversed(): PageTitle $this->reversed = true; return $this; } + + public function stringOnly(): PageTitle + { + $this->stringOnly = true; + return $this; + } } diff --git a/tests/UIKit/SimpleTest.php b/tests/UIKit/SimpleTest.php index 61ecae0..d551355 100755 --- a/tests/UIKit/SimpleTest.php +++ b/tests/UIKit/SimpleTest.php @@ -59,6 +59,15 @@ public function page_title() )->unfoldUsing( UIKit::pageTitle(["Hello, World!", "How are you?"], " : ")->reversed() ); + + AssertEquals::applyWith( + 'How are you? : Hello, World!', + "string", + 1.95, // 1.82, // 0.91, // 0.71, // 0.6, + 3 + )->unfoldUsing( + UIKit::pageTitle(["Hello, World!", "How are you?"], " : ")->reversed()->stringOnly() + ); } /**