couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to 18bd88f
Date Thu, 29 Jan 2015 12:05:51 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master f5f7f4b93 -> 18bd88f2f


header-control-bar: fix select-all-state

When I select all documents
And there are less documents than I have set to display per page
Then I want the select-all-button to be selected/disabled

As I checked for the setting of the page compared to the selected
documents it can happen that if we have not enough documents to
show on the page that the status of the select-all was wrong.

To test:
if you have database with 8 documents, and show 5 documents at a
time, view the second page (doc 6-8), and hit 'select all', notice
that the 'select all' and 'unselect all' are both grayed out.

Added test to avoid regressions in the future and to prove my fix


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/18bd88f2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/18bd88f2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/18bd88f2

Branch: refs/heads/master
Commit: 18bd88f2fcea4d3aa83a8b55b62a6d9f2763feee
Parents: f5f7f4b
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Wed Jan 28 19:08:53 2015 +0100
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Thu Jan 29 13:04:31 2015 +0100

----------------------------------------------------------------------
 app/addons/documents/header/header.stores.js    |  6 ----
 .../documents/tests/nightwatch/bulkSelect.js    | 36 ++++++++++++++++++++
 app/addons/documents/views.js                   |  6 ++--
 3 files changed, 39 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/18bd88f2/app/addons/documents/header/header.stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/header/header.stores.js b/app/addons/documents/header/header.stores.js
index c491043..ec40d7e 100644
--- a/app/addons/documents/header/header.stores.js
+++ b/app/addons/documents/header/header.stores.js
@@ -25,8 +25,6 @@ function (FauxtonAPI, ActionTypes) {
 
     reset: function () {
       this._collapsedDocuments = false;
-      this._selectedAllDocuments = false;
-
       this._selectedDocumentsCount = 0;
       this._documentsOnPageCount = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
     },
@@ -39,10 +37,6 @@ function (FauxtonAPI, ActionTypes) {
       return this._collapsedDocuments;
     },
 
-    toggleSelectAll: function () {
-      this._selectedAllDocuments = !this._selectedAllDocuments;
-    },
-
     getSelectedAllState: function () {
       return this._selectedAllDocuments;
     },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/18bd88f2/app/addons/documents/tests/nightwatch/bulkSelect.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/bulkSelect.js b/app/addons/documents/tests/nightwatch/bulkSelect.js
new file mode 100644
index 0000000..e767c30
--- /dev/null
+++ b/app/addons/documents/tests/nightwatch/bulkSelect.js
@@ -0,0 +1,36 @@
+// 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 = {
+  // When I select all documents
+  // And there are less documents than I have set to display per page
+  // Then I want the select-all-button to be selected
+  'Bulk Documents: selector': function (client) {
+    var waitTime = 10000,
+        newDatabaseName = client.globals.testDatabaseName,
+        newDocumentName1 = 'bulktest1',
+        newDocumentName2 = 'bulktest2',
+        baseUrl = client.globals.test_settings.launch_url;
+
+    client
+      .loginToGUI()
+      .createDocument(newDocumentName1, newDatabaseName)
+      .createDocument(newDocumentName2, newDatabaseName)
+      .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+      .waitForElementPresent('.control-toggle-alternative-header', waitTime, false)
+      .click('.control-toggle-alternative-header')
+      .waitForElementPresent('.control-select-all', waitTime, false)
+      .click('.control-select-all')
+      .assert.attributeEquals('.control-select-all', 'disabled', 'true')
+      .end();
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/18bd88f2/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 5f0a1b7..f472b46 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -400,7 +400,7 @@ function (app, FauxtonAPI, Components, Documents,
 
       ReactHeaderActions.updateDocumentCount({
         selectedOnPage: this.$('.js-to-delete').length,
-        documentsOnPageCount: this.perPage()
+        documentsOnPageCount: this.$('.doc-row').length
       });
     },
 
@@ -467,7 +467,7 @@ function (app, FauxtonAPI, Components, Documents,
 
       ReactHeaderActions.updateDocumentCount({
         selectedOnPage: this.$('.js-to-delete').length,
-        documentsOnPageCount: this.perPage()
+        documentsOnPageCount: this.$('.doc-row').length
       });
     },
 
@@ -580,7 +580,7 @@ function (app, FauxtonAPI, Components, Documents,
 
       ReactHeaderActions.updateDocumentCount({
         selectedOnPage: this.$('.js-to-delete').length,
-        documentsOnPageCount: this.perPage()
+        documentsOnPageCount: this.$('.doc-row').length
       });
     },
 


Mime
View raw message