From 46d690ff0188836688811dda9af1b99c44750c48 Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Thu, 3 Feb 2011 16:35:51 -0800
Subject: smarter normalization of value on option, and htmlParser fixes
---
test/sanitizerSpec.js | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
(limited to 'test/sanitizerSpec.js')
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('text', 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('text', 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('', handler);
+ expect(start).toEqual({tag:'option', attrs:{selected:'', value:''}, unary:false});
+ expect(text).toEqual('abc');
+ });
+
});
it('should echo html', function(){
--
cgit v1.2.3