diff options
Diffstat (limited to 'test/caldav/sax')
-rw-r--r-- | test/caldav/sax/calendar_data_handler_test.js | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/test/caldav/sax/calendar_data_handler_test.js b/test/caldav/sax/calendar_data_handler_test.js index 867cbe3..9f33192 100644 --- a/test/caldav/sax/calendar_data_handler_test.js +++ b/test/caldav/sax/calendar_data_handler_test.js @@ -34,33 +34,39 @@ suite('caldav/sax/calendar_data_handler', function() { }; }); - suite('ontext', function() { - var originalHandler; + // Should treat text and xml character data the same. + [ + 'ontext', + 'oncdata' + ].forEach(function(nodetype) { + suite(nodetype, function() { + var originalHandler; - suiteSetup(function() { - originalHandler = Handler.parseICAL; - }); + suiteSetup(function() { + originalHandler = Handler.parseICAL; + }); - teardown(function() { - Handler.parseICAL = originalHandler; - }); + teardown(function() { + Handler.parseICAL = originalHandler; + }); - test('without handler', function() { - callProxy('ontext', 'foo'); - assert.equal(proxy.current[0], 'foo'); - }); - test('with handler', function() { - var calledWith; - Handler.parseICAL = function() { - calledWith = arguments; - return 'hit'; - } + test('without handler', function() { + callProxy(nodetype, 'foo'); + assert.equal(proxy.current[0], 'foo'); + }); - callProxy('ontext', 'baz'); - assert.deepEqual(calledWith, ['baz']); - assert.equal(proxy.current[0], 'hit'); + test('with handler', function() { + var calledWith; + Handler.parseICAL = function() { + calledWith = arguments; + return 'hit'; + }; + + callProxy(nodetype, 'baz'); + assert.deepEqual(calledWith, ['baz']); + assert.equal(proxy.current[0], 'hit'); + }); }); }); }); - |