Compare commits

...

7 Commits

9 changed files with 616 additions and 595 deletions

View File

@@ -133,13 +133,16 @@ export const BlockCard = ({
// A button label is invalid if it exists but doesn't have valid text for all enabled languages // A button label is invalid if it exists but doesn't have valid text for all enabled languages
const surveyLanguages = localSurvey.languages ?? []; const surveyLanguages = localSurvey.languages ?? [];
const hasInvalidButtonLabel = const hasInvalidButtonLabel =
block.buttonLabel !== undefined && !isLabelValidForAllLanguages(block.buttonLabel, surveyLanguages); block.buttonLabel !== undefined &&
block.buttonLabel["default"]?.trim() !== "" &&
!isLabelValidForAllLanguages(block.buttonLabel, surveyLanguages);
// Check if back button label is invalid // Check if back button label is invalid
// Back button label should exist for all blocks except the first one // Back button label should exist for all blocks except the first one
const hasInvalidBackButtonLabel = const hasInvalidBackButtonLabel =
blockIdx > 0 && blockIdx > 0 &&
block.backButtonLabel !== undefined && block.backButtonLabel !== undefined &&
block.backButtonLabel["default"]?.trim() !== "" &&
!isLabelValidForAllLanguages(block.backButtonLabel, surveyLanguages); !isLabelValidForAllLanguages(block.backButtonLabel, surveyLanguages);
// Block should be highlighted if it has invalid elements OR invalid button labels // Block should be highlighted if it has invalid elements OR invalid button labels

View File

@@ -513,8 +513,8 @@ export const ElementsView = ({
id: newBlockId, id: newBlockId,
name: getBlockName(index ?? prevSurvey.blocks.length), name: getBlockName(index ?? prevSurvey.blocks.length),
elements: [{ ...updatedElement, isDraft: true }], elements: [{ ...updatedElement, isDraft: true }],
buttonLabel: createI18nString(t("templates.next"), []), buttonLabel: createI18nString("", []),
backButtonLabel: createI18nString(t("templates.back"), []), backButtonLabel: createI18nString("", []),
}; };
return { return {

View File

@@ -101,7 +101,7 @@
"lucide-react": "0.507.0", "lucide-react": "0.507.0",
"markdown-it": "14.1.0", "markdown-it": "14.1.0",
"mime-types": "3.0.1", "mime-types": "3.0.1",
"next": "15.5.6", "next": "15.5.9",
"next-auth": "4.24.12", "next-auth": "4.24.12",
"next-safe-action": "7.10.8", "next-safe-action": "7.10.8",
"node-fetch": "3.3.2", "node-fetch": "3.3.2",

View File

@@ -232,7 +232,7 @@ test.describe("Survey Create & Submit Response without logic", async () => {
for (let i = 0; i < surveys.createAndSubmit.ranking.choices.length; i++) { for (let i = 0; i < surveys.createAndSubmit.ranking.choices.length; i++) {
await page.getByText(surveys.createAndSubmit.ranking.choices[i]).click(); await page.getByText(surveys.createAndSubmit.ranking.choices[i]).click();
} }
await page.locator("#questionCard-12").getByRole("button", { name: "Next" }).click(); await page.locator("#questionCard-12").getByRole("button", { name: "Finish" }).click();
// loading spinner -> wait for it to disappear // loading spinner -> wait for it to disappear
await page.getByTestId("loading-spinner").waitFor({ state: "hidden" }); await page.getByTestId("loading-spinner").waitFor({ state: "hidden" });
}); });
@@ -979,7 +979,7 @@ test.describe("Testing Survey with advanced logic", async () => {
.fill("This is my city"); .fill("This is my city");
await expect(page.getByLabel(surveys.createWithLogicAndSubmit.address.placeholder.zip)).toBeVisible(); await expect(page.getByLabel(surveys.createWithLogicAndSubmit.address.placeholder.zip)).toBeVisible();
await page.getByLabel(surveys.createWithLogicAndSubmit.address.placeholder.zip).fill("12345"); await page.getByLabel(surveys.createWithLogicAndSubmit.address.placeholder.zip).fill("12345");
await page.locator("#questionCard-13").getByRole("button", { name: "Next" }).click(); await page.locator("#questionCard-13").getByRole("button", { name: "Finish" }).click();
// loading spinner -> wait for it to disappear // loading spinner -> wait for it to disappear
await page.getByTestId("loading-spinner").waitFor({ state: "hidden" }); await page.getByTestId("loading-spinner").waitFor({ state: "hidden" });

View File

@@ -41,8 +41,8 @@
"i18n:validate": "pnpm scan-translations" "i18n:validate": "pnpm scan-translations"
}, },
"dependencies": { "dependencies": {
"react": "19.1.0", "react": "19.1.4",
"react-dom": "19.1.0" "react-dom": "19.1.4"
}, },
"devDependencies": { "devDependencies": {
"@azure/microsoft-playwright-testing": "1.0.0-beta.7", "@azure/microsoft-playwright-testing": "1.0.0-beta.7",

View File

@@ -263,7 +263,7 @@ export function MultipleChoiceMultiElement({
<label <label
tabIndex={isCurrent ? 0 : -1} tabIndex={isCurrent ? 0 : -1}
className={labelClassName} className={labelClassName}
onKeyDown={handleKeyDown(otherOption.id)}> onKeyDown={otherSelected ? undefined : handleKeyDown(otherOption.id)}>
<span className="fb-flex fb-items-center fb-text-sm"> <span className="fb-flex fb-items-center fb-text-sm">
<input <input
type="checkbox" type="checkbox"

View File

@@ -99,7 +99,7 @@ export function LanguageSwitch({
{showLanguageDropdown ? ( {showLanguageDropdown ? (
<div <div
className={cn( className={cn(
"fb-bg-input-bg fb-text-heading fb-absolute fb-top-10 fb-max-h-64 fb-space-y-2 fb-overflow-auto fb-rounded-md fb-p-2 fb-text-xs", "fb-bg-input-bg fb-text-heading fb-absolute fb-top-10 fb-max-h-64 fb-space-y-2 fb-overflow-auto fb-rounded-md fb-p-2 fb-text-xs fb-border-border fb-border",
dir === "rtl" ? "fb-left-8" : "fb-right-8" dir === "rtl" ? "fb-left-8" : "fb-right-8"
)} )}
ref={languageDropdownRef}> ref={languageDropdownRef}>

View File

@@ -1356,6 +1356,8 @@ export const ZSurvey = z
} }
if ( if (
!isBackButtonHidden &&
blockIndex > 0 &&
block.backButtonLabel?.[defaultLanguageCode] && block.backButtonLabel?.[defaultLanguageCode] &&
block.backButtonLabel[defaultLanguageCode].trim() !== "" block.backButtonLabel[defaultLanguageCode].trim() !== ""
) { ) {

1186
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff