summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-01-04 07:22:22 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-01-04 07:22:22 +0000
commite983fa41d34aa619429dbf3f4937b58c31113e53 (patch)
tree68494e27f25345f051b031febc8950991a693992 /share
parent14d8a23c9b5bd69099b4bd2c3ca6c3eb0441a0b3 (diff)
better E4X escaping in tests, dropped JS heredoc
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@731187 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/www/script/couch_tests.js70
1 files changed, 38 insertions, 32 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index 16fa51e7..0c1b36ca 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -2059,15 +2059,14 @@ var tests = {
json : req
}
}),
- "xml-type" : [
- 'function(doc, req) { ',
- ' return { ',
- ' "headers" : { ',
- ' "Content-Type" : "application/xml" ',
- ' }, ',
- ' "body" : <xml><node foo="bar"/></xml>',
- ' } ',
- '}'].join('\n'),
+ "xml-type" : stringFun(function(doc, req) {
+ return {
+ "headers" : {
+ "Content-Type" : "application/xml"
+ },
+ "body" : new XML('<xml><node foo="bar"/></xml>')
+ }
+ }),
"no-set-etag" : stringFun(function(doc, req) {
return {
headers : {
@@ -2104,29 +2103,35 @@ var tests = {
};
}
}),
- "respondWith" : [
- 'function(doc, req) { ',
- ' registerType("foo", "application/foo","application/x-foo");',
- ' return respondWith(req, { ',
- ' html : function() { ',
- ' return { ',
- ' body:"Ha ha, you said \\"" + doc.word + "\\"." ',
- ' }; ',
- ' }, ',
- ' xml : function() { ',
- ' return { ',
- ' body: <xml><node foo={doc.word}/></xml> ',
- ' }; ',
- ' }, ',
- ' foo : function() { ',
- ' return { ',
- ' body: "foofoo" ',
- ' }; ',
- ' }, ',
- ' fallback : "html" ',
- ' }); ',
- '}'].join('\n')
- }
+ "respondWith" : stringFun(function(doc, req) {
+ registerType("foo", "application/foo","application/x-foo");
+ return respondWith(req, {
+ html : function() {
+ return {
+ body:"Ha ha, you said \"" + doc.word + "\"."
+ };
+ },
+ xml : function() {
+ var xml = new XML('<xml><node/></xml>');
+ // becase Safari can't stand to see that dastardly
+ // E4X outside of a string.
+ this.eval('xml.node.@foo = doc.word');
+ return {
+ headers : {
+ "Content-Type" : "application/xml",
+ },
+ body: xml
+ };
+ },
+ foo : function() {
+ return {
+ body: "foofoo"
+ };
+ },
+ fallback : "html"
+ });
+ })
+ }
};
T(db.save(designDoc).ok);
@@ -2277,6 +2282,7 @@ var tests = {
}
});
T(xhr.getResponseHeader("Content-Type") == "application/xml");
+ T(xhr.responseText.match(/node/));
T(xhr.responseText.match(/plankton/));
// registering types works