This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/master by this push:
new 3e82c9d Support editing _local docs (#1000)
3e82c9d is described below
commit 3e82c9d42d30fee93a5cd9d0169afd775e659d3f
Author: Stefan du Fresne <[email protected]>
AuthorDate: Tue Oct 24 08:24:24 2017 +0100
Support editing _local docs (#1000)
* Support editing _local docs
Loads the document through the URL instead, because _all_docs
doesn't contain local docs.
---
app/addons/documents/routes-doc-editor.js | 6 ++-
.../documents/tests/nightwatch/createsDocument.js | 50 ++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/app/addons/documents/routes-doc-editor.js
b/app/addons/documents/routes-doc-editor.js
index aa3ebd3..89342c5 100644
--- a/app/addons/documents/routes-doc-editor.js
+++ b/app/addons/documents/routes-doc-editor.js
@@ -37,11 +37,11 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
'database/:database/:doc/conflicts': 'revisionBrowser',
'database/:database/:doc/code_editor': 'codeEditor',
'database/:database/_design/:ddoc': 'showDesignDoc',
+ 'database/:database/_local/:doc': 'showLocalDoc',
'database/:database/:doc': 'codeEditor',
'database/:database/new': 'codeEditor'
},
-
revisionBrowser: function (databaseName, docId) {
const backLink = FauxtonAPI.urls('allDocs', 'app',
FauxtonAPI.url.encode(this.database.safeID()));
const docURL = FauxtonAPI.urls('document', 'app', this.database.safeID(),
this.docId);
@@ -88,6 +88,10 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
/>;
},
+ showLocalDoc: function(databaseName, docId) {
+ return this.codeEditor(databaseName, '_local/' + docId);
+ },
+
showDesignDoc: function (database, ddoc) {
return this.codeEditor(database, '_design/' + ddoc);
}
diff --git a/app/addons/documents/tests/nightwatch/createsDocument.js
b/app/addons/documents/tests/nightwatch/createsDocument.js
index 428ed8b..2a1d68e 100644
--- a/app/addons/documents/tests/nightwatch/createsDocument.js
+++ b/app/addons/documents/tests/nightwatch/createsDocument.js
@@ -58,6 +58,56 @@ module.exports = {
.end();
},
+ 'Creates a _local document' : (client) => {
+ /*jshint multistr: true */
+ const waitTime = client.globals.maxWaitTime,
+ newDatabaseName = client.globals.testDatabaseName,
+ newDocumentName = '_local/create_doc_document',
+ baseUrl = client.globals.test_settings.launch_url;
+
+ client
+ .createDatabase(newDatabaseName)
+ .loginToGUI()
+ .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+ .clickWhenVisible('#new-all-docs-button a')
+ .clickWhenVisible('#new-all-docs-button a[href="#/database/' +
newDatabaseName + '/new"]')
+ .waitForElementPresent('#editor-container', waitTime, false)
+ .verify.urlEquals(baseUrl + '/#/database/' + newDatabaseName + '/new')
+ .waitForElementPresent('.ace_gutter-active-line', waitTime, false)
+
+ // confirm the header elements are showing up
+ .waitForElementVisible('.faux-header__breadcrumbs', waitTime, true)
+ .waitForElementVisible('.faux__jsonlink-link', waitTime, true)
+
+ .execute('\
+ var editor = ace.edit("doc-editor");\
+ editor.gotoLine(2,10);\
+ editor.removeWordRight();\
+ editor.insert("' + newDocumentName + '");\
+ ')
+
+ .clickWhenVisible('#doc-editor-actions-panel .save-doc')
+ .checkForDocumentCreated(newDocumentName)
+ .url(baseUrl + '#/database/' + newDatabaseName + '/' + newDocumentName)
+
+ // Confirm the editor loaded successfully
+ .waitForElementPresent('.ace_gutter-active-line', waitTime, false)
+ .waitForElementVisible('.faux-header__breadcrumbs', waitTime, true)
+ .waitForElementVisible('.faux__jsonlink-link', waitTime, true)
+ .execute(function() {
+ /*global ace*/
+ return ace.edit("doc-editor").getValue();
+ }, function (data) {
+ const createdDocIsPresent = data.value.indexOf(newDocumentName) !== -1;
+
+ this.verify.ok(
+ createdDocIsPresent,
+ 'Checking if new document shows up in _all_docs.'
+ );
+ })
+ .end();
+ },
+
'Creates a Document through Create Document toolbar button': (client) => {
const waitTime = client.globals.maxWaitTime,
newDatabaseName = client.globals.testDatabaseName,
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].