Source code

Revision control

Copy as Markdown

Other Tools

/* Any copyright is dedicated to the Public Domain.
"use strict";
const expect = require("expect");
const { render } = require("enzyme");
const {
createFactory,
const FilterCheckbox = createFactory(
);
describe("FilterCheckbox component:", () => {
const props = {
label: "test label",
title: "test title",
checked: true,
onChange: () => {},
};
it("displays as checked", () => {
const wrapper = render(FilterCheckbox(props));
expect(wrapper.is("label")).toBe(true);
expect(wrapper.attr("title")).toBe("test title");
expect(wrapper.hasClass("filter-checkbox")).toBe(true);
expect(wrapper.html()).toBe('<input type="checkbox" checked>test label');
});
it("displays as unchecked", () => {
const wrapper = render(FilterCheckbox({ ...props, checked: false }));
expect(wrapper.is("label")).toBe(true);
expect(wrapper.attr("title")).toBe("test title");
expect(wrapper.hasClass("filter-checkbox")).toBe(true);
expect(wrapper.html()).toBe('<input type="checkbox">test label');
});
});