couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garrensmith <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Changes page Filters tab moved to Re...
Date Fri, 13 Feb 2015 11:25:40 GMT
Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/265#discussion_r24658328
  
    --- Diff: app/addons/documents/tests/changesHeader.componentsSpec.react.jsx ---
    @@ -0,0 +1,138 @@
    +// 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([
    +  'app',
    +  'api',
    +  'react',
    +  'addons/documents/changes/changes-header.react',
    +  'addons/documents/changes/stores',
    +  'testUtils'
    +], function (app, FauxtonAPI, React, ChangesHeader, Stores, utils) {
    +  FauxtonAPI.router = new FauxtonAPI.Router([]);
    +
    +  var assert = utils.assert;
    +  var TestUtils = React.addons.TestUtils;
    +
    +  describe('ChangesHeader', function () {
    +    describe('Toggle tab content button', function () {
    +      var container, tab, toggleTabVisibility;
    +
    +      beforeEach(function () {
    +        toggleTabVisibility = sinon.spy();
    +        container = document.createElement('div');
    +        tab = TestUtils.renderIntoDocument(<ChangesHeader.ChangesHeaderTab onToggle={toggleTabVisibility}
/>, container);
    +      });
    +
    +      afterEach(function () {
    +        Stores.changesFilterStore.reset();
    +        React.unmountComponentAtNode(container);
    +      });
    +
    +      it('should call toggle function on clicking tab', function () {
    +        TestUtils.Simulate.click($(tab.getDOMNode()).find('a')[0]);
    +        assert.ok(toggleTabVisibility.calledOnce);
    +      });
    +    });
    +  });
    +
    +
    +  describe('ChangesFilter', function () {
    +    var container, changesFilterEl;
    +
    +    beforeEach(function () {
    +      container = document.createElement('div');
    +      changesFilterEl = TestUtils.renderIntoDocument(<ChangesHeader.ChangesFilter
/>, container);
    +    });
    +
    +    afterEach(function () {
    +      Stores.changesFilterStore.reset();
    +      React.unmountComponentAtNode(container);
    +    });
    +
    +    it('should add filter markup', function () {
    +      var $el = $(changesFilterEl.getDOMNode()),
    --- End diff --
    
    This is cool. I like how you have broken the selecting of the DOM here. Makes the test
a lot more readable.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message