diff options
author | James Lal <james@lightsofapollo.com> | 2012-06-18 20:59:35 -0700 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2012-06-18 20:59:35 -0700 |
commit | f1ae9e6f2a4503b9c5ab55abb13d95cbd9ee753c (patch) | |
tree | d628e71dc77c8fa422e91ef453c809b0dc3a2dac /test/caldav/sax_test.js | |
parent | a6c747412c0960331e4055eee97d8328ff88d584 (diff) | |
download | jsCalDAV-f1ae9e6f2a4503b9c5ab55abb13d95cbd9ee753c.tar.gz |
Rename lib to webcals
Diffstat (limited to 'test/caldav/sax_test.js')
-rw-r--r-- | test/caldav/sax_test.js | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/test/caldav/sax_test.js b/test/caldav/sax_test.js deleted file mode 100644 index 83d69c1..0000000 --- a/test/caldav/sax_test.js +++ /dev/null @@ -1,93 +0,0 @@ -var xml = requireLib('sax'); - -suite('sax test', function() { - - var data, - subject; - - test('existance', function() { - var parser = new xml(); - - var StatusHandler = { - tag: 'DAV:/status', - - onopentag: function(data) { - }, - - ontext: function(data) { - this.current.status = data.match(/([0-9]{3,3})/)[1]; - }, - - onclosetag: function(data) { - this.restoreParser(); - } - }; - - var ResourceTypeHandler = { - tag: 'DAV:/resourcetype', - - onopentag: function(data) { - this.tagStack.push(data.tagSpec); - - if (data.local === 'resourcetype') { - this.current.resourceTypes = []; - } else { - this.current.resourceTypes.push(data.local); - } - }, - - onclosetag: function(data) { - this.checkStackForHandler(true); - this.tagStack.pop(); - } - }; - - var TextOnlyHandler = { - tag: 'DAV:/href', - - onopentag: function(data) { - }, - - ontext: function(data) { - this.current.href = data; - }, - - onclosetag: function(data) { - this.restoreParser(); - } - }; - - var ResponseHandler = { - tag: 'DAV:/response', - handles: { - 'DAV:/status': StatusHandler, - 'DAV:/resourcetype': ResourceTypeHandler, - 'DAV:/href': TextOnlyHandler, - 'DAV:/getetag': TextOnlyHandler - }, - - onclosetag: function(data) { - this.checkStackForHandler(true); - this.onclosetag(data); - }, - - oncomplete: function() { - this.emit('response', this.current, this); - } - - }; - - parser.addHandler(ResponseHandler); - - parser.on('response', function(data, context) { - console.log(JSON.stringify(data), '\n\n'); - }); - - parser.once('complete', function(data, parser) { - console.log(JSON.stringify(data)); - }); - - parser.write(data).close(); - }); - -}); |