diff options
-rw-r--r-- | caldav.js | 5 | ||||
-rw-r--r-- | lib/caldav/sax/dav_response.js | 5 | ||||
-rw-r--r-- | test/caldav/sax/dav_response_test.js | 26 |
3 files changed, 36 insertions, 0 deletions
@@ -6848,6 +6848,11 @@ function write (chunk) { var parent; if (this.current.href) { + this.emit( + 'DAV:/response', + this.current.href, + this.current.propstat + ); parent = this.stack[this.stack.length - 1]; parent[this.current.href] = this.current.propstat; } diff --git a/lib/caldav/sax/dav_response.js b/lib/caldav/sax/dav_response.js index 0c6c1a0..caba42f 100644 --- a/lib/caldav/sax/dav_response.js +++ b/lib/caldav/sax/dav_response.js @@ -224,6 +224,11 @@ var parent; if (this.current.href) { + this.emit( + 'DAV:/response', + this.current.href, + this.current.propstat + ); parent = this.stack[this.stack.length - 1]; parent[this.current.href] = this.current.propstat; } diff --git a/test/caldav/sax/dav_response_test.js b/test/caldav/sax/dav_response_test.js index 1dac79d..cb3d2b7 100644 --- a/test/caldav/sax/dav_response_test.js +++ b/test/caldav/sax/dav_response_test.js @@ -90,12 +90,38 @@ suite('caldav/sax/dav_response', function() { }; test('output', function(done) { + var response = []; + + subject.on('DAV:/response', function(url, data) { + response.push([url, data]); + }); + + subject.once('complete', function(data) { assert.deepEqual( data.multistatus, expected, "expected \n '" + JSON.stringify(data.multistatus) + "'\n to equal \n '" + JSON.stringify(expected) + '\n"' ); + + assert.deepEqual( + [ + '/calendar/user/', + expected['/calendar/user/'] + ], + response[0], + '/calendar/user/ response' + ); + + assert.deepEqual( + [ + '/calendar/other', + expected['/calendar/other'] + ], + response[1], + '/calendar/other/ response' + ); + done(); }); subject.write(xml).close(); |