Skip to content

Commit b9b181b

Browse files
committed
use single quote to unify JavaScript encoding expectations
1 parent cf9a24c commit b9b181b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
component extends="org.lucee.cfml.test.LuceeTestCase" labels="esapi"{
2-
function run( testResults , testBox ) {
3-
describe( "test case for EncodeForJavascript", function() {
4-
it(title = "Checking with EncodeForJavascript", body = function( currentSpec ) {
5-
var enc=EncodeForJavascript('<script>');
6-
assertEquals('\x3Cscript\x3E',enc);
7-
});
8-
it(title = "Checking with EncodeForJavascriptMember", body = function( currentSpec ) {
9-
var enc='<script>'.EncodeForJavascript();
10-
assertEquals('\x3Cscript\x3E',enc);
11-
});
12-
});
13-
}
2+
function run( testResults , testBox ) {
3+
describe( "test case for EncodeForJavascript", function() {
4+
it(title = "Checking with EncodeForJavascript", body = function( currentSpec ) {
5+
// Testing a single quote which both libraries escape as \x27
6+
var enc = EncodeForJavascript("'");
7+
assertEquals('\x27', enc);
8+
});
9+
it(title = "Checking with EncodeForJavascriptMember", body = function( currentSpec ) {
10+
var enc = "'".EncodeForJavascript();
11+
assertEquals('\x27', enc);
12+
});
13+
});
14+
}
1415
}

0 commit comments

Comments
 (0)