@hackoregon/component-library
Version:
Official repo for Hack Oregon React component library
24 lines • 1.11 kB
JavaScript
import React from "react";
import { render } from "enzyme";
import Placeholder from "./Placeholder";
describe("Placeholder", function () {
it("should render a placeholder with a default message", function () {
var placeholder = render(React.createElement(Placeholder, null));
expect(placeholder.find("h1").text()).to.contain("Content Placeholder");
expect(placeholder.find("p")).to.exist;
});
it("should provide correct issue text and have a link when given an issue", function () {
var placeholder = render(React.createElement(Placeholder, {
issue: "22"
}));
expect(placeholder.find("h1").text()).to.contain("Card In Progress");
expect(placeholder.find("a")).to.exist;
});
it("should render a placeholder with a custom message when the placeholder has children", function () {
var customMessage = "A customized message";
var placeholder = render(React.createElement(Placeholder, null, customMessage));
expect(placeholder.text()).to.eql(customMessage);
expect(placeholder.find("h1")).not.to.exist;
expect(placeholder.find("p")).not.to.exist;
});
});