blob: 41fc65b71298f7bddaf84a40e8e1716f10186b83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const expect = require("expect");
const { render } = require("enzyme");
const {
createFactory,
} = require("resource://devtools/client/shared/vendor/react.js");
const FilterCheckbox = createFactory(
require("resource://devtools/client/webconsole/components/FilterBar/FilterCheckbox.js")
);
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');
});
});
|