From ee4ba41be000abbf4d888d306c72b6e805fdc01b Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Tue, 27 Jan 2009 20:46:39 +0000 Subject: 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 --- share/www/script/couch_tests.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'share/www/script/couch_tests.js') 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); -- cgit v1.2.3