Browse Source

Add test for scriptStart() default behavior

ypnos-web 9 years ago
parent
commit
6553c3f554
1 changed files with 15 additions and 3 deletions
  1. 15 3
      tests/TestCase/View/Helper/HtmlHelperTest.php

+ 15 - 3
tests/TestCase/View/Helper/HtmlHelperTest.php

@@ -1148,16 +1148,14 @@ class HtmlHelperTest extends TestCase
      */
     public function testScriptStartAndScriptEnd()
     {
-        $result = $this->Html->scriptStart(['safe' => true]);
+        $result = $this->Html->scriptStart();
         $this->assertNull($result);
         echo 'this is some javascript';
 
         $result = $this->Html->scriptEnd();
         $expected = [
             '<script',
-            $this->cDataStart,
             'this is some javascript',
-            $this->cDataEnd,
             '/script'
         ];
         $this->assertHtml($expected, $result);
@@ -1174,6 +1172,20 @@ class HtmlHelperTest extends TestCase
         ];
         $this->assertHtml($expected, $result);
 
+        $result = $this->Html->scriptStart(['safe' => true]);
+        $this->assertNull($result);
+        echo 'this is some javascript';
+
+        $result = $this->Html->scriptEnd();
+        $expected = [
+            '<script',
+            $this->cDataStart,
+            'this is some javascript',
+            $this->cDataEnd,
+            '/script'
+        ];
+        $this->assertHtml($expected, $result);
+
         $result = $this->Html->scriptStart(['safe' => true, 'type' => 'text/x-handlebars-template']);
         $this->assertNull($result);
         echo 'this is some template';