summaryrefslogtreecommitdiff
path: root/share/www/script
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-01-27 20:46:39 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-01-27 20:46:39 +0000
commitee4ba41be000abbf4d888d306c72b6e805fdc01b (patch)
treedc94fe1feff640ddbc39ead878ba75420a55917c /share/www/script
parent482d19963237d4640e08bbb25585f2016328a004 (diff)
Improved etag handling for show funcs and db_doc requests; main.js cleanup (baby steps); null doc allowed for show funcs
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@738237 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r--share/www/script/couch_tests.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index 01f94927..8f76ff06 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -2307,10 +2307,12 @@ var tests = {
_id:"_design/template",
language: "javascript",
shows: {
- "hello" : stringFun(function() {
- return {
- body : "Hello World"
- };
+ "hello" : stringFun(function(doc) {
+ if (doc) {
+ return "Hello World";
+ } else {
+ return "Empty World";
+ }
}),
"just-name" : stringFun(function(doc, req) {
return {
@@ -2410,6 +2412,11 @@ var tests = {
// hello template world
xhr = CouchDB.request("GET", "/test_suite_db/_show/template/hello/"+docid);
T(xhr.responseText == "Hello World");
+
+ // hello template world (no docid)
+ xhr = CouchDB.request("GET", "/test_suite_db/_show/template/hello");
+ T(xhr.responseText == "Empty World");
+
// show with doc
xhr = CouchDB.request("GET", "/test_suite_db/_show/template/just-name/"+docid);