@hackoregon/component-library
Version:
Official repo for Hack Oregon React component library
15 lines • 702 B
JavaScript
import React from "react";
import { shallow } from "enzyme";
import Collapsable from "./Collapsable";
describe("Collapsable", function () {
it("should render all children by default", function () {
var wrapper = shallow(React.createElement(Collapsable, null, React.createElement("h1", null, "test1"), React.createElement("h1", null, "test2")));
expect(wrapper.find("h1").length).to.eql(2);
});
it("should collapse hidden children by default", function () {
var wrapper = shallow(React.createElement(Collapsable, null, React.createElement("h1", null, "test1"), React.createElement("h1", {
hidden: true
}, "test2")));
expect(wrapper.find("h1").length).to.eql(1);
});
});