Repository: couchdb-fauxton Updated Branches: refs/heads/master 16a81431a -> 0a03e2e1a
always update api url also update api url when routes are in the same route object. steps to reproduce: 1. click on api bar in _find area for mango 2. click edit 3. click api bar button on _index page 4. url should point to _index PR: #616 PR-URL: https://github.com/apache/couchdb-fauxton/pull/616 Reviewed-By: Benjamin Keen <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/0a03e2e1 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/0a03e2e1 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/0a03e2e1 Branch: refs/heads/master Commit: 0a03e2e1a600fcd6af27bcb96fcf0bf3bc643236 Parents: 16a8143 Author: Robert Kowalski <[email protected]> Authored: Tue Jan 19 18:31:55 2016 +0100 Committer: Robert Kowalski <[email protected]> Committed: Wed Jan 20 09:42:34 2016 +0100 ---------------------------------------------------------------------- app/addons/fauxton/base.js | 5 ++- .../nightwatch/updatesUrlsSameRouteobject.js | 33 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0a03e2e1/app/addons/fauxton/base.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js index 5694617..197e46a 100644 --- a/app/addons/fauxton/base.js +++ b/app/addons/fauxton/base.js @@ -58,7 +58,8 @@ function (app, FauxtonAPI, Components, NotificationComponents, Actions, NavbarRe Fauxton.initialize = function () { - FauxtonAPI.RouteObject.on('beforeFullRender', function (routeObject) { + + FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) { NavigationActions.setNavbarActiveLink(_.result(routeObject, 'selectedHeader')); // always attempt to render the API Bar. Even if it's hidden on initial load, it may be enabled later @@ -78,9 +79,7 @@ function (app, FauxtonAPI, Components, NotificationComponents, Actions, NavbarRe if (!routeObject.get('hideNotificationCenter')) { routeObject.setComponent('#notification-center-btn', NotificationComponents.NotificationCenterButton); } - }); - FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) { if (routeObject.overrideBreadcrumbs) { return; } FauxtonAPI.masterLayout.removeView('#breadcrumbs'); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0a03e2e1/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js b/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js new file mode 100644 index 0000000..2294939 --- /dev/null +++ b/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js @@ -0,0 +1,33 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy of +// the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. + +module.exports = { + 'it updates the API url even for routes in the same routeobject' : function (client) { + var waitTime = client.globals.maxWaitTime, + newDatabaseName = client.globals.testDatabaseName, + baseUrl = client.globals.test_settings.launch_url; + + client + .populateDatabase(newDatabaseName) + .loginToGUI() + .url(baseUrl + '/#/database/' + newDatabaseName + '/_find') + .clickWhenVisible('.control-toggle-api-url') + .waitForElementVisible('.text-field-to-copy', waitTime, false) + .assert.value('.text-field-to-copy', 'http://localhost:8000/' + newDatabaseName + '/_find') + .clickWhenVisible('.edit-link') + .waitForElementVisible('.prettyprint', waitTime, false) + .clickWhenVisible('.control-toggle-api-url') + .waitForElementVisible('.text-field-to-copy', waitTime, false) + .assert.value('.text-field-to-copy', 'http://localhost:8000/' + newDatabaseName + '/_index') + .end(); + } +};
