mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-03 06:44:07 +01:00
#1109: Fixed "js:" encoding BC-break in CHtml::ajax() and related methods introduced in 1.1.11, added tests
This commit is contained in:
24
tests/framework/web/helpers/CJavaScriptTest.php
Normal file
24
tests/framework/web/helpers/CJavaScriptTest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* CJavaScriptTest
|
||||
*/
|
||||
class CJavaScriptTest extends CTestCase
|
||||
{
|
||||
public function testLegacyEncode()
|
||||
{
|
||||
$expression=CJavaScript::encode("js:function() { /* callback */ }");
|
||||
$this->assertEquals("function() { /* callback */ }",$expression);
|
||||
}
|
||||
|
||||
public function testLegacyEncodeSafe()
|
||||
{
|
||||
$expression=CJavaScript::encode("js:function() { /* callback */ }",true);
|
||||
$this->assertEquals("'js:function() { /* callback */ }'",$expression);
|
||||
}
|
||||
|
||||
public function testEncode()
|
||||
{
|
||||
$expression=CJavaScript::encode(new CJavaScriptExpression("function() { /* callback */ }"));
|
||||
$this->assertEquals("function() { /* callback */ }",$expression);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user