1
YUI.add('escape-test', function (Y) {
6
Y.Test.Runner.add(new Y.Test.Case({
9
'html() should escape HTML characters': function () {
10
Assert.areSame('&<>"'/`', Escape.html('&<>"\'/`'));
11
Assert.areSame('&&&', Escape.html('&&&'));
12
Assert.areSame('<<<', Escape.html('<<<'));
13
Assert.areSame('>>>', Escape.html('>>>'));
14
Assert.areSame('"""', Escape.html('"""'));
15
Assert.areSame(''''', Escape.html("'''"));
16
Assert.areSame('///', Escape.html("///"));
17
Assert.areSame('```', Escape.html('```'));
18
Assert.areSame('foo', Escape.html('foo'));
19
Assert.areSame('foo & bar', Escape.html('foo & bar'));
22
'html() should coerce non-strings to strings': function () {
23
Assert.areSame('1', Escape.html(1));
24
Assert.areSame('false', Escape.html(false));
25
Assert.areSame('null', Escape.html(null));
26
Assert.areSame('undefined', Escape.html());
29
'regex() should escape regular expression characters': function () {
30
Assert.areSame('\\-\\#\\$\\^\\*\\(\\)\\+\\[\\]\\{\\}\\|\\\\\\\,\\.\\?\\ \\\t', Escape.regex('-#$^*()+[]{}|\\,.? \t'));
31
Assert.areSame('\\*\\*\\*', Escape.regex('***'));
32
Assert.areSame('foo', Escape.regex('foo'));
33
Assert.areSame('foo\\-bar', Escape.regex('foo-bar'));
36
'regex() should coerce non-strings to strings': function () {
37
Assert.areSame('1', Escape.regex(1));
38
Assert.areSame('false', Escape.regex(false));
39
Assert.areSame('null', Escape.regex(null));
40
Assert.areSame('undefined', Escape.regex());
43
'regexp() should be an alias for regex()': function () {
44
Assert.areSame(Escape.regex, Escape.regexp);
48
}, '@VERSION@', {requires:['escape', 'test']});