You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2017/10/24 07:24:29 UTC

[GitHub] garrensmith closed pull request #1000: Support editing _local docs

garrensmith closed pull request #1000: Support editing _local docs
URL: https://github.com/apache/couchdb-fauxton/pull/1000
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js
index aa3ebd3ff..89342c5f3 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 428ed8b69..2a1d68e05 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,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services