diff options
author | James Lal <james@lightsofapollo.com> | 2012-09-19 11:11:16 -0700 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2012-09-19 11:11:16 -0700 |
commit | 0cac01e4243b112f3c0820c89d9de2bf38005c79 (patch) | |
tree | 1fc042f4d9b26f21f606e4dff15c7c70bab2f70b /test/caldav/sax/dav_response_test.js | |
parent | 459e5b14f1868960e60c8fc358103cd6fbbaed7f (diff) | |
download | jsCalDAV-0cac01e4243b112f3c0820c89d9de2bf38005c79.tar.gz |
decouple ical-js will resolve #5
Diffstat (limited to 'test/caldav/sax/dav_response_test.js')
-rw-r--r-- | test/caldav/sax/dav_response_test.js | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/test/caldav/sax/dav_response_test.js b/test/caldav/sax/dav_response_test.js index b8f4716..926f975 100644 --- a/test/caldav/sax/dav_response_test.js +++ b/test/caldav/sax/dav_response_test.js @@ -1,20 +1,18 @@ +testSupport.helper('ical'); testSupport.lib('responder'); testSupport.lib('sax'); testSupport.lib('sax/base'); -testSupport.lib('ical'); +testSupport.lib('sax/calendar_data_handler'); testSupport.lib('sax/dav_response'); -testSupport.lib('../ical'); suite('caldav/sax/dav_response', function() { - var data, - subject, - parser, - Parse, - Response, - Base, - handler; + var Parse; + var Response; + var Base; + var CalendarDataHandler; + var originalHandler; suiteSetup(function() { Parse = Caldav.require('sax'); @@ -22,11 +20,35 @@ suite('caldav/sax/dav_response', function() { Response = Caldav.require('sax/dav_response'); }); + var subject; + var data; + var handler; + var parser; + setup(function() { //we omit the option to pass base parser //because we are the base parser subject = new Parse(); subject.registerHandler('DAV:/response', Response); + + // HACK to get CalendarDataHandler + var handleNS = 'urn:ietf:params:xml:ns:caldav/calendar-data'; + + CalendarDataHandler = subject.handles['DAV:/response']; + CalendarDataHandler = CalendarDataHandler.handles['DAV:/propstat']; + CalendarDataHandler = CalendarDataHandler.handles[handleNS]; + + if (!originalHandler) { + originalHandler = CalendarDataHandler.parseICAL; + } + + // XXX: this may change later if ICAL is no longer + // exposed directly. + CalendarDataHandler.parseICAL = ICAL.parse; + }); + + teardown(function() { + CalendarDataHandler.parseICAL = originalHandler; }); suite('calendar-query', function() { |