mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
wip
This commit is contained in:
parent
e42d8157a0
commit
eafc7dc945
|
@ -22,6 +22,7 @@ export type FormTriggerData = {
|
|||
validForm: boolean;
|
||||
formTitle: string;
|
||||
formDescription?: string;
|
||||
formDescriptionMetadata?: string;
|
||||
formSubmittedHeader?: string;
|
||||
formSubmittedText?: string;
|
||||
redirectUrl?: string;
|
||||
|
|
|
@ -50,6 +50,7 @@ describe('FormTrigger', () => {
|
|||
appendAttribution: false,
|
||||
buttonLabel: 'Submit',
|
||||
formDescription: 'Test Description',
|
||||
formDescriptionMetadata: 'Test Description',
|
||||
formFields: [
|
||||
{
|
||||
defaultValue: '',
|
||||
|
|
|
@ -7,7 +7,13 @@ import type {
|
|||
MultiPartFormData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { formWebhook, prepareFormData, prepareFormReturnItem, resolveRawData } from '../utils';
|
||||
import {
|
||||
formWebhook,
|
||||
parseFormDescription,
|
||||
prepareFormData,
|
||||
prepareFormReturnItem,
|
||||
resolveRawData,
|
||||
} from '../utils';
|
||||
|
||||
describe('FormTrigger, formWebhook', () => {
|
||||
const executeFunctions = mock<IWebhookFunctions>();
|
||||
|
@ -58,6 +64,7 @@ describe('FormTrigger, formWebhook', () => {
|
|||
appendAttribution: true,
|
||||
buttonLabel: 'Submit',
|
||||
formDescription: 'Test Description',
|
||||
formDescriptionMetadata: 'Test Description',
|
||||
formFields: [
|
||||
{
|
||||
defaultValue: '',
|
||||
|
@ -135,6 +142,7 @@ describe('FormTrigger, formWebhook', () => {
|
|||
appendAttribution: true,
|
||||
buttonLabel: 'Submit',
|
||||
formDescription: expected,
|
||||
formDescriptionMetadata: parseFormDescription(expected),
|
||||
formFields: [
|
||||
{
|
||||
defaultValue: '',
|
||||
|
@ -247,6 +255,7 @@ describe('FormTrigger, prepareFormData', () => {
|
|||
validForm: true,
|
||||
formTitle: 'Test Form',
|
||||
formDescription: 'This is a test form',
|
||||
formDescriptionMetadata: 'This is a test form',
|
||||
formSubmittedText: 'Thank you for your submission',
|
||||
n8nWebsiteLink:
|
||||
'https://n8n.io/?utm_source=n8n-internal&utm_medium=form-trigger&utm_campaign=test-instance',
|
||||
|
@ -326,6 +335,7 @@ describe('FormTrigger, prepareFormData', () => {
|
|||
validForm: true,
|
||||
formTitle: 'Test Form',
|
||||
formDescription: 'This is a test form',
|
||||
formDescriptionMetadata: 'This is a test form',
|
||||
formSubmittedText: 'Your response has been recorded',
|
||||
n8nWebsiteLink: 'https://n8n.io/?utm_source=n8n-internal&utm_medium=form-trigger',
|
||||
formFields: [
|
||||
|
|
|
@ -53,8 +53,8 @@ function sanitizeHtml(text: string) {
|
|||
});
|
||||
}
|
||||
|
||||
function parseFormDescription(description: string) {
|
||||
return description.replace(/\\n/g, '\n').replace(/<br>/g, '\n');
|
||||
export function parseFormDescription(description: string) {
|
||||
return description.replace(/^\s*\n+|<\/?[^>]+(>|$)/g, '').slice(0, 150);
|
||||
}
|
||||
|
||||
export function prepareFormData({
|
||||
|
@ -97,6 +97,7 @@ export function prepareFormData({
|
|||
validForm,
|
||||
formTitle,
|
||||
formDescription,
|
||||
formDescriptionMetadata: parseFormDescription(formDescription),
|
||||
formSubmittedHeader,
|
||||
formSubmittedText,
|
||||
n8nWebsiteLink,
|
||||
|
|
|
@ -240,6 +240,7 @@ describe('Send and Wait utils tests', () => {
|
|||
validForm: true,
|
||||
formTitle: '',
|
||||
formDescription: 'Test message',
|
||||
formDescriptionMetadata: 'Test message',
|
||||
formSubmittedHeader: 'Got it, thanks',
|
||||
formSubmittedText: 'This page can be closed now',
|
||||
n8nWebsiteLink: 'https://n8n.io/?utm_source=n8n-internal&utm_medium=form-trigger',
|
||||
|
@ -318,6 +319,7 @@ describe('Send and Wait utils tests', () => {
|
|||
validForm: true,
|
||||
formTitle: 'Test title',
|
||||
formDescription: 'Test description',
|
||||
formDescriptionMetadata: 'Test description',
|
||||
formSubmittedHeader: 'Got it, thanks',
|
||||
formSubmittedText: 'This page can be closed now',
|
||||
n8nWebsiteLink: 'https://n8n.io/?utm_source=n8n-internal&utm_medium=form-trigger',
|
||||
|
|
Loading…
Reference in a new issue