mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
JavascriptHelper::blockEnd now correctly respects safe option. Test also added. Fixes #5074
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7330 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8d644172c9
commit
aa1b0c776e
2 changed files with 4 additions and 1 deletions
|
@ -217,7 +217,7 @@ class JavascriptHelper extends AppHelper {
|
||||||
echo $this->__scriptBuffer;
|
echo $this->__scriptBuffer;
|
||||||
$this->__scriptBuffer = null;
|
$this->__scriptBuffer = null;
|
||||||
$options = $this->_blockOptions;
|
$options = $this->_blockOptions;
|
||||||
$safe = (isset($options['safe']) || $this->safe);
|
$safe = ((isset($options['safe']) && $options['safe']) || $this->safe);
|
||||||
$this->_blockOptions = array();
|
$this->_blockOptions = array();
|
||||||
$this->inBlock = false;
|
$this->inBlock = false;
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,9 @@ class JavascriptTest extends UnitTestCase {
|
||||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||||
$this->assertNoPattern('/^<script[^type]=[^<>]*>/', $result);
|
$this->assertNoPattern('/^<script[^type]=[^<>]*>/', $result);
|
||||||
|
|
||||||
|
$result = $this->Javascript->blockEnd();
|
||||||
|
$this->assertPattern('/^<\/script>$/', $result);
|
||||||
|
|
||||||
$result = $this->Javascript->codeBlock('something', array('safe' => true));
|
$result = $this->Javascript->codeBlock('something', array('safe' => true));
|
||||||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript">\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
$this->assertPattern('/^<script[^<>]+type="text\/javascript">\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue