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