Repository: couchdb-fauxton Updated Branches: refs/heads/master 66b98b3c8 -> 6bd3d7896
Two Bug fixes * Fix Previous '<' works correctly from view * Only remove all doc numbers if it exists Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/6bd3d789 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/6bd3d789 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/6bd3d789 Branch: refs/heads/master Commit: 6bd3d7896bcabe779d3454a05f14a41c37f37291 Parents: 66b98b3 Author: Garren Smith <[email protected]> Authored: Tue Feb 24 10:12:23 2015 +0200 Committer: Garren Smith <[email protected]> Committed: Tue Feb 24 13:26:14 2015 +0200 ---------------------------------------------------------------------- app/addons/documents/routes-index-editor.js | 7 ++-- app/addons/documents/shared-routes.js | 1 - .../tests/nightwatch/previousFromView.js | 30 ++++++++++++++++ app/addons/documents/tests/viewsSpec.js | 37 ++++++++++++++++++++ app/addons/documents/views.js | 2 +- 5 files changed, 72 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6bd3d789/app/addons/documents/routes-index-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js index 250dafc..fd2660c 100644 --- a/app/addons/documents/routes-index-editor.js +++ b/app/addons/documents/routes-index-editor.js @@ -15,6 +15,7 @@ define([ 'api', // Modules + "addons/documents/helpers", 'addons/documents/shared-routes', 'addons/documents/views', 'addons/documents/views-index', @@ -23,7 +24,7 @@ define([ ], -function (app, FauxtonAPI, BaseRoute, Documents, Index, Databases, Components) { +function (app, FauxtonAPI, Helpers, BaseRoute, Documents, Index, Databases, Components) { var IndexEditorAndResults = BaseRoute.extend({ @@ -74,7 +75,7 @@ function (app, FauxtonAPI, BaseRoute, Documents, Index, Databases, Components) { this.breadcrumbs = this.setView('#breadcrumbs', new Components.Breadcrumbs({ toggleDisabled: true, crumbs: [ - {'type': 'back', 'link': Databases.databaseUrl(this.database)}, + {'type': 'back', 'link': Helpers.getPreviousPage(this.database)}, {'name': this.database.id, 'link': Databases.databaseUrl(this.database) } ] })); @@ -131,7 +132,7 @@ function (app, FauxtonAPI, BaseRoute, Documents, Index, Databases, Components) { this.breadcrumbs = this.setView('#breadcrumbs', new Components.Breadcrumbs({ toggleDisabled: true, crumbs: [ - {'type': 'back', 'link': Databases.databaseUrl(this.database)}, + {'type': 'back', 'link': Helpers.getPreviousPage(this.database)}, {'name': 'Create new index', 'link': Databases.databaseUrl(this.database) } ] })); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6bd3d789/app/addons/documents/shared-routes.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/shared-routes.js b/app/addons/documents/shared-routes.js index 4d6fe37..e1a84a1 100644 --- a/app/addons/documents/shared-routes.js +++ b/app/addons/documents/shared-routes.js @@ -223,7 +223,6 @@ define([ this.documentsView.collection.reset(collection); this.documentsView.forceRender(); - this.allDocsNumber.forceRender(); collection.paging.pageSize = options.perPage; var promise = collection[options.direction]({fetch: false}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6bd3d789/app/addons/documents/tests/nightwatch/previousFromView.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/nightwatch/previousFromView.js b/app/addons/documents/tests/nightwatch/previousFromView.js new file mode 100644 index 0000000..062427b --- /dev/null +++ b/app/addons/documents/tests/nightwatch/previousFromView.js @@ -0,0 +1,30 @@ +// 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 = { + 'View: Navigate previous works correctly': function (client) { + var waitTime = 15000, + newDatabaseName = client.globals.testDatabaseName, + baseUrl = client.globals.test_settings.launch_url; + + client + .populateDatabase(newDatabaseName, 3) + .loginToGUI() + .url(baseUrl + '/#/database/' + newDatabaseName + '/_changes') + .clickWhenVisible('#nav-header-keyview') + .clickWhenVisible('#nav-design-function-keyviewviews') + .clickWhenVisible('#keyview_keyview') + .clickWhenVisible('.breadcrumb-back-link .fonticon-left-open') + .waitForElementPresent('.changes-view', waitTime) + .end(); + } +}; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6bd3d789/app/addons/documents/tests/viewsSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/viewsSpec.js b/app/addons/documents/tests/viewsSpec.js index 2114ed8..f24da86 100644 --- a/app/addons/documents/tests/viewsSpec.js +++ b/app/addons/documents/tests/viewsSpec.js @@ -25,4 +25,41 @@ define([ assert.equal(typeof Documents.Views.AllDocsList, 'function'); }); }); + + describe('Footer', function (done) { + var footer; + + beforeEach(function () { + footer = new Documents.Views.Footer(); + viewSandbox = new ViewSandbox(); + viewSandbox.renderView(footer, done); + }); + + afterEach(function () { + viewSandbox.remove(); + }); + + it('removes allDocs if it exists', function () { + var spy = sinon.spy(footer.allDocsNumber, 'remove'); + + footer.remove(); + + assert.ok(spy.calledOnce); + }); + + + it('does not remove allDocs if it exists', function () { + var error = false; + footer.allDocsNumber = false; + + try { + footer.remove(); + } catch(e) { + error = true; + } + + assert.notOk(error); + }); + + }); }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6bd3d789/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js index 62cd8e2..75e2b0a 100644 --- a/app/addons/documents/views.js +++ b/app/addons/documents/views.js @@ -52,7 +52,7 @@ function (app, FauxtonAPI, Components, Documents, }, cleanup: function () { - this.allDocsNumber.remove(); + this.allDocsNumber && this.allDocsNumber.remove(); } });
