Sha256: 103d45f8a61e44da9a9294dbf8f2bf2eb6aca4c757fb51c9a30fdeb521e9537c

Contents?: true

Size: 911 Bytes

Versions: 9

Compression:

Stored size: 911 Bytes

Contents

import { shallow }          from 'enzyme';
import CommentOrderSelector from './comment_order_selector.component';

describe('<CommentOrderSelector />', () => {
  const orderBy = "older";
  const reorderComments = sinon.spy();

  it("renders a div with classes order-by__dropdown order-by__dropdown--right", () => {
    const wrapper = shallow(<CommentOrderSelector reorderComments={reorderComments} defaultOrderBy={orderBy} />);
    expect(wrapper.find('div.order-by__dropdown.order-by__dropdown--right')).to.present();
  })

   it("should set state order to best_rated if user clicks on the first element", () => {
      const preventDefault = sinon.spy();
      const wrapper = shallow(<CommentOrderSelector reorderComments={reorderComments} defaultOrderBy={orderBy} />);
      wrapper.find('a.test').simulate('click', {preventDefault});
      expect(reorderComments).to.calledWith("best_rated");
    });
})

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
decidim-comments-0.0.6 app/frontend/comments/comment_order_selector.component.test.jsx
decidim-0.0.6 decidim-comments/app/frontend/comments/comment_order_selector.component.test.jsx
decidim-comments-0.0.5 app/frontend/comments/comment_order_selector.component.test.jsx
decidim-0.0.5 decidim-comments/app/frontend/comments/comment_order_selector.component.test.jsx
decidim-0.0.4 decidim-comments/app/frontend/comments/comment_order_selector.component.test.jsx
decidim-comments-0.0.3 app/frontend/comments/comment_order_selector.component.test.jsx
decidim-0.0.3 decidim-comments/app/frontend/comments/comment_order_selector.component.test.jsx
decidim-comments-0.0.2 app/frontend/comments/comment_order_selector.component.test.jsx
decidim-0.0.2 decidim-comments/app/frontend/comments/comment_order_selector.component.test.jsx