aboutsummaryrefslogtreecommitdiffstats
path: root/test/caldav/sax
diff options
context:
space:
mode:
authorGareth Aye <gaye@mozilla.com>2014-04-08 20:39:18 -0400
committerGareth Aye <gaye@mozilla.com>2014-04-08 20:55:13 -0400
commitb15fe723595219e0e31ec84af246446668d297c8 (patch)
tree77d5299e63ae923a20457eae50ac1353990d5752 /test/caldav/sax
parentc197deab25d8425bdfa8d8d2feccedbb2776a48e (diff)
downloadjsCalDAV-b15fe723595219e0e31ec84af246446668d297c8.tar.gz
Bug 974554 - CalDAV parser should accept ical inside xml comments nested in <calendar-data> elements
Diffstat (limited to 'test/caldav/sax')
-rw-r--r--test/caldav/sax/calendar_data_handler_test.js50
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');
+ });
});
});
});
-