-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(persistent-query): ui implementation
- Loading branch information
1 parent
b988c5b
commit 1221142
Showing
28 changed files
with
1,903 additions
and
1,788 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,8 @@ const FORM_ACTIONS = [ | |
trigger: "update", | ||
action: "SEND_MAIL", | ||
configuration: { | ||
url: "http://localhost:3000", | ||
method: "GET", | ||
from: "[email protected]", | ||
to: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
|
@@ -46,7 +46,7 @@ export const formActionsApiHandlers = [ | |
FORM_ACTIONS.push(newFormAction); | ||
if ( | ||
JSON.stringify(newFormAction) === | ||
'{"configuration":{"channel":"{ CONSTANTS.SLACK_CHANNEL }}","message":"Hello how are youHello how are you","shouldNotify":true},"entity":"test-entity","trigger":"create","integration":"slack","action":"send_message"}' | ||
'{"configuration":{"channel":"{ CONSTANTS.SLACK_CHANNEL }}","message":"Hello how are youHello how are you","shouldNotify":true},"entity":"test-entity","trigger":"create","integration":"slack","action":"SEND_MESSAGE"}' | ||
) { | ||
return res(ctx.status(204)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* eslint-disable testing-library/no-node-access */ | ||
/* eslint-disable testing-library/no-container */ | ||
import React from "react"; | ||
import { render, screen, within } from "@testing-library/react"; | ||
import { ApplicationRoot } from "frontend/components/ApplicationRoot"; | ||
|
@@ -68,7 +70,7 @@ describe("pages/admin/[entity]/config/actions", () => { | |
); | ||
|
||
expect( | ||
within(dialog).queryByRole("option", { name: "SMTP" }) | ||
within(dialog).queryByRole("option", { name: "Non Activated Actions" }) | ||
).not.toBeInTheDocument(); | ||
|
||
await userEvent.type( | ||
|
@@ -105,6 +107,102 @@ describe("pages/admin/[entity]/config/actions", () => { | |
expect( | ||
screen.queryByRole("button", { name: "Create Form Action" }) | ||
).not.toBeInTheDocument(); | ||
|
||
expect(await getTableRows(screen.getByRole("table"))) | ||
.toMatchInlineSnapshot(` | ||
[ | ||
"Integration | ||
Trigger | ||
Action | ||
Action", | ||
"HttpCreatePost", | ||
"SmtpUpdateSend Mail", | ||
"SlackDeleteSend Message", | ||
"SlackCreateSend Message", | ||
] | ||
`); | ||
}); | ||
|
||
it("should delete form action successfully", async () => { | ||
render( | ||
<ApplicationRoot> | ||
<EntityFormActionsSettings /> | ||
</ApplicationRoot> | ||
); | ||
|
||
await userEvent.click(screen.getByRole("button", { name: "Close Toast" })); | ||
|
||
expect(await screen.findByRole("table")).toBeInTheDocument(); | ||
|
||
const tableRows = await screen.findAllByRole("row"); | ||
|
||
expect(tableRows).toHaveLength(5); | ||
|
||
await userEvent.click( | ||
within(tableRows[1]).getByRole("button", { | ||
name: "Delete Form Action", | ||
}) | ||
); | ||
|
||
const confirmBox = await screen.findByRole("alertdialog", { | ||
name: "Confirm Delete", | ||
}); | ||
|
||
await userEvent.click( | ||
await within(confirmBox).findByRole("button", { name: "Confirm" }) | ||
); | ||
|
||
expect(await screen.findByRole("status")).toHaveTextContent( | ||
"Form Action Deleted Successfully" | ||
); | ||
|
||
expect(await screen.findAllByRole("row")).toHaveLength(4); | ||
}); | ||
|
||
it("should show the correct value on the update form", async () => { | ||
const { container } = render( | ||
<ApplicationRoot> | ||
<EntityFormActionsSettings /> | ||
</ApplicationRoot> | ||
); | ||
|
||
await userEvent.click(screen.getByRole("button", { name: "Close Toast" })); | ||
|
||
expect(await screen.findByRole("table")).toBeInTheDocument(); | ||
|
||
const tableRows = await screen.findAllByRole("row"); | ||
|
||
await userEvent.click( | ||
within(tableRows[1]).getByRole("button", { | ||
name: "Edit Form Action", | ||
}) | ||
); | ||
|
||
// | ||
|
||
const dialog = screen.getByRole("dialog"); | ||
|
||
expect(await within(dialog).findByLabelText("SMTP: From")).toHaveValue( | ||
"[email protected]" | ||
); | ||
expect(within(dialog).getByLabelText("SMTP: To")).toHaveValue( | ||
"[email protected]" | ||
); | ||
|
||
expect(container.querySelector(`input[name="trigger"]`)).toHaveValue( | ||
"update" | ||
); | ||
|
||
expect( | ||
within(dialog).getByRole("option", { selected: true }) | ||
).toHaveTextContent("SMTP"); | ||
|
||
expect( | ||
within(dialog).getByRole("option", { selected: true }) | ||
).toHaveTextContent("Send Mail"); | ||
}); | ||
|
||
// it("should display updated diction values", async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { gridItem, gridRoot } from "frontend/design-system/constants/grid"; | ||
import { GridSpanSizes } from "shared/types/ui"; | ||
import styled from "styled-components"; | ||
|
||
export const FormGrid = { | ||
Root: styled.div` | ||
${gridRoot} | ||
grid-auto-rows: auto; | ||
`, | ||
Item: styled.div<{ | ||
$span?: GridSpanSizes; | ||
}>` | ||
${gridItem} | ||
`, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.