Rename clean_js to js_string and have it return a complete JS string (with delimiters) instead of just the string contents.

Benefits: Using json_encode(), which is very robust. And as a user, it's clearer how to use this API compared to what it was before.
This commit is contained in:
Andy Staudacher
2009-08-30 15:21:02 -07:00
parent b5813f92c7
commit beb711d6a0
5 changed files with 14 additions and 22 deletions

View File

@@ -40,9 +40,9 @@ class Html_Helper_Test extends Unit_Test_Case {
$safe_string_2);
}
public function clean_js_test() {
$string = html::clean_js("hello's <p >world</p>");
$this->assert_equal("hello\\'s <p >world<\\/p>",
public function js_string_test() {
$string = html::js_string("hello's <p >world</p>");
$this->assert_equal('"hello\'s <p >world<\\/p>"',
$string);
}