From f723cb99008f2462abec46ab9b614fb8dd2f31d1 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Mon, 17 Aug 2009 23:04:28 +0000 Subject: allow list function and view function to be in different design docs, patch by Mark Hammond, closes COUCHDB-446 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@805201 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/list_views.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'share') diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js index a7f3eadb..e297f0a3 100644 --- a/share/www/script/test/list_views.js +++ b/share/www/script/test/list_views.js @@ -166,6 +166,17 @@ couchTests.list_views = function(debug) { }) } }; + var viewOnlyDesignDoc = { + _id:"_design/views", + language: "javascript", + views : { + basicView : { + map : stringFun(function(doc) { + emit(-doc.integer, doc.string); + }) + } + } + }; T(db.save(designDoc).ok); @@ -359,4 +370,13 @@ couchTests.list_views = function(debug) { T(xhr.getResponseHeader("Content-Type") == "application/xml"); T(xhr.responseText.match(/XML/)); T(xhr.responseText.match(/entry/)); + + // Test we can run lists and views from separate docs. + T(db.save(viewOnlyDesignDoc).ok); + xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/simpleForm/views/basicView?startkey=-3"); + T(xhr.status == 200, "with query params"); + T(/Total Rows/.test(xhr.responseText)); + T(!(/Key: -4/.test(xhr.responseText))); + T(/FirstKey: -3/.test(xhr.responseText)); + T(/LastKey: 0/.test(xhr.responseText)); }; -- cgit v1.2.3