Drop snapshot tests in Jest
This commit is contained in:
parent
07d6239e5b
commit
18e96fda16
25 changed files with 2 additions and 24638 deletions
|
@ -6,7 +6,6 @@ import type { Config } from "@jest/types";
|
|||
const config: Config.InitialOptions = {
|
||||
...snowpackConfig(),
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
||||
snapshotSerializers: ["enzyme-to-json/serializer"],
|
||||
moduleNameMapper: {
|
||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
|
||||
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js"
|
||||
|
|
|
@ -76,7 +76,6 @@
|
|||
"decompress-targz": "^4.1.1",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.6",
|
||||
"enzyme-to-json": "^3.6.2",
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-plugin-react": "^7.24.0",
|
||||
"grunt": "^1.4.1",
|
||||
|
|
|
@ -32,7 +32,6 @@ describe("<MapperDialog/>", () => {
|
|||
);
|
||||
|
||||
container.find("button#open").simulate("click");
|
||||
expect(container).toMatchSnapshot();
|
||||
|
||||
const button = container.find("button#modal-confirm");
|
||||
expect(button.hasClass("pf-m-disabled")).toBe(true);
|
||||
|
@ -66,7 +65,6 @@ describe("<MapperDialog/>", () => {
|
|||
const container = mount(<Test protocol={protocol} onConfirm={onConfirm} />);
|
||||
|
||||
container.find("button#open").simulate("click");
|
||||
expect(container).toMatchSnapshot();
|
||||
|
||||
container
|
||||
.find("div.pf-c-data-list__item-content")
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,39 +0,0 @@
|
|||
import React from "react";
|
||||
import { Button } from "@patternfly/react-core";
|
||||
import { mount } from "enzyme";
|
||||
import { act } from "react-dom/test-utils";
|
||||
|
||||
import { AlertPanel } from "../AlertPanel";
|
||||
import { AlertProvider, useAlerts } from "../Alerts";
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
const WithButton = () => {
|
||||
const { addAlert } = useAlerts();
|
||||
return (
|
||||
<AlertProvider>
|
||||
<Button onClick={() => addAlert("Hello")}>Add</Button>
|
||||
</AlertProvider>
|
||||
);
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
act(() => {
|
||||
button!.simulate("click");
|
||||
});
|
||||
expect(tree).toMatchSnapshot("with alert");
|
||||
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
expect(tree).toMatchSnapshot("cleared alert");
|
||||
});
|
|
@ -1,142 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`remove alert after timeout: cleared alert 1`] = `
|
||||
<WithButton>
|
||||
<AlertProvider>
|
||||
<AlertPanel
|
||||
alerts={Array []}
|
||||
onCloseAlert={[Function]}
|
||||
>
|
||||
<AlertGroup
|
||||
isToast={true}
|
||||
>
|
||||
<Portal
|
||||
containerInfo={
|
||||
<div>
|
||||
<ul
|
||||
class="pf-c-alert-group pf-m-toast"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<AlertGroupInline
|
||||
isToast={true}
|
||||
>
|
||||
<ul
|
||||
className="pf-c-alert-group pf-m-toast"
|
||||
/>
|
||||
</AlertGroupInline>
|
||||
</Portal>
|
||||
</AlertGroup>
|
||||
</AlertPanel>
|
||||
<Button
|
||||
onClick={[Function]}
|
||||
>
|
||||
<ButtonBase
|
||||
innerRef={null}
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
</AlertProvider>
|
||||
</WithButton>
|
||||
`;
|
||||
|
||||
exports[`remove alert after timeout: with alert 1`] = `
|
||||
<WithButton>
|
||||
<AlertProvider>
|
||||
<AlertPanel
|
||||
alerts={Array []}
|
||||
onCloseAlert={[Function]}
|
||||
>
|
||||
<AlertGroup
|
||||
isToast={true}
|
||||
>
|
||||
<Portal
|
||||
containerInfo={
|
||||
<div>
|
||||
<ul
|
||||
class="pf-c-alert-group pf-m-toast"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<AlertGroupInline
|
||||
isToast={true}
|
||||
>
|
||||
<ul
|
||||
className="pf-c-alert-group pf-m-toast"
|
||||
/>
|
||||
</AlertGroupInline>
|
||||
</Portal>
|
||||
</AlertGroup>
|
||||
</AlertPanel>
|
||||
<Button
|
||||
onClick={[Function]}
|
||||
>
|
||||
<ButtonBase
|
||||
innerRef={null}
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
</AlertProvider>
|
||||
</WithButton>
|
||||
`;
|
||||
|
||||
exports[`renders empty alert panel 1`] = `
|
||||
<AlertPanel
|
||||
alerts={Array []}
|
||||
onCloseAlert={[Function]}
|
||||
>
|
||||
<AlertGroup
|
||||
isToast={true}
|
||||
>
|
||||
<Portal
|
||||
containerInfo={
|
||||
<div>
|
||||
<ul
|
||||
class="pf-c-alert-group pf-m-toast"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<AlertGroupInline
|
||||
isToast={true}
|
||||
>
|
||||
<ul
|
||||
className="pf-c-alert-group pf-m-toast"
|
||||
/>
|
||||
</AlertGroupInline>
|
||||
</Portal>
|
||||
</AlertGroup>
|
||||
</AlertPanel>
|
||||
`;
|
|
@ -1,32 +0,0 @@
|
|||
import React, { useEffect } from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
|
||||
import { GroupBreadCrumbs } from "../GroupBreadCrumbs";
|
||||
import { SubGroups, useSubGroups } from "../../../groups/SubGroupsContext";
|
||||
|
||||
const GroupCrumbs = () => {
|
||||
const { setSubGroups } = useSubGroups();
|
||||
useEffect(() => {
|
||||
setSubGroups([
|
||||
{ id: "1", name: "first group" },
|
||||
{ id: "123", name: "active group" },
|
||||
]);
|
||||
}, []);
|
||||
|
||||
return <GroupBreadCrumbs />;
|
||||
};
|
||||
|
||||
describe("Group BreadCrumbs tests", () => {
|
||||
it("couple of crumbs", () => {
|
||||
const crumbs = mount(
|
||||
<MemoryRouter initialEntries={["/groups"]}>
|
||||
<SubGroups>
|
||||
<GroupCrumbs />
|
||||
</SubGroups>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
expect(crumbs.find(GroupCrumbs)).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { PageBreadCrumbs } from "../PageBreadCrumbs";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
|
||||
describe("BreadCrumbs tests", () => {
|
||||
it("couple of crumbs", () => {
|
||||
const crumbs = mount(
|
||||
<MemoryRouter initialEntries={["/master/clients/1234/settings"]}>
|
||||
<PageBreadCrumbs />
|
||||
</MemoryRouter>
|
||||
);
|
||||
expect(crumbs.find(PageBreadCrumbs)).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,140 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Group BreadCrumbs tests couple of crumbs 1`] = `
|
||||
<GroupCrumbs>
|
||||
<GroupBreadCrumbs>
|
||||
<Breadcrumb>
|
||||
<nav
|
||||
aria-label="Breadcrumb"
|
||||
className="pf-c-breadcrumb"
|
||||
data-ouia-component-id="OUIA-Generated-Breadcrumb-1"
|
||||
data-ouia-component-type="PF4/Breadcrumb"
|
||||
data-ouia-safe={true}
|
||||
>
|
||||
<ol
|
||||
className="pf-c-breadcrumb__list"
|
||||
>
|
||||
<BreadcrumbItem
|
||||
key=".$home"
|
||||
showDivider={false}
|
||||
>
|
||||
<li
|
||||
className="pf-c-breadcrumb__item"
|
||||
>
|
||||
<Link
|
||||
to="//groups"
|
||||
>
|
||||
<LinkAnchor
|
||||
href="//groups"
|
||||
navigate={[Function]}
|
||||
>
|
||||
<a
|
||||
href="//groups"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Groups
|
||||
</a>
|
||||
</LinkAnchor>
|
||||
</Link>
|
||||
</li>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem
|
||||
isActive={false}
|
||||
key=".1:$0"
|
||||
showDivider={true}
|
||||
>
|
||||
<li
|
||||
className="pf-c-breadcrumb__item"
|
||||
>
|
||||
<span
|
||||
className="pf-c-breadcrumb__item-divider"
|
||||
>
|
||||
<AngleRightIcon
|
||||
color="currentColor"
|
||||
noVerticalAlign={false}
|
||||
size="sm"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-labelledby={null}
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"verticalAlign": "-0.125em",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 256 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
|
||||
/>
|
||||
</svg>
|
||||
</AngleRightIcon>
|
||||
</span>
|
||||
<Link
|
||||
onClick={[Function]}
|
||||
to=""
|
||||
>
|
||||
<LinkAnchor
|
||||
href="/"
|
||||
navigate={[Function]}
|
||||
onClick={[Function]}
|
||||
>
|
||||
<a
|
||||
href="/"
|
||||
onClick={[Function]}
|
||||
>
|
||||
first group
|
||||
</a>
|
||||
</LinkAnchor>
|
||||
</Link>
|
||||
</li>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem
|
||||
isActive={true}
|
||||
key=".1:$1"
|
||||
showDivider={true}
|
||||
>
|
||||
<li
|
||||
className="pf-c-breadcrumb__item"
|
||||
>
|
||||
<span
|
||||
className="pf-c-breadcrumb__item-divider"
|
||||
>
|
||||
<AngleRightIcon
|
||||
color="currentColor"
|
||||
noVerticalAlign={false}
|
||||
size="sm"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-labelledby={null}
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"verticalAlign": "-0.125em",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 256 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
|
||||
/>
|
||||
</svg>
|
||||
</AngleRightIcon>
|
||||
</span>
|
||||
Group details
|
||||
</li>
|
||||
</BreadcrumbItem>
|
||||
</ol>
|
||||
</nav>
|
||||
</Breadcrumb>
|
||||
</GroupBreadCrumbs>
|
||||
</GroupCrumbs>
|
||||
`;
|
|
@ -1,150 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`BreadCrumbs tests couple of crumbs 1`] = `
|
||||
<PageBreadCrumbs>
|
||||
<Breadcrumb>
|
||||
<nav
|
||||
aria-label="Breadcrumb"
|
||||
className="pf-c-breadcrumb"
|
||||
data-ouia-component-id="OUIA-Generated-Breadcrumb-1"
|
||||
data-ouia-component-type="PF4/Breadcrumb"
|
||||
data-ouia-safe={true}
|
||||
>
|
||||
<ol
|
||||
className="pf-c-breadcrumb__list"
|
||||
>
|
||||
<BreadcrumbItem
|
||||
isActive={false}
|
||||
key=".$0"
|
||||
showDivider={false}
|
||||
>
|
||||
<li
|
||||
className="pf-c-breadcrumb__item"
|
||||
>
|
||||
<Link
|
||||
to="/master"
|
||||
>
|
||||
<LinkAnchor
|
||||
href="/master"
|
||||
navigate={[Function]}
|
||||
>
|
||||
<a
|
||||
href="/master"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<span
|
||||
key="/master"
|
||||
>
|
||||
Home
|
||||
</span>
|
||||
</a>
|
||||
</LinkAnchor>
|
||||
</Link>
|
||||
</li>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem
|
||||
isActive={false}
|
||||
key=".$1"
|
||||
showDivider={true}
|
||||
>
|
||||
<li
|
||||
className="pf-c-breadcrumb__item"
|
||||
>
|
||||
<span
|
||||
className="pf-c-breadcrumb__item-divider"
|
||||
>
|
||||
<AngleRightIcon
|
||||
color="currentColor"
|
||||
noVerticalAlign={false}
|
||||
size="sm"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-labelledby={null}
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"verticalAlign": "-0.125em",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 256 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
|
||||
/>
|
||||
</svg>
|
||||
</AngleRightIcon>
|
||||
</span>
|
||||
<Link
|
||||
to="/master/clients"
|
||||
>
|
||||
<LinkAnchor
|
||||
href="/master/clients"
|
||||
navigate={[Function]}
|
||||
>
|
||||
<a
|
||||
href="/master/clients"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<span
|
||||
key="/master/clients"
|
||||
>
|
||||
Clients
|
||||
</span>
|
||||
</a>
|
||||
</LinkAnchor>
|
||||
</Link>
|
||||
</li>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem
|
||||
isActive={true}
|
||||
key=".$2"
|
||||
showDivider={true}
|
||||
>
|
||||
<li
|
||||
className="pf-c-breadcrumb__item"
|
||||
>
|
||||
<span
|
||||
className="pf-c-breadcrumb__item-divider"
|
||||
>
|
||||
<AngleRightIcon
|
||||
color="currentColor"
|
||||
noVerticalAlign={false}
|
||||
size="sm"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-labelledby={null}
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"verticalAlign": "-0.125em",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 256 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
|
||||
/>
|
||||
</svg>
|
||||
</AngleRightIcon>
|
||||
</span>
|
||||
<span
|
||||
key="/master/clients/1234/settings"
|
||||
>
|
||||
Client details
|
||||
</span>
|
||||
</li>
|
||||
</BreadcrumbItem>
|
||||
</ol>
|
||||
</nav>
|
||||
</Breadcrumb>
|
||||
<GroupBreadCrumbs />
|
||||
</PageBreadCrumbs>
|
||||
`;
|
|
@ -25,7 +25,6 @@ describe("Confirmation dialog", () => {
|
|||
|
||||
const simple = mount(<Test />);
|
||||
simple.find("#show").simulate("click");
|
||||
expect(simple).toMatchSnapshot();
|
||||
|
||||
const button = simple.find("#modal-confirm").find("button");
|
||||
expect(button).not.toBeNull();
|
||||
|
|
|
@ -1,404 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Confirmation dialog renders simple confirm dialog 1`] = `
|
||||
<Test>
|
||||
<button
|
||||
id="show"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Show
|
||||
</button>
|
||||
<Dialog>
|
||||
<ConfirmDialogModal
|
||||
continueButtonLabel="Delete"
|
||||
key="confirmDialog"
|
||||
messageKey="If you delete this client, all associated data will be removed."
|
||||
onConfirm={[MockFunction]}
|
||||
open={true}
|
||||
titleKey="Delete app02?"
|
||||
toggleDialog={[Function]}
|
||||
>
|
||||
<Modal
|
||||
actions={
|
||||
Array [
|
||||
<Button
|
||||
data-testid="modalConfirm"
|
||||
id="modal-confirm"
|
||||
onClick={[Function]}
|
||||
variant="primary"
|
||||
>
|
||||
Delete
|
||||
</Button>,
|
||||
<Button
|
||||
id="modal-cancel"
|
||||
onClick={[Function]}
|
||||
variant="link"
|
||||
>
|
||||
cancel
|
||||
</Button>,
|
||||
]
|
||||
}
|
||||
appendTo={[Function]}
|
||||
aria-describedby=""
|
||||
aria-label=""
|
||||
aria-labelledby=""
|
||||
className=""
|
||||
hasNoBodyWrapper={false}
|
||||
isOpen={true}
|
||||
onClose={[Function]}
|
||||
ouiaSafe={true}
|
||||
showClose={true}
|
||||
title="Delete app02?"
|
||||
titleIconVariant={null}
|
||||
titleLabel=""
|
||||
variant="small"
|
||||
>
|
||||
<Portal
|
||||
containerInfo={
|
||||
<div>
|
||||
<div
|
||||
class="pf-c-backdrop"
|
||||
>
|
||||
<div
|
||||
class="pf-l-bullseye"
|
||||
>
|
||||
<div
|
||||
aria-describedby="pf-modal-part-3"
|
||||
aria-labelledby="pf-modal-part-2"
|
||||
aria-modal="true"
|
||||
class="pf-c-modal-box pf-m-sm"
|
||||
data-ouia-component-id="OUIA-Generated-Modal-small-2"
|
||||
data-ouia-component-type="PF4/ModalContent"
|
||||
data-ouia-safe="true"
|
||||
id="pf-modal-part-1"
|
||||
role="dialog"
|
||||
>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
aria-label="Close"
|
||||
class="pf-c-button pf-m-plain"
|
||||
data-ouia-component-id="OUIA-Generated-Button-plain-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe="true"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 352 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<header
|
||||
class="pf-c-modal-box__header"
|
||||
>
|
||||
<h1
|
||||
class="pf-c-modal-box__title"
|
||||
id="pf-modal-part-2"
|
||||
>
|
||||
|
||||
<span
|
||||
class="pf-c-modal-box__title-text"
|
||||
>
|
||||
Delete app02?
|
||||
</span>
|
||||
</h1>
|
||||
</header>
|
||||
<div
|
||||
class="pf-c-modal-box__body"
|
||||
id="pf-modal-part-3"
|
||||
>
|
||||
If you delete this client, all associated data will be removed.
|
||||
</div>
|
||||
<footer
|
||||
class="pf-c-modal-box__footer"
|
||||
>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
class="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe="true"
|
||||
data-testid="modalConfirm"
|
||||
id="modal-confirm"
|
||||
type="button"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
class="pf-c-button pf-m-link"
|
||||
data-ouia-component-id="OUIA-Generated-Button-link-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe="true"
|
||||
id="modal-cancel"
|
||||
type="button"
|
||||
>
|
||||
cancel
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<ModalContent
|
||||
actions={
|
||||
Array [
|
||||
<Button
|
||||
data-testid="modalConfirm"
|
||||
id="modal-confirm"
|
||||
onClick={[Function]}
|
||||
variant="primary"
|
||||
>
|
||||
Delete
|
||||
</Button>,
|
||||
<Button
|
||||
id="modal-cancel"
|
||||
onClick={[Function]}
|
||||
variant="link"
|
||||
>
|
||||
cancel
|
||||
</Button>,
|
||||
]
|
||||
}
|
||||
aria-describedby=""
|
||||
aria-label=""
|
||||
aria-labelledby=""
|
||||
boxId="pf-modal-part-1"
|
||||
className=""
|
||||
descriptorId="pf-modal-part-3"
|
||||
hasNoBodyWrapper={false}
|
||||
isOpen={true}
|
||||
labelId="pf-modal-part-2"
|
||||
onClose={[Function]}
|
||||
ouiaId="OUIA-Generated-Modal-small-2"
|
||||
ouiaSafe={true}
|
||||
showClose={true}
|
||||
title="Delete app02?"
|
||||
titleIconVariant={null}
|
||||
titleLabel=""
|
||||
variant="small"
|
||||
>
|
||||
<Backdrop>
|
||||
<div
|
||||
className="pf-c-backdrop"
|
||||
>
|
||||
<FocusTrap
|
||||
active={true}
|
||||
className="pf-l-bullseye"
|
||||
focusTrapOptions={
|
||||
Object {
|
||||
"clickOutsideDeactivates": true,
|
||||
}
|
||||
}
|
||||
paused={false}
|
||||
preventScrollOnDeactivate={false}
|
||||
>
|
||||
<div
|
||||
className="pf-l-bullseye"
|
||||
>
|
||||
<ModalBox
|
||||
aria-describedby="pf-modal-part-3"
|
||||
aria-label=""
|
||||
aria-labelledby="pf-modal-part-2"
|
||||
className=""
|
||||
data-ouia-component-id="OUIA-Generated-Modal-small-2"
|
||||
data-ouia-component-type="PF4/ModalContent"
|
||||
data-ouia-safe={true}
|
||||
id="pf-modal-part-1"
|
||||
style={Object {}}
|
||||
variant="small"
|
||||
>
|
||||
<div
|
||||
aria-describedby="pf-modal-part-3"
|
||||
aria-label={null}
|
||||
aria-labelledby="pf-modal-part-2"
|
||||
aria-modal="true"
|
||||
className="pf-c-modal-box pf-m-sm"
|
||||
data-ouia-component-id="OUIA-Generated-Modal-small-2"
|
||||
data-ouia-component-type="PF4/ModalContent"
|
||||
data-ouia-safe={true}
|
||||
id="pf-modal-part-1"
|
||||
role="dialog"
|
||||
style={Object {}}
|
||||
>
|
||||
<ModalBoxCloseButton
|
||||
onClose={[Function]}
|
||||
>
|
||||
<Button
|
||||
aria-label="Close"
|
||||
className=""
|
||||
onClick={[Function]}
|
||||
variant="plain"
|
||||
>
|
||||
<ButtonBase
|
||||
aria-label="Close"
|
||||
className=""
|
||||
innerRef={null}
|
||||
onClick={[Function]}
|
||||
variant="plain"
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label="Close"
|
||||
className="pf-c-button pf-m-plain"
|
||||
data-ouia-component-id="OUIA-Generated-Button-plain-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
<TimesIcon
|
||||
color="currentColor"
|
||||
noVerticalAlign={false}
|
||||
size="sm"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-labelledby={null}
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"verticalAlign": "-0.125em",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 352 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
|
||||
/>
|
||||
</svg>
|
||||
</TimesIcon>
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
</ModalBoxCloseButton>
|
||||
<ModalBoxHeader
|
||||
help={null}
|
||||
>
|
||||
<header
|
||||
className="pf-c-modal-box__header"
|
||||
>
|
||||
<ModalBoxTitle
|
||||
id="pf-modal-part-2"
|
||||
title="Delete app02?"
|
||||
titleIconVariant={null}
|
||||
titleLabel=""
|
||||
>
|
||||
<h1
|
||||
className="pf-c-modal-box__title"
|
||||
id="pf-modal-part-2"
|
||||
>
|
||||
<span
|
||||
className="pf-c-modal-box__title-text"
|
||||
>
|
||||
Delete app02?
|
||||
</span>
|
||||
</h1>
|
||||
</ModalBoxTitle>
|
||||
</header>
|
||||
</ModalBoxHeader>
|
||||
<ModalBoxBody
|
||||
id="pf-modal-part-3"
|
||||
>
|
||||
<div
|
||||
className="pf-c-modal-box__body"
|
||||
id="pf-modal-part-3"
|
||||
>
|
||||
If you delete this client, all associated data will be removed.
|
||||
</div>
|
||||
</ModalBoxBody>
|
||||
<ModalBoxFooter>
|
||||
<footer
|
||||
className="pf-c-modal-box__footer"
|
||||
>
|
||||
<Button
|
||||
data-testid="modalConfirm"
|
||||
id="modal-confirm"
|
||||
key="confirm"
|
||||
onClick={[Function]}
|
||||
variant="primary"
|
||||
>
|
||||
<ButtonBase
|
||||
data-testid="modalConfirm"
|
||||
id="modal-confirm"
|
||||
innerRef={null}
|
||||
onClick={[Function]}
|
||||
variant="primary"
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
data-testid="modalConfirm"
|
||||
disabled={false}
|
||||
id="modal-confirm"
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
<Button
|
||||
id="modal-cancel"
|
||||
key="cancel"
|
||||
onClick={[Function]}
|
||||
variant="link"
|
||||
>
|
||||
<ButtonBase
|
||||
id="modal-cancel"
|
||||
innerRef={null}
|
||||
onClick={[Function]}
|
||||
variant="link"
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-link"
|
||||
data-ouia-component-id="OUIA-Generated-Button-link-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
id="modal-cancel"
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
cancel
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
</footer>
|
||||
</ModalBoxFooter>
|
||||
</div>
|
||||
</ModalBox>
|
||||
</div>
|
||||
</FocusTrap>
|
||||
</div>
|
||||
</Backdrop>
|
||||
</ModalContent>
|
||||
</Portal>
|
||||
</Modal>
|
||||
</ConfirmDialogModal>
|
||||
</Dialog>
|
||||
</Test>
|
||||
`;
|
|
@ -1,31 +0,0 @@
|
|||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
import { FormattedLink } from "../FormattedLink";
|
||||
|
||||
describe("<ExternalLink />", () => {
|
||||
it("render with link", () => {
|
||||
const comp = render(<FormattedLink href="http://hello.nl/" />);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("render with link and title", () => {
|
||||
const comp = render(
|
||||
<FormattedLink href="http://hello.nl/" title="Link to Hello" />
|
||||
);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("render with internal url", () => {
|
||||
const comp = render(
|
||||
<FormattedLink href="/application/home/" title="Application page" />
|
||||
);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("render as application", () => {
|
||||
const comp = render(
|
||||
<FormattedLink href="/application/main" title="Application link" />
|
||||
);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,79 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<ExternalLink /> render as application 1`] = `
|
||||
<DocumentFragment>
|
||||
<a
|
||||
class=""
|
||||
href="/application/main"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Application link
|
||||
</a>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`<ExternalLink /> render with internal url 1`] = `
|
||||
<DocumentFragment>
|
||||
<a
|
||||
class=""
|
||||
href="/application/home/"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Application page
|
||||
</a>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`<ExternalLink /> render with link 1`] = `
|
||||
<DocumentFragment>
|
||||
<a
|
||||
class=""
|
||||
href="http://hello.nl/"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
http://hello.nl/
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 512 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`<ExternalLink /> render with link and title 1`] = `
|
||||
<DocumentFragment>
|
||||
<a
|
||||
class=""
|
||||
href="http://hello.nl/"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Link to Hello
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 512 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</DocumentFragment>
|
||||
`;
|
|
@ -59,10 +59,6 @@ describe("<FormAccess />", () => {
|
|||
</WhoAmIContext.Provider>
|
||||
);
|
||||
};
|
||||
it("render normal form", () => {
|
||||
const comp = mount(<Form realm="master" />);
|
||||
expect(comp).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("render form disabled for test realm", () => {
|
||||
const container = mount(<Form realm="test" />);
|
||||
|
|
|
@ -1,258 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<FormAccess /> render normal form 1`] = `
|
||||
<Form
|
||||
realm="master"
|
||||
>
|
||||
<AccessContextProvider>
|
||||
<FormAccess
|
||||
role="manage-clients"
|
||||
>
|
||||
<Form
|
||||
className="keycloak__form "
|
||||
>
|
||||
<form
|
||||
className="pf-c-form keycloak__form "
|
||||
noValidate={true}
|
||||
>
|
||||
<FormGroup
|
||||
fieldId="field"
|
||||
key=".0"
|
||||
label="test"
|
||||
>
|
||||
<div
|
||||
className="pf-c-form__group"
|
||||
>
|
||||
<div
|
||||
className="pf-c-form__group-label"
|
||||
>
|
||||
<label
|
||||
className="pf-c-form__label"
|
||||
htmlFor="field"
|
||||
>
|
||||
<span
|
||||
className="pf-c-form__label-text"
|
||||
>
|
||||
test
|
||||
</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<div
|
||||
className="pf-c-form__group-control"
|
||||
>
|
||||
<TextInput
|
||||
id="field"
|
||||
key=".0"
|
||||
name="fieldName"
|
||||
type="text"
|
||||
>
|
||||
<TextInputBase
|
||||
aria-label={null}
|
||||
className=""
|
||||
id="field"
|
||||
innerRef={[Function]}
|
||||
isDisabled={false}
|
||||
isLeftTruncated={false}
|
||||
isReadOnly={false}
|
||||
isRequired={false}
|
||||
name="fieldName"
|
||||
onChange={[Function]}
|
||||
type="text"
|
||||
validated="default"
|
||||
>
|
||||
<input
|
||||
aria-invalid={false}
|
||||
aria-label={null}
|
||||
className="pf-c-form-control"
|
||||
disabled={false}
|
||||
id="field"
|
||||
name="fieldName"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onFocus={[Function]}
|
||||
readOnly={false}
|
||||
required={false}
|
||||
type="text"
|
||||
/>
|
||||
</TextInputBase>
|
||||
</TextInput>
|
||||
</div>
|
||||
</div>
|
||||
</FormGroup>
|
||||
<Controller
|
||||
control={
|
||||
Object {
|
||||
"defaultValuesRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"fieldArrayDefaultValuesRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"fieldArrayNamesRef": Object {
|
||||
"current": Set {},
|
||||
},
|
||||
"fieldArrayValuesRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"fieldsRef": Object {
|
||||
"current": Object {
|
||||
"consentRequired": Object {
|
||||
"ref": Object {
|
||||
"focus": [Function],
|
||||
"name": "consentRequired",
|
||||
},
|
||||
},
|
||||
"fieldName": Object {
|
||||
"ref": <input
|
||||
aria-invalid="false"
|
||||
class="pf-c-form-control"
|
||||
id="field"
|
||||
name="fieldName"
|
||||
type="text"
|
||||
value=""
|
||||
/>,
|
||||
},
|
||||
},
|
||||
},
|
||||
"fieldsWithValidationRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"formState": Object {
|
||||
"dirtyFields": Object {},
|
||||
"errors": Object {},
|
||||
"isDirty": false,
|
||||
"isSubmitSuccessful": false,
|
||||
"isSubmitted": false,
|
||||
"isSubmitting": false,
|
||||
"isValid": false,
|
||||
"isValidating": false,
|
||||
"submitCount": 0,
|
||||
"touched": Object {},
|
||||
},
|
||||
"formStateRef": Object {
|
||||
"current": Object {
|
||||
"dirtyFields": Object {},
|
||||
"errors": Object {},
|
||||
"isDirty": false,
|
||||
"isSubmitSuccessful": false,
|
||||
"isSubmitted": false,
|
||||
"isSubmitting": false,
|
||||
"isValid": false,
|
||||
"isValidating": false,
|
||||
"submitCount": 0,
|
||||
"touched": Object {},
|
||||
},
|
||||
},
|
||||
"getValues": [Function],
|
||||
"isFormDirty": [Function],
|
||||
"mode": Object {
|
||||
"isOnAll": false,
|
||||
"isOnBlur": false,
|
||||
"isOnChange": false,
|
||||
"isOnSubmit": true,
|
||||
"isOnTouch": false,
|
||||
},
|
||||
"reValidateMode": Object {
|
||||
"isReValidateOnBlur": false,
|
||||
"isReValidateOnChange": true,
|
||||
},
|
||||
"readFormStateRef": Object {
|
||||
"current": Object {
|
||||
"constructor": true,
|
||||
"dirtyFields": true,
|
||||
"errors": true,
|
||||
"isDirty": true,
|
||||
"isSubmitSuccessful": true,
|
||||
"isSubmitted": true,
|
||||
"isSubmitting": true,
|
||||
"isValid": true,
|
||||
"isValidating": true,
|
||||
"submitCount": true,
|
||||
"touched": true,
|
||||
},
|
||||
},
|
||||
"register": [Function],
|
||||
"removeFieldEventListener": [Function],
|
||||
"resetFieldArrayFunctionRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"setValue": [Function],
|
||||
"shallowFieldsStateRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"shouldUnregister": true,
|
||||
"trigger": [Function],
|
||||
"unregister": [Function],
|
||||
"updateFormState": [Function],
|
||||
"updateWatchedValue": [Function],
|
||||
"useWatchFieldsRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"useWatchRenderFunctionsRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"validFieldsRef": Object {
|
||||
"current": Object {},
|
||||
},
|
||||
"validateResolver": undefined,
|
||||
"watchInternal": [Function],
|
||||
}
|
||||
}
|
||||
defaultValue={false}
|
||||
key=".1"
|
||||
name="consentRequired"
|
||||
render={[Function]}
|
||||
>
|
||||
<Switch
|
||||
aria-label=""
|
||||
id="kc-consent"
|
||||
isChecked={false}
|
||||
isDisabled={false}
|
||||
label="on"
|
||||
labelOff="off"
|
||||
onChange={[Function]}
|
||||
>
|
||||
<label
|
||||
className="pf-c-switch"
|
||||
data-ouia-component-id="OUIA-Generated-Switch-1"
|
||||
data-ouia-component-type="PF4/Switch"
|
||||
data-ouia-safe={true}
|
||||
htmlFor="kc-consent"
|
||||
>
|
||||
<input
|
||||
aria-label=""
|
||||
aria-labelledby="kc-consent-on"
|
||||
checked={false}
|
||||
className="pf-c-switch__input"
|
||||
disabled={false}
|
||||
id="kc-consent"
|
||||
onChange={[Function]}
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
className="pf-c-switch__toggle"
|
||||
/>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pf-c-switch__label pf-m-on"
|
||||
id="kc-consent-on"
|
||||
>
|
||||
on
|
||||
</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pf-c-switch__label pf-m-off"
|
||||
id="kc-consent-off"
|
||||
>
|
||||
off
|
||||
</span>
|
||||
</label>
|
||||
</Switch>
|
||||
</Controller>
|
||||
</form>
|
||||
</Form>
|
||||
</FormAccess>
|
||||
</AccessContextProvider>
|
||||
</Form>
|
||||
`;
|
|
@ -1,45 +0,0 @@
|
|||
import React, { useContext } from "react";
|
||||
import { render, act, fireEvent } from "@testing-library/react";
|
||||
import { HelpHeader, HelpContext } from "../HelpHeader";
|
||||
|
||||
describe("<HelpHeader />", () => {
|
||||
it("render", () => {
|
||||
const comp = render(<HelpHeader />);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("open dropdown", () => {
|
||||
const comp = render(<HelpHeader />);
|
||||
const button = document.querySelector("button");
|
||||
act(() => {
|
||||
fireEvent.click(button!);
|
||||
});
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("enable help", () => {
|
||||
const HelpEnabled = () => {
|
||||
const { enabled } = useContext(HelpContext);
|
||||
return <div id="result">{enabled ? "YES" : "NO"}</div>;
|
||||
};
|
||||
const comp = render(
|
||||
<>
|
||||
<HelpHeader />
|
||||
<HelpEnabled />
|
||||
</>
|
||||
);
|
||||
|
||||
const button = document.querySelector("button");
|
||||
act(() => {
|
||||
fireEvent.click(button!);
|
||||
});
|
||||
|
||||
const switchComp = document.querySelector("span.pf-c-switch__toggle");
|
||||
act(() => {
|
||||
fireEvent.click(switchComp!);
|
||||
});
|
||||
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
expect(document.getElementById("result")?.innerHTML).toBe("YES");
|
||||
});
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
|
||||
import { HelpItem } from "../HelpItem";
|
||||
|
||||
describe("<HelpItem />", () => {
|
||||
it("render", () => {
|
||||
const comp = render(
|
||||
<HelpItem helpText="storybook" forLabel="storybook" forID="placeholder" />
|
||||
);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,339 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<HelpHeader /> enable help 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="pf-c-dropdown pf-m-align-right pf-m-expanded"
|
||||
data-ouia-component-id="OUIA-Generated-Dropdown-3"
|
||||
data-ouia-component-type="PF4/Dropdown"
|
||||
data-ouia-safe="true"
|
||||
>
|
||||
<button
|
||||
aria-expanded="true"
|
||||
aria-haspopup="true"
|
||||
aria-label="Help"
|
||||
class="pf-c-dropdown__toggle pf-m-plain"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownToggle-3"
|
||||
data-ouia-component-type="PF4/DropdownToggle"
|
||||
data-ouia-safe="true"
|
||||
id="help"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
<ul
|
||||
aria-labelledby="help"
|
||||
class="pf-c-dropdown__menu pf-m-align-right"
|
||||
role="menu"
|
||||
>
|
||||
<li
|
||||
id="link"
|
||||
role="menuitem"
|
||||
>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="pf-c-dropdown__menu-item"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownItem-3"
|
||||
data-ouia-component-type="PF4/DropdownItem"
|
||||
data-ouia-safe="true"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split__item pf-m-fill"
|
||||
>
|
||||
documentation
|
||||
</div>
|
||||
<div
|
||||
class="pf-l-split__item"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 512 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<hr
|
||||
class="pf-c-divider"
|
||||
index="1"
|
||||
/>
|
||||
<li
|
||||
id="enable"
|
||||
role="menuitem"
|
||||
>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="pf-c-dropdown__menu-item"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownItem-4"
|
||||
data-ouia-component-type="PF4/DropdownItem"
|
||||
data-ouia-safe="true"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split__item pf-m-fill"
|
||||
>
|
||||
enableHelpMode
|
||||
</div>
|
||||
<div
|
||||
class="pf-l-split__item"
|
||||
>
|
||||
<label
|
||||
class="pf-c-switch keycloak_help-header-switch"
|
||||
data-ouia-component-id="OUIA-Generated-Switch-2"
|
||||
data-ouia-component-type="PF4/Switch"
|
||||
data-ouia-safe="true"
|
||||
for="enableHelp"
|
||||
>
|
||||
<input
|
||||
aria-label="Help is enabled"
|
||||
checked=""
|
||||
class="pf-c-switch__input"
|
||||
id="enableHelp"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
class="pf-c-switch__toggle"
|
||||
/>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="pf-c-switch__label pf-m-on"
|
||||
/>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="pf-c-switch__label pf-m-off"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="pf-c-content keycloak_help-header-description"
|
||||
>
|
||||
helpToggleInfo
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div
|
||||
id="result"
|
||||
>
|
||||
YES
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`<HelpHeader /> open dropdown 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="pf-c-dropdown pf-m-align-right pf-m-expanded"
|
||||
data-ouia-component-id="OUIA-Generated-Dropdown-2"
|
||||
data-ouia-component-type="PF4/Dropdown"
|
||||
data-ouia-safe="true"
|
||||
>
|
||||
<button
|
||||
aria-expanded="true"
|
||||
aria-haspopup="true"
|
||||
aria-label="Help"
|
||||
class="pf-c-dropdown__toggle pf-m-plain"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownToggle-2"
|
||||
data-ouia-component-type="PF4/DropdownToggle"
|
||||
data-ouia-safe="true"
|
||||
id="help"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
<ul
|
||||
aria-labelledby="help"
|
||||
class="pf-c-dropdown__menu pf-m-align-right"
|
||||
role="menu"
|
||||
>
|
||||
<li
|
||||
id="link"
|
||||
role="menuitem"
|
||||
>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="pf-c-dropdown__menu-item"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownItem-1"
|
||||
data-ouia-component-type="PF4/DropdownItem"
|
||||
data-ouia-safe="true"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split__item pf-m-fill"
|
||||
>
|
||||
documentation
|
||||
</div>
|
||||
<div
|
||||
class="pf-l-split__item"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 512 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<hr
|
||||
class="pf-c-divider"
|
||||
index="1"
|
||||
/>
|
||||
<li
|
||||
id="enable"
|
||||
role="menuitem"
|
||||
>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="pf-c-dropdown__menu-item"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownItem-2"
|
||||
data-ouia-component-type="PF4/DropdownItem"
|
||||
data-ouia-safe="true"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split"
|
||||
>
|
||||
<div
|
||||
class="pf-l-split__item pf-m-fill"
|
||||
>
|
||||
enableHelpMode
|
||||
</div>
|
||||
<div
|
||||
class="pf-l-split__item"
|
||||
>
|
||||
<label
|
||||
class="pf-c-switch keycloak_help-header-switch"
|
||||
data-ouia-component-id="OUIA-Generated-Switch-1"
|
||||
data-ouia-component-type="PF4/Switch"
|
||||
data-ouia-safe="true"
|
||||
for="enableHelp"
|
||||
>
|
||||
<input
|
||||
aria-label="Help is enabled"
|
||||
checked=""
|
||||
class="pf-c-switch__input"
|
||||
id="enableHelp"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
class="pf-c-switch__toggle"
|
||||
/>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="pf-c-switch__label pf-m-on"
|
||||
/>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="pf-c-switch__label pf-m-off"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="pf-c-content keycloak_help-header-description"
|
||||
>
|
||||
helpToggleInfo
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`<HelpHeader /> render 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="pf-c-dropdown pf-m-align-right"
|
||||
data-ouia-component-id="OUIA-Generated-Dropdown-1"
|
||||
data-ouia-component-type="PF4/Dropdown"
|
||||
data-ouia-safe="true"
|
||||
>
|
||||
<button
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
aria-label="Help"
|
||||
class="pf-c-dropdown__toggle pf-m-plain"
|
||||
data-ouia-component-id="OUIA-Generated-DropdownToggle-1"
|
||||
data-ouia-component-type="PF4/DropdownToggle"
|
||||
data-ouia-safe="true"
|
||||
id="help"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
|
@ -1,24 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<HelpItem /> render 1`] = `
|
||||
<DocumentFragment>
|
||||
<button
|
||||
aria-describedby="placeholder"
|
||||
aria-label="helpLabel"
|
||||
class="pf-c-form__group-label-help"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</DocumentFragment>
|
||||
`;
|
|
@ -1,35 +0,0 @@
|
|||
import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import { JsonFileUpload } from "../JsonFileUpload";
|
||||
|
||||
describe("<JsonFileUpload />", () => {
|
||||
it("render", () => {
|
||||
const comp = mount(<JsonFileUpload id="test" onChange={jest.fn()} />);
|
||||
expect(comp).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("upload file", async () => {
|
||||
const onChange = jest.fn((value) => value);
|
||||
const comp = mount(<JsonFileUpload id="upload" onChange={onChange} />);
|
||||
|
||||
const fileInput = comp.find('[type="file"]');
|
||||
expect(fileInput.length).toBe(1);
|
||||
|
||||
const json = '{"bla": "test"}';
|
||||
const file = new File([json], "test.json");
|
||||
|
||||
const dummyFileReader = {
|
||||
onload: jest.fn(),
|
||||
readAsText: () => Promise.resolve(json),
|
||||
};
|
||||
(window as any).FileReader = jest.fn(() => dummyFileReader);
|
||||
|
||||
fileInput.simulate("change", {
|
||||
target: {
|
||||
files: [file],
|
||||
},
|
||||
});
|
||||
expect(comp).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,578 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<JsonFileUpload /> render 1`] = `
|
||||
<JsonFileUpload
|
||||
id="test"
|
||||
onChange={[MockFunction]}
|
||||
>
|
||||
<FormGroup
|
||||
fieldId="test"
|
||||
helperText="helpFileUpload"
|
||||
label="resourceFile"
|
||||
>
|
||||
<div
|
||||
className="pf-c-form__group"
|
||||
>
|
||||
<div
|
||||
className="pf-c-form__group-label"
|
||||
>
|
||||
<label
|
||||
className="pf-c-form__label"
|
||||
htmlFor="test"
|
||||
>
|
||||
<span
|
||||
className="pf-c-form__label-text"
|
||||
>
|
||||
resourceFile
|
||||
</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<div
|
||||
className="pf-c-form__group-control"
|
||||
>
|
||||
<FileUpload
|
||||
dropzoneProps={
|
||||
Object {
|
||||
"accept": ".json",
|
||||
}
|
||||
}
|
||||
filename=""
|
||||
id="test"
|
||||
isLoading={false}
|
||||
onChange={[Function]}
|
||||
onReadFinished={[Function]}
|
||||
onReadStarted={[Function]}
|
||||
type="text"
|
||||
value=""
|
||||
>
|
||||
<t
|
||||
accept=".json"
|
||||
disabled={false}
|
||||
getDataTransferItems={[Function]}
|
||||
maxSize={Infinity}
|
||||
minSize={0}
|
||||
multiple={false}
|
||||
onDropAccepted={[Function]}
|
||||
onDropRejected={[Function]}
|
||||
preventDropOnDocument={true}
|
||||
>
|
||||
<FileUploadField
|
||||
containerRef={[Function]}
|
||||
filename=""
|
||||
id="test"
|
||||
isLoading={false}
|
||||
onBlur={[Function]}
|
||||
onBrowseButtonClick={[Function]}
|
||||
onChange={[Function]}
|
||||
onClearButtonClick={[Function]}
|
||||
onClick={[Function]}
|
||||
onDragEnter={[Function]}
|
||||
onDragLeave={[Function]}
|
||||
onDragOver={[Function]}
|
||||
onDragStart={[Function]}
|
||||
onDrop={[Function]}
|
||||
onFocus={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
onTextAreaClick={[Function]}
|
||||
tabIndex={null}
|
||||
type="text"
|
||||
value=""
|
||||
>
|
||||
<div
|
||||
className="pf-c-file-upload"
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
onDragEnter={[Function]}
|
||||
onDragLeave={[Function]}
|
||||
onDragOver={[Function]}
|
||||
onDragStart={[Function]}
|
||||
onDrop={[Function]}
|
||||
onFocus={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
tabIndex={null}
|
||||
>
|
||||
<div
|
||||
className="pf-c-file-upload__file-select"
|
||||
>
|
||||
<InputGroup>
|
||||
<div
|
||||
className="pf-c-input-group"
|
||||
>
|
||||
<TextInput
|
||||
aria-describedby="test-browse-button"
|
||||
aria-label="Drag a file here or browse to upload"
|
||||
id="test-filename"
|
||||
isDisabled={false}
|
||||
isReadOnly={true}
|
||||
key=".0"
|
||||
name="test-filename"
|
||||
placeholder="Drag a file here or browse to upload"
|
||||
value=""
|
||||
>
|
||||
<TextInputBase
|
||||
aria-describedby="test-browse-button"
|
||||
aria-label="Drag a file here or browse to upload"
|
||||
className=""
|
||||
id="test-filename"
|
||||
innerRef={null}
|
||||
isDisabled={false}
|
||||
isLeftTruncated={false}
|
||||
isReadOnly={true}
|
||||
isRequired={false}
|
||||
name="test-filename"
|
||||
onChange={[Function]}
|
||||
placeholder="Drag a file here or browse to upload"
|
||||
type="text"
|
||||
validated="default"
|
||||
value=""
|
||||
>
|
||||
<input
|
||||
aria-describedby="test-browse-button"
|
||||
aria-invalid={false}
|
||||
aria-label="Drag a file here or browse to upload"
|
||||
className="pf-c-form-control"
|
||||
disabled={false}
|
||||
id="test-filename"
|
||||
name="test-filename"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onFocus={[Function]}
|
||||
placeholder="Drag a file here or browse to upload"
|
||||
readOnly={true}
|
||||
required={false}
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</TextInputBase>
|
||||
</TextInput>
|
||||
<Button
|
||||
id="test-browse-button"
|
||||
isDisabled={false}
|
||||
key=".1"
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<ButtonBase
|
||||
id="test-browse-button"
|
||||
innerRef={null}
|
||||
isDisabled={false}
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-control"
|
||||
data-ouia-component-id="OUIA-Generated-Button-control-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
id="test-browse-button"
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
Browse...
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
<Button
|
||||
isDisabled={true}
|
||||
key=".2"
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<ButtonBase
|
||||
innerRef={null}
|
||||
isDisabled={true}
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<button
|
||||
aria-disabled={true}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-control pf-m-disabled"
|
||||
data-ouia-component-id="OUIA-Generated-Button-control-2"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={true}
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
tabIndex={null}
|
||||
type="button"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
</div>
|
||||
</InputGroup>
|
||||
</div>
|
||||
<div
|
||||
className="pf-c-file-upload__file-details"
|
||||
>
|
||||
<TextArea
|
||||
aria-label="File upload"
|
||||
disabled={false}
|
||||
id="test"
|
||||
isRequired={false}
|
||||
name="test"
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
readOnly={false}
|
||||
resizeOrientation="vertical"
|
||||
validated="default"
|
||||
value=""
|
||||
>
|
||||
<TextArea
|
||||
aria-label="File upload"
|
||||
className=""
|
||||
disabled={false}
|
||||
id="test"
|
||||
innerRef={null}
|
||||
isDisabled={false}
|
||||
isRequired={false}
|
||||
name="test"
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
readOnly={false}
|
||||
resizeOrientation="vertical"
|
||||
validated="default"
|
||||
value=""
|
||||
>
|
||||
<textarea
|
||||
aria-invalid={false}
|
||||
aria-label="File upload"
|
||||
className="pf-c-form-control pf-m-resize-vertical"
|
||||
disabled={false}
|
||||
id="test"
|
||||
name="test"
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
readOnly={false}
|
||||
required={false}
|
||||
value=""
|
||||
/>
|
||||
</TextArea>
|
||||
</TextArea>
|
||||
</div>
|
||||
<input
|
||||
accept=".json"
|
||||
autoComplete="off"
|
||||
multiple={false}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
style={
|
||||
Object {
|
||||
"display": "none",
|
||||
}
|
||||
}
|
||||
tabIndex={-1}
|
||||
type="file"
|
||||
/>
|
||||
</div>
|
||||
</FileUploadField>
|
||||
</t>
|
||||
</FileUpload>
|
||||
<div
|
||||
aria-live="polite"
|
||||
className="pf-c-form__helper-text"
|
||||
id="test-helper"
|
||||
>
|
||||
helpFileUpload
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</FormGroup>
|
||||
</JsonFileUpload>
|
||||
`;
|
||||
|
||||
exports[`<JsonFileUpload /> upload file 1`] = `
|
||||
<JsonFileUpload
|
||||
id="upload"
|
||||
onChange={[MockFunction]}
|
||||
>
|
||||
<FormGroup
|
||||
fieldId="upload"
|
||||
helperText="helpFileUpload"
|
||||
label="resourceFile"
|
||||
>
|
||||
<div
|
||||
className="pf-c-form__group"
|
||||
>
|
||||
<div
|
||||
className="pf-c-form__group-label"
|
||||
>
|
||||
<label
|
||||
className="pf-c-form__label"
|
||||
htmlFor="upload"
|
||||
>
|
||||
<span
|
||||
className="pf-c-form__label-text"
|
||||
>
|
||||
resourceFile
|
||||
</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<div
|
||||
className="pf-c-form__group-control"
|
||||
>
|
||||
<FileUpload
|
||||
dropzoneProps={
|
||||
Object {
|
||||
"accept": ".json",
|
||||
}
|
||||
}
|
||||
filename=""
|
||||
id="upload"
|
||||
isLoading={false}
|
||||
onChange={[Function]}
|
||||
onReadFinished={[Function]}
|
||||
onReadStarted={[Function]}
|
||||
type="text"
|
||||
value=""
|
||||
>
|
||||
<t
|
||||
accept=".json"
|
||||
disabled={false}
|
||||
getDataTransferItems={[Function]}
|
||||
maxSize={Infinity}
|
||||
minSize={0}
|
||||
multiple={false}
|
||||
onDropAccepted={[Function]}
|
||||
onDropRejected={[Function]}
|
||||
preventDropOnDocument={true}
|
||||
>
|
||||
<FileUploadField
|
||||
containerRef={[Function]}
|
||||
filename=""
|
||||
id="upload"
|
||||
isDragActive={false}
|
||||
isLoading={false}
|
||||
onBlur={[Function]}
|
||||
onBrowseButtonClick={[Function]}
|
||||
onChange={[Function]}
|
||||
onClearButtonClick={[Function]}
|
||||
onClick={[Function]}
|
||||
onDragEnter={[Function]}
|
||||
onDragLeave={[Function]}
|
||||
onDragOver={[Function]}
|
||||
onDragStart={[Function]}
|
||||
onDrop={[Function]}
|
||||
onFocus={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
onTextAreaClick={[Function]}
|
||||
tabIndex={null}
|
||||
type="text"
|
||||
value=""
|
||||
>
|
||||
<div
|
||||
className="pf-c-file-upload"
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
onDragEnter={[Function]}
|
||||
onDragLeave={[Function]}
|
||||
onDragOver={[Function]}
|
||||
onDragStart={[Function]}
|
||||
onDrop={[Function]}
|
||||
onFocus={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
tabIndex={null}
|
||||
>
|
||||
<div
|
||||
className="pf-c-file-upload__file-select"
|
||||
>
|
||||
<InputGroup>
|
||||
<div
|
||||
className="pf-c-input-group"
|
||||
>
|
||||
<TextInput
|
||||
aria-describedby="upload-browse-button"
|
||||
aria-label="Drag a file here or browse to upload"
|
||||
id="upload-filename"
|
||||
isDisabled={false}
|
||||
isReadOnly={true}
|
||||
key=".0"
|
||||
name="upload-filename"
|
||||
placeholder="Drag a file here or browse to upload"
|
||||
value=""
|
||||
>
|
||||
<TextInputBase
|
||||
aria-describedby="upload-browse-button"
|
||||
aria-label="Drag a file here or browse to upload"
|
||||
className=""
|
||||
id="upload-filename"
|
||||
innerRef={null}
|
||||
isDisabled={false}
|
||||
isLeftTruncated={false}
|
||||
isReadOnly={true}
|
||||
isRequired={false}
|
||||
name="upload-filename"
|
||||
onChange={[Function]}
|
||||
placeholder="Drag a file here or browse to upload"
|
||||
type="text"
|
||||
validated="default"
|
||||
value=""
|
||||
>
|
||||
<input
|
||||
aria-describedby="upload-browse-button"
|
||||
aria-invalid={false}
|
||||
aria-label="Drag a file here or browse to upload"
|
||||
className="pf-c-form-control"
|
||||
disabled={false}
|
||||
id="upload-filename"
|
||||
name="upload-filename"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onFocus={[Function]}
|
||||
placeholder="Drag a file here or browse to upload"
|
||||
readOnly={true}
|
||||
required={false}
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</TextInputBase>
|
||||
</TextInput>
|
||||
<Button
|
||||
id="upload-browse-button"
|
||||
isDisabled={false}
|
||||
key=".1"
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<ButtonBase
|
||||
id="upload-browse-button"
|
||||
innerRef={null}
|
||||
isDisabled={false}
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-control"
|
||||
data-ouia-component-id="OUIA-Generated-Button-control-3"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={false}
|
||||
id="upload-browse-button"
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
type="button"
|
||||
>
|
||||
Browse...
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
<Button
|
||||
isDisabled={true}
|
||||
key=".2"
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<ButtonBase
|
||||
innerRef={null}
|
||||
isDisabled={true}
|
||||
onClick={[Function]}
|
||||
variant="control"
|
||||
>
|
||||
<button
|
||||
aria-disabled={true}
|
||||
aria-label={null}
|
||||
className="pf-c-button pf-m-control pf-m-disabled"
|
||||
data-ouia-component-id="OUIA-Generated-Button-control-4"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe={true}
|
||||
disabled={true}
|
||||
onClick={[Function]}
|
||||
role={null}
|
||||
tabIndex={null}
|
||||
type="button"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</ButtonBase>
|
||||
</Button>
|
||||
</div>
|
||||
</InputGroup>
|
||||
</div>
|
||||
<div
|
||||
className="pf-c-file-upload__file-details"
|
||||
>
|
||||
<TextArea
|
||||
aria-label="File upload"
|
||||
disabled={false}
|
||||
id="upload"
|
||||
isRequired={false}
|
||||
name="upload"
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
readOnly={false}
|
||||
resizeOrientation="vertical"
|
||||
validated="default"
|
||||
value=""
|
||||
>
|
||||
<TextArea
|
||||
aria-label="File upload"
|
||||
className=""
|
||||
disabled={false}
|
||||
id="upload"
|
||||
innerRef={null}
|
||||
isDisabled={false}
|
||||
isRequired={false}
|
||||
name="upload"
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
readOnly={false}
|
||||
resizeOrientation="vertical"
|
||||
validated="default"
|
||||
value=""
|
||||
>
|
||||
<textarea
|
||||
aria-invalid={false}
|
||||
aria-label="File upload"
|
||||
className="pf-c-form-control pf-m-resize-vertical"
|
||||
disabled={false}
|
||||
id="upload"
|
||||
name="upload"
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
readOnly={false}
|
||||
required={false}
|
||||
value=""
|
||||
/>
|
||||
</TextArea>
|
||||
</TextArea>
|
||||
</div>
|
||||
<input
|
||||
accept=".json"
|
||||
autoComplete="off"
|
||||
multiple={false}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
style={
|
||||
Object {
|
||||
"display": "none",
|
||||
}
|
||||
}
|
||||
tabIndex={-1}
|
||||
type="file"
|
||||
/>
|
||||
</div>
|
||||
</FileUploadField>
|
||||
</t>
|
||||
</FileUpload>
|
||||
<div
|
||||
aria-live="polite"
|
||||
className="pf-c-form__helper-text"
|
||||
id="upload-helper"
|
||||
>
|
||||
helpFileUpload
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</FormGroup>
|
||||
</JsonFileUpload>
|
||||
`;
|
|
@ -1,18 +0,0 @@
|
|||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
import { ListEmptyState } from "../ListEmptyState";
|
||||
|
||||
describe("<ListEmptyState />", () => {
|
||||
it("render", () => {
|
||||
const comp = render(
|
||||
<ListEmptyState
|
||||
message="No things"
|
||||
instructions="You haven't created any things for this list."
|
||||
primaryActionText="Add it now!"
|
||||
onPrimaryAction={() => {}}
|
||||
secondaryActions={[{ text: "Add a thing", onClick: () => {} }]}
|
||||
/>
|
||||
);
|
||||
expect(comp.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,64 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<ListEmptyState /> render 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class="pf-c-empty-state pf-m-lg"
|
||||
data-testid="empty-state"
|
||||
>
|
||||
<div
|
||||
class="pf-c-empty-state__content"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="pf-c-empty-state__icon"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
role="img"
|
||||
style="vertical-align: -0.125em;"
|
||||
viewBox="0 0 512 512"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"
|
||||
/>
|
||||
</svg>
|
||||
<h4
|
||||
class="pf-c-title pf-m-lg"
|
||||
>
|
||||
No things
|
||||
</h4>
|
||||
<div
|
||||
class="pf-c-empty-state__body"
|
||||
>
|
||||
You haven't created any things for this list.
|
||||
</div>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
class="pf-c-button pf-m-primary"
|
||||
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe="true"
|
||||
data-testid="no-things-empty-action"
|
||||
type="button"
|
||||
>
|
||||
Add it now!
|
||||
</button>
|
||||
<div
|
||||
class="pf-c-empty-state__secondary"
|
||||
>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
class="pf-c-button pf-m-secondary"
|
||||
data-ouia-component-id="OUIA-Generated-Button-secondary-1"
|
||||
data-ouia-component-type="PF4/Button"
|
||||
data-ouia-safe="true"
|
||||
type="button"
|
||||
>
|
||||
Add a thing
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DocumentFragment>
|
||||
`;
|
13
yarn.lock
13
yarn.lock
|
@ -2866,7 +2866,7 @@
|
|||
"@types/node" "*"
|
||||
"@types/responselike" "*"
|
||||
|
||||
"@types/cheerio@*", "@types/cheerio@^0.22.22":
|
||||
"@types/cheerio@*":
|
||||
version "0.22.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.29.tgz#7115e9688bfc9e2f2730327c674b3d6a7e753e09"
|
||||
integrity sha512-rNX1PsrDPxiNiyLnRKiW2NXHJFHqx0Fl3J2WsZq0MTBspa/FgwlqhXJE2crIcc+/2IglLHtSWw7g053oUR8fOg==
|
||||
|
@ -6395,15 +6395,6 @@ enzyme-shallow-equal@^1.0.1, enzyme-shallow-equal@^1.0.4:
|
|||
has "^1.0.3"
|
||||
object-is "^1.1.2"
|
||||
|
||||
enzyme-to-json@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.6.2.tgz#94f85c413bcae8ab67be53b0a94b69a560e27823"
|
||||
integrity sha512-Ynm6Z6R6iwQ0g2g1YToz6DWhxVnt8Dy1ijR2zynRKxTyBGA8rCDXU3rs2Qc4OKvUvc2Qoe1bcFK6bnPs20TrTg==
|
||||
dependencies:
|
||||
"@types/cheerio" "^0.22.22"
|
||||
lodash "^4.17.21"
|
||||
react-is "^16.12.0"
|
||||
|
||||
enzyme@^3.11.0:
|
||||
version "3.11.0"
|
||||
resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.11.0.tgz#71d680c580fe9349f6f5ac6c775bc3e6b7a79c28"
|
||||
|
@ -12135,7 +12126,7 @@ react-inspector@^5.1.0:
|
|||
is-dom "^1.0.0"
|
||||
prop-types "^15.0.0"
|
||||
|
||||
react-is@^16.12.0, react-is@^16.13.1, react-is@^16.3.2, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.6:
|
||||
react-is@^16.13.1, react-is@^16.3.2, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.6:
|
||||
version "16.13.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
||||
|
|
Loading…
Reference in a new issue