зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1367395 - Fix mocha filter component test. r=Honza
Since the FilterButton component is now only a function that returns a React Element, it looks like Enzyme can't do the comparison we were doing before. Checking directly the resulting html, even if non-optimal, fixes the test. MozReview-Commit-ID: 5fAk8WyYCaF --HG-- extra : rebase_source : bcf5950bbf2fb63c0a2ff1a99f578eea99379745
This commit is contained in:
Родитель
50c15957c0
Коммит
af9a63d7d2
|
@ -4,12 +4,12 @@
|
|||
|
||||
const expect = require("expect");
|
||||
const sinon = require("sinon");
|
||||
const { render, mount } = require("enzyme");
|
||||
const { render, mount, shallow } = require("enzyme");
|
||||
|
||||
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"));
|
||||
const FilterButton = require("devtools/client/webconsole/new-console-output/components/filter-button");
|
||||
const FilterBar = createFactory(require("devtools/client/webconsole/new-console-output/components/filter-bar"));
|
||||
const { getAllUi } = require("devtools/client/webconsole/new-console-output/selectors/ui");
|
||||
const {
|
||||
|
@ -57,6 +57,9 @@ describe("FilterBar component:", () => {
|
|||
|
||||
expect(getAllUi(store.getState()).filterBarVisible).toBe(true);
|
||||
|
||||
const secondaryBar = wrapper.find(".webconsole-filterbar-secondary");
|
||||
expect(secondaryBar.length).toBe(1);
|
||||
|
||||
// Buttons are displayed
|
||||
const filterBtn = props => FilterButton(
|
||||
Object.assign({}, {
|
||||
|
@ -79,7 +82,9 @@ describe("FilterBar component:", () => {
|
|||
filterBtn({ label: "Requests", filterKey: "net", active: false }),
|
||||
];
|
||||
|
||||
expect(wrapper.containsAllMatchingElements(buttons)).toBe(true);
|
||||
secondaryBar.children().forEach((child, index) => {
|
||||
expect(child.html()).toEqual(shallow(buttons[index]).html());
|
||||
})
|
||||
});
|
||||
|
||||
it("fires MESSAGES_CLEAR action when clear button is clicked", () => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче