Sha256: baa2dfbc45c9f8328f3194ac909eb7c8e964a31ad99f8b23c6af05e195677405

Contents?: true

Size: 1.08 KB

Versions: 40

Compression:

Stored size: 1.08 KB

Contents

import { shallow } from "enzyme";
import * as React from "react";

import CommentOrderSelector from "./comment_order_selector.component";

describe("<CommentOrderSelector />", () => {
  const orderBy = "older";
  const reorderComments = jasmine.createSpy("reorderComments");

  beforeEach(() => {
    window.$ = () => {
      return {
        foundation: jasmine.createSpy("")
      };
    };
  });

  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")).toBeDefined();
  });

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

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
decidim-comments-0.23.6 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.5 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.4 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.3 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.2 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.1.rc1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.23.0 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.22.0 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.21.0 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.20.1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.20.0 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.19.1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.18.1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.19.0 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.17.2 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.18.0 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.17.1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.16.1 app/frontend/comments/comment_order_selector.component.test.tsx
decidim-comments-0.17.0 app/frontend/comments/comment_order_selector.component.test.tsx