aboutsummaryrefslogtreecommitdiffstats
path: root/test/sanitizerSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-02-03 16:35:51 -0800
committerMisko Hevery2011-02-04 13:44:22 -0800
commit46d690ff0188836688811dda9af1b99c44750c48 (patch)
treef2253031ba3c8574ec93f03a18bb9fb2667aef51 /test/sanitizerSpec.js
parent882f412d578e4f01394847fa5fde21b6b4096de2 (diff)
downloadangular.js-46d690ff0188836688811dda9af1b99c44750c48.tar.bz2
smarter normalization of value on option, and htmlParser fixes
Diffstat (limited to 'test/sanitizerSpec.js')
-rw-r--r--test/sanitizerSpec.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/sanitizerSpec.js b/test/sanitizerSpec.js
index 7158fbee..787ce84c 100644
--- a/test/sanitizerSpec.js
+++ b/test/sanitizerSpec.js
@@ -14,6 +14,11 @@ describe('HTML', function(){
attrs: attrs,
unary: unary
};
+ // Since different browsers handle newlines differenttly we trim
+ // so that it is easier to write tests.
+ forEach(attrs, function(value, key){
+ attrs[key] = trim(value);
+ });
},
chars: function(text_){
text = text_;
@@ -38,16 +43,22 @@ describe('HTML', function(){
it('should parse newlines in attributes', function(){
htmlParser('<tag attr="\nvalue\n">text</tag>', handler);
- expect(start).toEqual({tag:'tag', attrs:{attr:'\nvalue\n'}, unary:false});
+ expect(start).toEqual({tag:'tag', attrs:{attr:'value'}, unary:false});
expect(text).toEqual('text');
});
it('should parse namespace', function(){
htmlParser('<ns:t-a-g ns:a-t-t-r="\nvalue\n">text</ns:t-a-g>', handler);
- expect(start).toEqual({tag:'ns:t-a-g', attrs:{'ns:a-t-t-r':'\nvalue\n'}, unary:false});
+ expect(start).toEqual({tag:'ns:t-a-g', attrs:{'ns:a-t-t-r':'value'}, unary:false});
expect(text).toEqual('text');
});
+ it('should parse empty value attribute of node', function(){
+ htmlParser('<OPTION selected value="">abc</OPTION>', handler);
+ expect(start).toEqual({tag:'option', attrs:{selected:'', value:''}, unary:false});
+ expect(text).toEqual('abc');
+ });
+
});
it('should echo html', function(){