Bug 1901942 - [devtools] Remove unused FilterCheckbox component. r=devtools-reviewers,jdescottes.

Differential Revision: https://phabricator.services.mozilla.com/D213391
This commit is contained in:
Nicolas Chevobbe 2024-06-12 11:54:38 +00:00
parent 26960a2ab4
commit 157382211a
5 changed files with 3 additions and 81 deletions

View File

@ -711,13 +711,6 @@ a.learn-more-link.webconsole-learn-more-link {
min-width: 150px;
}
.webconsole-filterbar-primary .filter-checkbox {
flex-shrink: 0;
margin: 0 3px;
display: flex;
align-items: center;
user-select: none;
}
/* Special casing String reps, and warning/error string colors
* so they are legible */

View File

@ -1,31 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js");
const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
FilterCheckbox.displayName = "FilterCheckbox";
FilterCheckbox.propTypes = {
label: PropTypes.string.isRequired,
title: PropTypes.string,
checked: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
};
function FilterCheckbox(props) {
const { checked, label, title, onChange } = props;
return dom.label(
{ title, className: "filter-checkbox" },
dom.input({
type: "checkbox",
checked,
onChange,
}),
label
);
}
module.exports = FilterCheckbox;

View File

@ -7,5 +7,4 @@ DevToolsModules(
"ConsoleSettings.js",
"FilterBar.js",
"FilterButton.js",
"FilterCheckbox.js",
)

View File

@ -1,39 +0,0 @@
/* 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');
});
});

View File

@ -84,9 +84,9 @@ The React architecture is described on the following diagram.
│ │ ┌─────────┴─────────────┐ │
│ │ │ │ │
│ │ ▼ ▼ ▼
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ │ FilterButton │ │ FilterCheckbox │ │ MessageContainer │
│ └──────────────────┘ └──────────────────┘ └──────────────────┘ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ │ FilterButton │ │ ConsoleSettings │ │ MessageContainer │
│ └──────────────────┘ └──────────────────┘ └──────────────────┘ │
│ │ │
│ │ │
│ │ │