Sha256: 256b1e6cccb52d4eee22e957ecb07d132ffd8450f2d1d4fdcfad9f3638785ef4
Contents?: true
Size: 1.08 KB
Versions: 14
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
14 entries across 14 versions & 1 rubygems