blob: 3774da0b83c6fc753b463d40338ae2cb5497e88d (
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
|
/* 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("devtools/client/shared/vendor/react");
const FilterButton = createFactory(require("devtools/client/webconsole/new-console-output/components/filter-button"));
const { MESSAGE_LEVEL } = require("devtools/client/webconsole/new-console-output/constants");
describe("FilterButton component:", () => {
const props = {
active: true,
label: "Error",
filterKey: MESSAGE_LEVEL.ERROR,
};
it("displays as active when turned on", () => {
const wrapper = render(FilterButton(props));
expect(wrapper.html()).toBe(
"<button class=\"menu-filter-button error checked\">Error</button>"
);
});
it("displays as inactive when turned off", () => {
const inactiveProps = Object.assign({}, props, { active: false });
const wrapper = render(FilterButton(inactiveProps));
expect(wrapper.html()).toBe(
"<button class=\"menu-filter-button error\">Error</button>"
);
});
});
|