#1109: Fixed "js:" encoding BC-break in CHtml::ajax() and related methods introduced in 1.1.11, added tests

This commit is contained in:
Alexander Makarov
2012-08-06 22:57:45 +04:00
parent b8fab37277
commit 14a33f0153
5 changed files with 62 additions and 5 deletions

View 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);
}
}