small fix to make the alert test more readable (#85)
This commit is contained in:
parent
1297c9f391
commit
55a0f443ed
2 changed files with 72 additions and 70 deletions
|
@ -18,10 +18,12 @@ const WithButton = () => {
|
|||
);
|
||||
};
|
||||
|
||||
it("renders global alerts", () => {
|
||||
it("renders empty alert panel", () => {
|
||||
const empty = mount(<AlertPanel alerts={[]} onCloseAlert={() => {}} />);
|
||||
expect(empty).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("remove alert after timeout", () => {
|
||||
const tree = mount(<WithButton />);
|
||||
const button = tree.find("button");
|
||||
expect(button).not.toBeNull();
|
||||
|
@ -29,10 +31,10 @@ it("renders global alerts", () => {
|
|||
act(() => {
|
||||
button!.simulate("click");
|
||||
});
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(tree).toMatchSnapshot("with alert");
|
||||
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(tree).toMatchSnapshot("cleared alert");
|
||||
});
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders global alerts 1`] = `
|
||||
<AlertPanel
|
||||
exports[`remove alert after timeout: cleared alert 1`] = `
|
||||
<WithButton>
|
||||
<AlertPanel
|
||||
alerts={Array []}
|
||||
onCloseAlert={[Function]}
|
||||
>
|
||||
>
|
||||
<AlertGroup
|
||||
isToast={true}
|
||||
>
|
||||
|
@ -26,10 +27,28 @@ exports[`renders global alerts 1`] = `
|
|||
</AlertGroupInline>
|
||||
</Portal>
|
||||
</AlertGroup>
|
||||
</AlertPanel>
|
||||
</AlertPanel>
|
||||
<Button
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id={0}
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
</Button>
|
||||
</WithButton>
|
||||
`;
|
||||
|
||||
exports[`renders global alerts 2`] = `
|
||||
exports[`remove alert after timeout: with alert 1`] = `
|
||||
<WithButton>
|
||||
<AlertPanel
|
||||
alerts={Array []}
|
||||
|
@ -146,12 +165,11 @@ exports[`renders global alerts 2`] = `
|
|||
</WithButton>
|
||||
`;
|
||||
|
||||
exports[`renders global alerts 3`] = `
|
||||
<WithButton>
|
||||
<AlertPanel
|
||||
exports[`renders empty alert panel 1`] = `
|
||||
<AlertPanel
|
||||
alerts={Array []}
|
||||
onCloseAlert={[Function]}
|
||||
>
|
||||
>
|
||||
<AlertGroup
|
||||
isToast={true}
|
||||
>
|
||||
|
@ -173,23 +191,5 @@ exports[`renders global alerts 3`] = `
|
|||
</AlertGroupInline>
|
||||
</Portal>
|
||||
</AlertGroup>
|
||||
</AlertPanel>
|
||||
<Button
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id={0}
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
</Button>
|
||||
</WithButton>
|
||||
</AlertPanel>
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue