mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
fix(tests): use diffable html instead tree snapshots
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,8 @@ import React from "react";
|
||||
|
||||
import { shallow, mount } from "enzyme";
|
||||
|
||||
import toDiffableHtml from "diffable-html";
|
||||
|
||||
import { MultiSelect } from ".";
|
||||
|
||||
const Option = value => ({ label: value, value: value });
|
||||
@@ -25,19 +27,19 @@ class CustomMultiSelect extends MultiSelect {
|
||||
describe("<CustomMultiSelect />", () => {
|
||||
it("matches snapshot with defaults", () => {
|
||||
const tree = shallow(<CustomMultiSelect />);
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("matches snapshot with isMulti=true", () => {
|
||||
const tree = shallow(<CustomMultiSelect isMulti />);
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("matches snapshot when focused", () => {
|
||||
// this test is to cover styles state.isFocused conditions
|
||||
const tree = mount(<CustomMultiSelect autoFocus />);
|
||||
tree.find("input").simulate("focus");
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("matches snapshot with a value", () => {
|
||||
@@ -47,7 +49,7 @@ describe("<CustomMultiSelect />", () => {
|
||||
options={[Option("foo", Option("bar"))]}
|
||||
/>
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("matches snapshot with isMulti=true and a value", () => {
|
||||
@@ -58,6 +60,6 @@ describe("<CustomMultiSelect />", () => {
|
||||
options={[Option("foo", Option("bar"))]}
|
||||
/>
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user