Skip to content

feat(site): improve template publishing flow #9346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix tests
  • Loading branch information
aslilac committed Aug 28, 2023
commit e7d64442675fa8770e5eaed89a72afce6232910e
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import Checkbox from "@mui/material/Checkbox"
import FormControlLabel from "@mui/material/FormControlLabel"
import { Stack } from "components/Stack/Stack"

export const Language = {
versionNameLabel: "Version name",
messagePlaceholder: "Write a short message about the changes you made...",
defaultCheckboxLabel: "Promote to default version",
}

export type PublishTemplateVersionDialogProps = DialogProps & {
defaultName: string
isPublishing: boolean
Expand Down Expand Up @@ -67,23 +73,23 @@ export const PublishTemplateVersionDialog: FC<
<FormFields>
<TextField
{...getFieldHelpers("name")}
label="Version name"
label={Language.versionNameLabel}
autoFocus
disabled={isPublishing}
/>

<TextField
{...getFieldHelpers("message")}
label="Message"
placeholder="Write a short message about the changes you made..."
placeholder={Language.messagePlaceholder}
autoFocus
disabled={isPublishing}
multiline
rows={5}
/>

<FormControlLabel
label="Promote to default version"
label={Language.defaultCheckboxLabel}
control={
<Checkbox
size="small"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
MockTemplateVersion,
MockWorkspaceBuildLogs,
} from "testHelpers/entities"
import { Language } from "../../../components/TemplateVersionEditor/PublishTemplateVersionDialog"

// For some reason this component in Jest is throwing a MUI style warning so,
// since we don't need it for this test, we can mock it out
Expand Down Expand Up @@ -67,9 +68,6 @@ test("Use custom name, message and set it as active when publishing", async () =
const messageField = within(publishDialog).getByLabelText("Message")
await user.clear(messageField)
await user.type(messageField, "Informative message")
await user.click(
within(publishDialog).getByLabelText("Promote to default version"),
)
await user.click(
within(publishDialog).getByRole("button", { name: "Publish" }),
)
Expand Down Expand Up @@ -132,6 +130,9 @@ test("Do not mark as active if promote is not checked", async () => {
const nameField = within(publishDialog).getByLabelText("Version name")
await user.clear(nameField)
await user.type(nameField, "v1.0")
await user.click(
within(publishDialog).getByLabelText(Language.defaultCheckboxLabel),
)
await user.click(
within(publishDialog).getByRole("button", { name: "Publish" }),
)
Expand Down