зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1321485 - Cleanup filter bar. r=jdescottes
Remove code for additional toolbar which isn't shown for now. Fix mocha test since it was failing. MozReview-Commit-ID: p9Pg2Qyz3Q --HG-- extra : rebase_source : 77aaf6209052fa7482d648e5f362378d822fd7d0
This commit is contained in:
Родитель
e9afe102de
Коммит
734c06fc97
|
@ -12,9 +12,13 @@ const {
|
|||
const { connect } = require("devtools/client/shared/vendor/react-redux");
|
||||
const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters");
|
||||
const { getAllUi } = require("devtools/client/webconsole/new-console-output/selectors/ui");
|
||||
const { filterTextSet, filtersClear } = require("devtools/client/webconsole/new-console-output/actions/index");
|
||||
const { messagesClear } = require("devtools/client/webconsole/new-console-output/actions/index");
|
||||
const uiActions = require("devtools/client/webconsole/new-console-output/actions/index");
|
||||
const {
|
||||
filterTextSet,
|
||||
filtersClear,
|
||||
filterBarToggle,
|
||||
messagesClear
|
||||
} = require("devtools/client/webconsole/new-console-output/actions/index");
|
||||
const { l10n } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const {
|
||||
MESSAGE_LEVEL
|
||||
} = require("../constants");
|
||||
|
@ -43,7 +47,7 @@ const FilterBar = createClass({
|
|||
},
|
||||
|
||||
onClickFilterBarToggle: function () {
|
||||
this.props.dispatch(uiActions.filterBarToggle());
|
||||
this.props.dispatch(filterBarToggle());
|
||||
},
|
||||
|
||||
onClickFiltersClear: function () {
|
||||
|
@ -138,23 +142,6 @@ const FilterBar = createClass({
|
|||
);
|
||||
}
|
||||
|
||||
if (ui.filteredMessageVisible) {
|
||||
children.push(
|
||||
dom.div({className: "devtools-toolbar"},
|
||||
dom.span({
|
||||
className: "clear"},
|
||||
"You have filters set that may hide some results. " +
|
||||
"Learn more about our filtering syntax ",
|
||||
dom.a({}, "here"),
|
||||
"."),
|
||||
dom.button({
|
||||
className: "menu-filter-button",
|
||||
onClick: this.onClickFiltersClear
|
||||
}, "Remove filters")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
dom.div({
|
||||
className: "webconsole-filteringbar-wrapper",
|
||||
|
|
|
@ -6,7 +6,7 @@ const expect = require("expect");
|
|||
const sinon = require("sinon");
|
||||
const { render, mount } = require("enzyme");
|
||||
|
||||
const { createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const { createFactory, DOM } = require("devtools/client/shared/vendor/react");
|
||||
const Provider = createFactory(require("react-redux").Provider);
|
||||
|
||||
const FilterButton = createFactory(require("devtools/client/webconsole/new-console-output/components/filter-button"));
|
||||
|
@ -58,22 +58,28 @@ describe("FilterBar component:", () => {
|
|||
expect(getAllUi(store.getState()).filterBarVisible).toBe(true);
|
||||
|
||||
// Buttons are displayed
|
||||
const buttonProps = {
|
||||
active: true,
|
||||
dispatch: store.dispatch
|
||||
};
|
||||
const logButton = FilterButton(Object.assign({}, buttonProps,
|
||||
{ label: "Logs", filterKey: MESSAGE_LEVEL.LOG }));
|
||||
const debugButton = FilterButton(Object.assign({}, buttonProps,
|
||||
{ label: "Debug", filterKey: MESSAGE_LEVEL.DEBUG }));
|
||||
const infoButton = FilterButton(Object.assign({}, buttonProps,
|
||||
{ label: "Info", filterKey: MESSAGE_LEVEL.INFO }));
|
||||
const warnButton = FilterButton(Object.assign({}, buttonProps,
|
||||
{ label: "Warnings", filterKey: MESSAGE_LEVEL.WARN }));
|
||||
const errorButton = FilterButton(Object.assign({}, buttonProps,
|
||||
{ label: "Errors", filterKey: MESSAGE_LEVEL.ERROR }));
|
||||
let buttons = [errorButton, warnButton, logButton, infoButton, debugButton];
|
||||
expect(wrapper.contains(buttons)).toBe(true);
|
||||
const filterBtn = props => FilterButton(
|
||||
Object.assign({}, {
|
||||
active: true,
|
||||
dispatch: store.dispatch
|
||||
}, props)
|
||||
);
|
||||
|
||||
let buttons = [
|
||||
filterBtn({ label: "Errors", filterKey: MESSAGE_LEVEL.ERROR }),
|
||||
filterBtn({ label: "Warnings", filterKey: MESSAGE_LEVEL.WARN }),
|
||||
filterBtn({ label: "Logs", filterKey: MESSAGE_LEVEL.LOG }),
|
||||
filterBtn({ label: "Info", filterKey: MESSAGE_LEVEL.INFO }),
|
||||
filterBtn({ label: "Debug", filterKey: MESSAGE_LEVEL.DEBUG }),
|
||||
DOM.span({
|
||||
className: "devtools-separator",
|
||||
}),
|
||||
filterBtn({ label: "CSS", filterKey: "css" }),
|
||||
filterBtn({ label: "XHR", filterKey: "netxhr", active: false }),
|
||||
filterBtn({ label: "Requests", filterKey: "net", active: false }),
|
||||
];
|
||||
|
||||
expect(wrapper.containsAllMatchingElements(buttons)).toBe(true);
|
||||
});
|
||||
|
||||
it("fires MESSAGES_CLEAR action when clear button is clicked", () => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче