fix(tests): always use toDiffableHtml for snapshots

This commit is contained in:
Łukasz Mierzwa
2020-07-06 18:41:25 +01:00
committed by Łukasz Mierzwa
parent 265e63e0ff
commit a373f210f5
2 changed files with 53 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ import React from "react";
import { mount } from "enzyme";
import toDiffableHtml from "diffable-html";
import { MockThemeContext } from "__mocks__/Theme";
import { AlertStore } from "Stores/AlertStore";
import { Settings } from "Stores/Settings";
@@ -145,7 +147,7 @@ describe("<SilenceModalContent /> Editor", () => {
it("renders SilenceSubmitController when silenceFormStore.data.currentStage is 'Submit'", () => {
silenceFormStore.data.currentStage = SilenceFormStage.Submit;
const tree = MountedSilenceModalContent();
expect(tree.html()).toMatchSnapshot();
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
});
});

View File

@@ -1,3 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<SilenceModalContent /> Editor renders SilenceSubmitController when silenceFormStore.data.currentStage is 'Submit' 1`] = `"<div class=\\"modal-header py-2\\"><nav class=\\"nav nav-pills nav-justified w-100\\"><span class=\\"nav-item nav-link cursor-pointer mx-1 px-2 active\\">Silence submitted</span><span class=\\"nav-item nav-link cursor-pointer mx-1 px-2 components-tab-inactive\\">Browse</span><button type=\\"button\\" class=\\"close\\"><span>×</span></button></nav></div><div class=\\"modal-body \\"><div class=\\"table-responsive\\"><table class=\\"table table-borderless\\"><tbody></tbody></table></div><div class=\\"d-flex flex-row-reverse\\"><button type=\\"button\\" class=\\"btn btn-primary\\"><svg aria-hidden=\\"true\\" focusable=\\"false\\" data-prefix=\\"fas\\" data-icon=\\"arrow-left\\" class=\\"svg-inline--fa fa-arrow-left fa-w-14 pr-1\\" role=\\"img\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 448 512\\"><path fill=\\"currentColor\\" d=\\"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z\\"></path></svg>Back</button></div></div>"`;
exports[`<SilenceModalContent /> Editor renders SilenceSubmitController when silenceFormStore.data.currentStage is 'Submit' 1`] = `
"
<div class=\\"modal-header py-2\\">
<nav class=\\"nav nav-pills nav-justified w-100\\">
<span class=\\"nav-item nav-link cursor-pointer mx-1 px-2 active\\">
Silence submitted
</span>
<span class=\\"nav-item nav-link cursor-pointer mx-1 px-2 components-tab-inactive\\">
Browse
</span>
<button type=\\"button\\"
class=\\"close\\"
>
<span>
×
</span>
</button>
</nav>
</div>
<div class=\\"modal-body \\">
<div class=\\"table-responsive\\">
<table class=\\"table table-borderless\\">
<tbody>
</tbody>
</table>
</div>
<div class=\\"d-flex flex-row-reverse\\">
<button type=\\"button\\"
class=\\"btn btn-primary\\"
>
<svg aria-hidden=\\"true\\"
focusable=\\"false\\"
data-prefix=\\"fas\\"
data-icon=\\"arrow-left\\"
class=\\"svg-inline--fa fa-arrow-left fa-w-14 pr-1\\"
role=\\"img\\"
xmlns=\\"http://www.w3.org/2000/svg\\"
viewbox=\\"0 0 448 512\\"
>
<path fill=\\"currentColor\\"
d=\\"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z\\"
>
</path>
</svg>
Back
</button>
</div>
</div>
"
`;