Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/324#discussion_r26927152
  
    --- Diff: 
app/addons/documents/index-results/tests/index-results.storesSpec.js ---
    @@ -0,0 +1,306 @@
    +// 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.
    +
    +define([
    +  'api',
    +  'addons/documents/index-results/stores',
    +  'addons/documents/index-results/actiontypes',
    +  'addons/documents/shared-resources',
    +  'testUtils'
    +], function (FauxtonAPI, Stores, ActionTypes, Documents, testUtils) {
    +  var assert = testUtils.assert;
    +  var dispatchToken;
    +  var store;
    +
    +  describe('Index Results Store', function () {
    +
    +    beforeEach(function () {
    +      store = new Stores.IndexResultsStore();
    +      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
    +    });
    +
    +    describe('#hasResults', function () {
    +
    +      it('returns true for collection', function () {
    +        store._collection = [1,2,3];
    +
    +        assert.ok(store.hasResults());
    +      });
    +
    +      it('returns false for empty collection', function () {
    +        store._collection = [];
    +
    +        assert.notOk(store.hasResults());
    +      });
    +
    +    });
    +
    +    describe('#getResults', function () {
    +
    +      it('has correct doc format', function () {
    +        store._collection = new Documents.AllDocs([{_id: 'testId'}], {
    +          params: {},
    +          database: {
    +            safeID: function () { return '1';}
    +          }
    +        });
    +
    +        var doc = store.getResults()[0];
    +        assert.equal(doc.id, 'testId');
    +        assert.equal(doc.keylabel, 'id');
    +      });
    +
    +    });
    +
    +    afterEach(function () {
    +      FauxtonAPI.dispatcher.unregister(dispatchToken);
    +    });
    +  });
    +
    +  describe('canSelectAll', function () {
    +
    +    it('returns true for selected docs less than collection', function () {
    +        store._collection = new Documents.AllDocs([{_id: 'testId1'}, {_id: 
'testId2'}], {
    +          params: {},
    +          database: {
    +            safeID: function () { return '1';}
    +          }
    +        });
    +
    +        store._selectedItems = {'testId1': true};
    +        assert.ok(store.canSelectAll());
    +    });
    +
    +    it('returns false for selected docs same as collection', function () {
    +        store._collection = new Documents.AllDocs([{_id: 'testId1'}, {_id: 
'testId2'}], {
    +          params: {},
    +          database: {
    +            safeID: function () { return '1';}
    +          }
    +        });
    +
    +        store._selectedItems = {
    +          'testId1': true,
    +          'testId2': true
    +        };
    +
    +        assert.notOk(store.canSelectAll());
    +    });
    +
    +  });
    +
    +  describe('canDeselectAll', function () {
    +
    +    it('returns true for selected docs', function () {
    +        store._selectedItems = {'testId1': true};
    +        assert.ok(store.canDeselectAll());
    +    });
    +
    +    it('returns false for no selected docs', function () {
    +        store._selectedItems = {};
    +
    +        assert.notOk(store.canDeselectAll());
    +    });
    +
    +  });
    +
    +  describe('canCollapseDocs', function () {
    +
    +    it('returns true for no collapsed docs', function () {
    +        store._collapsedDocs = {};
    +        assert.ok(store.canCollapseDocs());
    +    });
    +
    +    it('returns false for all collapsed docs', function () {
    +        store._collection = new Documents.AllDocs([{_id: 'testId1'}, {_id: 
'testId2'}], {
    +          params: {},
    +          database: {
    +            safeID: function () { return '1';}
    +          }
    +        });
    +
    +        store._collapsedDocs = {
    +          'testId1': true,
    +          'testId2': true
    +        };
    +
    +        assert.notOk(store.canCollapseDocs());
    +    });
    +
    +  });
    +
    +  describe('canUncollapseDocs', function () {
    +
    +    it('returns true for collapsed docs', function () {
    +        store._collapsedDocs = {'testId1': true};
    +        assert.ok(store.canUncollapseDocs());
    +    });
    +
    +    it('returns false for no collapsed docs', function () {
    +        store.clearCollapsedDocs();
    +
    +        assert.notOk(store.canUncollapseDocs());
    +    });
    +
    +  });
    --- End diff --
    
    from the beginning of the file until here 4 spaces are uses as intendation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to