From d9220625119e9bc5098bbba9103efdec1a01f218 Mon Sep 17 00:00:00 2001 From: John Wood Date: Wed, 28 Jun 2017 23:07:00 -0400 Subject: [PATCH] updating to work the way you'd expect it to work with in-code generation --- src/BladeStrap.php | 14 +++++++------- tests/BladeTest.php | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/BladeStrap.php b/src/BladeStrap.php index d5c8030..375f327 100644 --- a/src/BladeStrap.php +++ b/src/BladeStrap.php @@ -16,12 +16,12 @@ protected static function trim($param) { public static function panel($expression) { $params = static::getParams($expression); - $title = static::trim($params[0]); - $class = isset($params[1]) ? "panel-".static::trim($params[1]) : "panel-default"; + $title = trim($params[0]); + $class = isset($params[1]) ? "'panel-".static::trim($params[1])."'" : "'panel-default'"; - $html = "
"; + $html = "
"; if ($title) { - $html .= "

{$title}

"; + $html .= "

"; } $html .= "
"; @@ -37,11 +37,11 @@ public static function endPanel($expression) { public static function alert($expression) { $params = static::getParams($expression); - $title = static::trim($params[0]); - $class = isset($params[1]) ? "alert-".static::trim($params[1]) : "alert-info"; + $title = trim($params[0]); + $class = isset($params[1]) ? "'alert-".static::trim($params[1])."'" : "'alert-info'"; - $html = "
"; + $html = "
"; if ($title) { $html .= "
{$title}
"; } diff --git a/tests/BladeTest.php b/tests/BladeTest.php index da91a75..260870b 100644 --- a/tests/BladeTest.php +++ b/tests/BladeTest.php @@ -11,15 +11,15 @@ class BladeTest extends TestCase public function testPanel(){ //default panel $string = BladeStrap::panel(""); - $this->assertEquals("
", $string); + $this->assertEquals("
'>
", $string); //string titles get passed to result $string = BladeStrap::panel("'Test Title'"); - $this->assertContains(">Test Title<", $string); + $this->assertContains("Test Title", $string); //variable titles get passed to result $string = BladeStrap::panel('$title'); - $this->assertContains('>$title<', $string); + $this->assertContains('$title', $string); //custom panel types titles $string = BladeStrap::panel('($title, "primary")'); @@ -37,15 +37,15 @@ public function testEndPanel(){ public function testAlert(){ //default $string = BladeStrap::alert(""); - $this->assertEquals("
", $string); + $this->assertEquals("
'>", $string); //string titles get passed to result $string = BladeStrap::alert("'Test Title'"); - $this->assertContains(">Test Title<", $string); + $this->assertContains("Test Title", $string); //variable titles get passed to result $string = BladeStrap::alert('$title'); - $this->assertContains('>$title<', $string); + $this->assertContains('$title', $string); //custom alert types titles $string = BladeStrap::alert('($title, "primary")');